SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
6   JVM                        (OpenJDK6)    Zero/
Shark



http://today.java.net/pub/a/today/2009/05/21/zero-
and-shark-openjdk-port.html
hg clone http://icedtea.classpath.org/hg/release/
icedtea6-1.11

sh autogen.sh

./configure --enable-zero --enable-shark

:

checking for a JamVM source zip... not specified

checking whether to disable optimizations and build
with -O0 -g... no

checking whether to use the Shark JIT... yes

configure: error: shark is unsupported in this
release
void TemplateTable::initialize() {

  def(Bytecodes::_iadd , ____|____|____|____, itos, itos,
iop2                , add          );
  def(Bytecodes::_ladd , ____|____|____|____, ltos, ltos,
lop2                , add          );

0 templateTable.hpp        <global>       267   static void invokevirtual(int
byte_no);
1 templateTable_sparc.cpp  invokevirtual 2947   void
TemplateTable::invokevirtual(int byte_no)
                                                {
2 templateTable_x86_32.cpp invokevirtual 2993   void
TemplateTable::invokevirtual(int byte_no)
                                                {
3 templateTable_x86_64.cpp invokevirtual 3001   void
TemplateTable::invokevirtual(int byte_no)
                                                {
4 templateTable.cpp        initialize     441   def
(Bytecodes::_invokevirtual ,
                                                ubcp|disp|clvm|____, vtos,
vtos, invokevirtual
                                                , f2_byte );
0   cpu/sparc/vm/templateTable_sparc.cpp
1   cpu/sparc/vm/templateTable_sparc.hpp
2   cpu/x86/vm/templateTable_x86_32.cpp
3   cpu/x86/vm/templateTable_x86_32.hpp
4   cpu/x86/vm/templateTable_x86_64.cpp
5   cpu/x86/vm/templateTable_x86_64.hpp
6   cpu/zero/vm/templateTable_zero.cpp          // empty
7   cpu/zero/vm/templateTable_zero.hpp          // empty
8   share/vm/interpreter/templateTable.cpp
9   share/vm/interpreter/templateTable.hpp
No template interpreter for zero...

$ more cpu/zero/vm/*
...

SharkFrame : public ZeroFrame

ZeroStack

$ ls share/vm/shark
llvmHeaders.hpp          sharkEntry.hpp          sharkStack.cpp
llvmValue.hpp          sharkFunction.cpp     sharkStack.hpp
sharkBlock.cpp          sharkFunction.hpp     sharkState.cpp
sharkBlock.hpp          sharkInliner.cpp     sharkState.hpp
sharkBuilder.cpp     sharkInliner.hpp     sharkStateScanner.cpp
** llvmHeaders.hpp

#include <llvm/Argument.h>
#include <llvm/Constants.h>
#include <llvm/DerivedTypes.h>
#include <llvm/ExecutionEngine/ExecutionEngine.h>
#include <llvm/Instructions.h>
#include <llvm/LLVMContext.h>
#include <llvm/Module.h>
#if SHARK_LLVM_VERSION < 27
#include <llvm/ModuleProvider.h>
#endif
IRBuilder
Builder.CreateAdd
Builder.CreateCall
Builder.CreateRet
Function::Create
BasicBlock::Create

fcmp
uitofp
sitofp
call
ret
  FunctionPassManager OurFPM(TheModule);

  // Set up the optimizer pipeline.  Start with registering info about how
the
  // target lays out data structures.
  OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));
  // Do simple "peephole" optimizations and bit-twiddling optzns.
  OurFPM.add(createInstructionCombiningPass());
  // Create the JIT.  This takes ownership of the module.
  TheExecutionEngine = EngineBuilder(TheModule).create();

--- back to shark

$ grep ExecutionEngine *
llvmHeaders.hpp:#include <llvm/ExecutionEngine/ExecutionEngine.h>
llvmHeaders.hpp:#include <llvm/ExecutionEngine/JITMemoryManager.h>
llvmHeaders.hpp:#include <llvm/ExecutionEngine/JIT.h>
sharkCompiler.cpp:  _execution_engine_lock = new Monitor(Mutex::leaf,
"SharkExecutionEngineLock");
sharkCompiler.cpp:  _execution_engine = ExecutionEngine::createJIT(
sharkCompiler.hpp:  llvm::ExecutionEngine* _execution_engine;
sharkCompiler.hpp:  llvm::ExecutionEngine* execution_engine() const {
SharkCompiler::compile_method()


SharkFunction::build()   native code         register_method.


class SharkFunction : public SharkTargetInvariants {
 friend class SharkStackWithNormalFrame;

 public:
  static llvm::Function* build(ciEnv*        env,
                               SharkBuilder* builder,
                               ciTypeFlow*   flow,
                               const char*   name) {
    SharkFunction function(env, builder, flow, name);
    return function.function();
  }
sharkBlock.cpp:void SharkBlock::parse_bytecode(int start, int limit)

    case Bytecodes::_iadd:
      b = pop();
      a = pop();
      push(SharkValue::create_jint(
        builder()->CreateAdd(a->jint_value(), b->jint_value()), false));




 // Create the JIT
  std::string ErrorMsg;

    EngineBuilder builder(_normal_context->module());
    builder.setMCPU(MCPU);
    builder.setMAttrs(MAttrs);
    builder.setJITMemoryManager(memory_manager());
    builder.setEngineKind(EngineKind::JIT);
    builder.setErrorStr(&ErrorMsg);
    _execution_engine = builder.create();

Mais conteúdo relacionado

Mais procurados

ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf Conference
 

Mais procurados (20)

Information security programming in ruby
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
 
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
ZFConf 2012: Capistrano для деплоймента PHP-приложений (Роман Лапин)
 
Interceptors: Into the Core of Pedestal
Interceptors: Into the Core of PedestalInterceptors: Into the Core of Pedestal
Interceptors: Into the Core of Pedestal
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDD
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensions
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous Testing
 
Continuous testing In PHP
Continuous testing In PHPContinuous testing In PHP
Continuous testing In PHP
 
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
ZFConf 2010: Zend Framework & MVC, Model Implementation (Part 2, Dependency I...
 
How to Write Node.js Module
How to Write Node.js ModuleHow to Write Node.js Module
How to Write Node.js Module
 
はじめてのSymfony2
はじめてのSymfony2はじめてのSymfony2
はじめてのSymfony2
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Web
 
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero ClicksHow to Develop Puppet Modules: From Source to the Forge With Zero Clicks
How to Develop Puppet Modules: From Source to the Forge With Zero Clicks
 
Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014
 
Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)Diving into HHVM Extensions (PHPNW Conference 2015)
Diving into HHVM Extensions (PHPNW Conference 2015)
 
Testing Backbone applications with Jasmine
Testing Backbone applications with JasmineTesting Backbone applications with Jasmine
Testing Backbone applications with Jasmine
 
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
ZFConf 2012: Zend Framework 2, a quick start (Enrico Zimuel)
 
Node.js/io.js Native C++ Addons
Node.js/io.js Native C++ AddonsNode.js/io.js Native C++ Addons
Node.js/io.js Native C++ Addons
 
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHPIPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
IPC2010SE Doctrine2 Enterprise Persistence Layer for PHP
 
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
ZFConf 2012: Dependency Management в PHP и Zend Framework 2 (Кирилл Чебунин)
 

Semelhante a Shark

Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册
Yiwei Ma
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
Yiwei Ma
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
Yiwei Ma
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
tomcopeland
 

Semelhante a Shark (20)

How to reverse engineer Android applications
How to reverse engineer Android applicationsHow to reverse engineer Android applications
How to reverse engineer Android applications
 
How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...
 
Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册Nginx 0.9.x 安装手册
Nginx 0.9.x 安装手册
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Capistrano
CapistranoCapistrano
Capistrano
 
Writing your Third Plugin
Writing your Third PluginWriting your Third Plugin
Writing your Third Plugin
 
Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册Nginx 0.8.x 安装手册
Nginx 0.8.x 安装手册
 
Advanced debugging  techniques in different environments
Advanced debugging  techniques in different environmentsAdvanced debugging  techniques in different environments
Advanced debugging  techniques in different environments
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
lecture5
lecture5lecture5
lecture5
 
lecture5
lecture5lecture5
lecture5
 
Node workShop Basic
Node workShop BasicNode workShop Basic
Node workShop Basic
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
DevOps in PHP environment
DevOps in PHP environment DevOps in PHP environment
DevOps in PHP environment
 
EC2
EC2EC2
EC2
 
IstSec'14 - İbrahim BALİÇ - Automated Malware Analysis
IstSec'14 - İbrahim BALİÇ -  Automated Malware AnalysisIstSec'14 - İbrahim BALİÇ -  Automated Malware Analysis
IstSec'14 - İbrahim BALİÇ - Automated Malware Analysis
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Shark

  • 1.
  • 2. 6 JVM (OpenJDK6) Zero/ Shark http://today.java.net/pub/a/today/2009/05/21/zero- and-shark-openjdk-port.html
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. hg clone http://icedtea.classpath.org/hg/release/ icedtea6-1.11 sh autogen.sh ./configure --enable-zero --enable-shark : checking for a JamVM source zip... not specified checking whether to disable optimizations and build with -O0 -g... no checking whether to use the Shark JIT... yes configure: error: shark is unsupported in this release
  • 8. void TemplateTable::initialize() {   def(Bytecodes::_iadd , ____|____|____|____, itos, itos, iop2                , add          );   def(Bytecodes::_ladd , ____|____|____|____, ltos, ltos, lop2                , add          ); 0 templateTable.hpp        <global>       267 static void invokevirtual(int byte_no); 1 templateTable_sparc.cpp  invokevirtual 2947 void TemplateTable::invokevirtual(int byte_no)                                               { 2 templateTable_x86_32.cpp invokevirtual 2993 void TemplateTable::invokevirtual(int byte_no)                                               { 3 templateTable_x86_64.cpp invokevirtual 3001 void TemplateTable::invokevirtual(int byte_no)                                               { 4 templateTable.cpp        initialize     441 def (Bytecodes::_invokevirtual ,                                               ubcp|disp|clvm|____, vtos, vtos, invokevirtual                                               , f2_byte );
  • 9. 0 cpu/sparc/vm/templateTable_sparc.cpp 1 cpu/sparc/vm/templateTable_sparc.hpp 2 cpu/x86/vm/templateTable_x86_32.cpp 3 cpu/x86/vm/templateTable_x86_32.hpp 4 cpu/x86/vm/templateTable_x86_64.cpp 5 cpu/x86/vm/templateTable_x86_64.hpp 6 cpu/zero/vm/templateTable_zero.cpp          // empty 7 cpu/zero/vm/templateTable_zero.hpp          // empty 8 share/vm/interpreter/templateTable.cpp 9 share/vm/interpreter/templateTable.hpp
  • 10. No template interpreter for zero... $ more cpu/zero/vm/* ... SharkFrame : public ZeroFrame ZeroStack $ ls share/vm/shark llvmHeaders.hpp          sharkEntry.hpp          sharkStack.cpp llvmValue.hpp          sharkFunction.cpp     sharkStack.hpp sharkBlock.cpp          sharkFunction.hpp     sharkState.cpp sharkBlock.hpp          sharkInliner.cpp     sharkState.hpp sharkBuilder.cpp     sharkInliner.hpp     sharkStateScanner.cpp
  • 11. ** llvmHeaders.hpp #include <llvm/Argument.h> #include <llvm/Constants.h> #include <llvm/DerivedTypes.h> #include <llvm/ExecutionEngine/ExecutionEngine.h> #include <llvm/Instructions.h> #include <llvm/LLVMContext.h> #include <llvm/Module.h> #if SHARK_LLVM_VERSION < 27 #include <llvm/ModuleProvider.h> #endif
  • 12. IRBuilder Builder.CreateAdd Builder.CreateCall Builder.CreateRet Function::Create BasicBlock::Create fcmp uitofp sitofp call ret   FunctionPassManager OurFPM(TheModule);   // Set up the optimizer pipeline.  Start with registering info about how the   // target lays out data structures.   OurFPM.add(new TargetData(*TheExecutionEngine->getTargetData()));   // Do simple "peephole" optimizations and bit-twiddling optzns.   OurFPM.add(createInstructionCombiningPass());
  • 13.   // Create the JIT.  This takes ownership of the module.   TheExecutionEngine = EngineBuilder(TheModule).create(); --- back to shark $ grep ExecutionEngine * llvmHeaders.hpp:#include <llvm/ExecutionEngine/ExecutionEngine.h> llvmHeaders.hpp:#include <llvm/ExecutionEngine/JITMemoryManager.h> llvmHeaders.hpp:#include <llvm/ExecutionEngine/JIT.h> sharkCompiler.cpp:  _execution_engine_lock = new Monitor(Mutex::leaf, "SharkExecutionEngineLock"); sharkCompiler.cpp:  _execution_engine = ExecutionEngine::createJIT( sharkCompiler.hpp:  llvm::ExecutionEngine* _execution_engine; sharkCompiler.hpp:  llvm::ExecutionEngine* execution_engine() const {
  • 14. SharkCompiler::compile_method() SharkFunction::build() native code register_method. class SharkFunction : public SharkTargetInvariants {  friend class SharkStackWithNormalFrame;  public:   static llvm::Function* build(ciEnv*        env,                                SharkBuilder* builder,                                ciTypeFlow*   flow,                                const char*   name) {     SharkFunction function(env, builder, flow, name);     return function.function();   }
  • 15. sharkBlock.cpp:void SharkBlock::parse_bytecode(int start, int limit)     case Bytecodes::_iadd:       b = pop();       a = pop();       push(SharkValue::create_jint(         builder()->CreateAdd(a->jint_value(), b->jint_value()), false));  // Create the JIT   std::string ErrorMsg;   EngineBuilder builder(_normal_context->module());   builder.setMCPU(MCPU);   builder.setMAttrs(MAttrs);   builder.setJITMemoryManager(memory_manager());   builder.setEngineKind(EngineKind::JIT);   builder.setErrorStr(&ErrorMsg);   _execution_engine = builder.create();