SlideShare uma empresa Scribd logo
1 de 61
Java Performance
          artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




Execution Engine
Java Performance
                                                                                       2

                              artdb@ex-em.com | performeister.tistory.com | twitter @novathinker


Execution Engine
  1)   Execution Engine
  2)   Interpreter
  3)   JIT Compiler
  4)   Execution Engine
IBM JIT Compiler
  1)   JIT Compiler
  2)   Mixed Mode Interpreter
  3)   JIT Compiler Optimization
  4)   JIT Compiler
Hotspot Compiler
  1)   Hotspot Compiler
  2)   Hotspot Compiler Optimization
  3)   Hotspot Compiler Option
Java Performance
          artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




Execution Engine
Java Performance
                                                                         4
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
   Execution Engine




• Execution Engine
   Bytecode                                    Runtime Module
• Instruction
  – Bytecode                        = Instruction
  – Execution Engine                                   Instruction

      • Instruction = Opcode + Operand
      • Execution Engine opcode fetch
                          opcode fetch
Java Performance
                                                                        5
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Execution Engine




• Instruction
  – Bytecode                            method level
        • Method             return                      Exception


  –                  Instruction
        •                                          opcode
            opcode
        • Goto return                                    opcode
        • Exception                                    catch
          opcode
Java Performance
                                                                          6
                       Java Performance Fundamental | twitter @novathinker
                                    artdb@ex-em.com | performeister.tistory.com
    Execution Engine




    – Bytecode                  mnemonic
                                     >javap –c classfile      (bytecode)




   Java Source Code

Method

      offset
Instruction Mnemonic
Operand
Java Performance
                                                                        7
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Execution Engine




• JVM




                     (Source: Sun Microsystems)
http://java.sun.com/developer/technicalArticles/Networking/HotSpot/
Execution Engine
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           8




• Execution Engine
  – Bytecode                                Runtime Module



   Java Source                                               Classfile
       .java                                                  .class

                                   Javac .java

    JVM


       Runtime           Interpreting Execution Bytecode
       Data Area                       Engine    Stream ClassLoader
Java Performance
                                                                        9
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Execution Engine




• Execution Engine
  – Bytecode                                            Interpreting



  – Interpreting

        • Interpreter

        • JIT Compile
Java Performance
                                                                        10
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Execution Engine




• Interpreter
  – Bytecode                  compile
  – Bytecode

  – Bytecode
  –
  –                    JVM             Bytecode          interpreter
Java Performance
                                                                        11
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Execution Engine




• JIT(Just-in-time) Compiler
  – Bytecode                         native code

  – Native code compile
  – Native Code
           Cache

  –                                                    Interpreter

  – Lazy fashion
Java Performance
                                                                                  12
                        Java Performance Fundamental | twitter @novathinker
                                     artdb@ex-em.com | performeister.tistory.com
     Execution Engine




 • JIT(Just-in-time) Compiler

                                                                                bytecode
Class a{                    Heap          Method Table
  a.f1();                                                              f1()
  a.f3();                    ptr                f1()
                                                                        f3()
}                                               f2()
                          Object A              f3()             JIT
                                                                         f1()    native
                                                f4()                             code
                                                                        f3()
                                                …
Java Performance
                                                                          13
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Execution Engine




• JIT(Just-in-time) Compiler


    Source code                         bytecode            Native code

 int a;                          iload_0                 ld [$fp-0] , $r0
                                                         st $r0, [$sp+0]
 int b;                          iload_1                 ld [$fp-4] , $r1
                                                         st $r1, [$sp+4]
 int c = a + b;                  iadd                    ld [$sp+0] , $r0
                                                         ld [$sp+0] , $r1
                                                         add $r0, $r1, $r2
                                                         st $r2, [$sp+0]
Java Performance
                                                                        14
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Execution Engine




• Execution Engine
  – Loop                      bytecode
Java Performance
                                                                                      15
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com
   Execution Engine




• Execution Engine
   –
         • Java
         •


   Array_ptr                                 Stack

                                                                    A[0][0]
    Object_ptr                 A[0]            Object_ptr
                                                                    A[0][1]
       length                  A[1]              length                           A[1][0]
                                                                   Class_ptr
                            Class_ptr                                             A[1][1]
                                               Object_ptr
 Heap                                                                            Class_ptr
                                                 length

Method Area
                        Class runtime type                  Class runtime type info
                          Method block                          Method block
Java Performance
                                                                        16
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Execution Engine




• Execution Engine
  –
        •2                                              5
        •                Dimension
Java Performance
         artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




IBM JIT Compiler



                                                                      17
Java Performance
                                                                        18
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• JIT Compiler
  – JIT compiler                  method
        (1)                   Method                             Method
            table       JIT compiler
        (2)       JIT Compiler Method                     Native Code
                          Cache
        (3)                       Method
        (4)                  Method table                 Native Code
                                               Code
  – JVM                                Method Call
Java Performance
                                                                        19
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• JIT Compiler

      Java Application



      Java VM(Interpreter)
                                                        bytecode


                                              JIT compiler

                                                       native code
Java Performance
                                                                        20
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• JIT Compiler
  – JIT              Enable
        • JVM           Startup              Applet


  – JIT              Disable
        • JVM                                        Bytecode
          interpret
  – IBM JVM                       Mixed Mode Interpreter(MMI)
Java Performance
                                                                        21
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Mixed Mode Interpreter(MMI)
  – 1.4
  – JVM                                         Runtime

  – Fast Assembler bytecode interpreter
  – JIT
  – Method          count     threshold
    compile
  – Low-usage method                         compile
      compile
Java Performance
                                                                        22
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Mixed Mode Interpreter(MMI)
  – 1.4.2                            JIT, MMI        JVM

  – JIT                   shared library(libjitc.so)
  – Java5                      JIT     JVM           component
         MMI
  – Java5                     MMI
Java Performance
                                                                              23
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Mixed Mode Interpreter(MMI)

      Java Application



      Java VM(Interpreter)
                                                       bytecode


                                              JIT compiler   MMI

                                               native code        threshold
Java Performance
                                                                        24
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Mixed Mode Interpreter(MMI)
  –
        •                Method call            compile
        •                    count
        • Count Compilation Threshold
          compile
        • Compile                         count     0
        • Count
        • JIT Recompile Threshold                                 compile
                     Optimization                             recompile
        •                   method
Java Performance
                                                                            25
                         Java Performance Fundamental | twitter @novathinker
                                      artdb@ex-em.com | performeister.tistory.com
      IBM JIT Compiler




  • Mixed Mode Interpreter(MMI)
      – JIT/MMI Mode
MODE         JIT         MMI                              Effect

                               •JVM                  ,
default      ON          ON
                               •Method   Interpret       JIT Compile
                               •          IBM_MIXED_MODE_THRESHOLD=0
 MMI
             ON          OFF
Disable
                               •     Method                 JIT Compile
                               •JVM
                               •-Xint
                             •       -Djava.compiler=NONE
  JIT                        •                JAVA_COMPILER=NONE
             OFF         OFF
Disable                      •         Interpret         JVM
                                 Runtime
                               •JIT compile                      MMI
Java Performance
                                                                        26
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Mixed Mode Interpreter(MMI)
  – MMI Threshold
        • IBM_MIXED_MODE_THRESHOLD=<x>[,<y>]

        • <x>            interpret
              –                             method
              – Default       OS               500       1000
        • <y>            compile                          seed
              –       compile           method
              – y             x                    Threshold
              – default 0
Java Performance
                                                                        27
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• JIT Compiler Optimization
Java Performance
                                                                         28
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Optimization Level
  – Optimization
  – -Xjit
  –                    JVM            Adaptive




  noOpt              cold     Warm      hot     veryHot      scorching
Java Performance
                                                                          29
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Optimization Level
  – Adaptive compilation
        • Methods                      interpret                   interpreted

        •N             ‘warm’ level compile                          warm
        • Sampling thread hot methods
                                                                      hot
        • Methods ‘hot’       ‘scorching’
          recompile                                                 profiling

        • Temporary profiling step
          ‘scorching’                                              scorching
Java Performance
                                                                        30
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Optimization Phase (~1.4.2)
  – 1.4.2                             4
        • Bytecode Optimization
          : bytecode
              –      Flow analysis
              –      Static method inlining
              –      Virtual method inlining
              –      Idiomatic translation
              –      Field privatization
              –      Stack and register analysis
              –                     bytecode quad        native code
              –                conventional native compiler
Java Performance
                                                                        31
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Optimization Phase(~1.4.2)
        • Quad Optimization
              –      Control flow optimization
              –      Data flow optimization
              –      Escape analysis
              –      Loop analysis
              –      Data flow analysis
              –      Quad Optimization
        • DAG(Direct Acyclic Graph) Optimization
              –      Induction analysis
              –      Loop Versioning
              –      Loop Striding
              –      Induction removal
              –      Dead storage analysis
Java Performance
                                                                        32
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Optimization Phase(~1.4.2)
        • Native code Generation
              – Bytecode        Quad     Quad    DAG                   Native
                Code
Java Performance
                                                                        33
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Optimization Phase (Java5~)
  – Java5                   5       phase

  – Bytecode               Method tree
     Native Code

  – Compile                        code cache
Java Performance
                                                                        34
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  IBM JIT Compiler




• Optimization Phase (Java5~)
        • Inlining
              –                        caller


                                      inlining


              –      Trivial inlining
              –      Call graph inlining
              –      Tail recursion elimination
              –      Virtual call guard optimization
IBM JIT Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           35




• Optimization Phase (Java5~)
        • Local optimization
              –
              – Local data flow analysis and optimizations
              – Register usage optimization
              – Simplification of Java Idioms
        • Control flow optimizations
              –      Method      control flow
              –      Code reordering, splitting and removal
              –      Loop reduction and inversion
              –      Loop Striding and loop-invariant code motion
              –      Loop unrolling and peeling
              –      Loop versioning and specialization
              –      Exception-directed optimization        - Switch
                     analysis
IBM JIT Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           36




• Optimization Phase (Java5~)
        • Global Optimization
              –                method
              –          Expensive
              –      Global data flow analysis and optimizations
              –      Partial redundancy elimination
              –      Escape analysis
              –      GC and memory allocation optimizations
              –      Synchronization optimization
        • Native code generation
              – Method tree        machine code
              – Platform
IBM JIT Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           37




• JIT Compiler
  –
        • IBM_MIXED_MODE_THRESHOLD
        • JITC_COMPILEOPT
              –      NMMI2JIT : hot Method            compile
              –      NINLINING : Inline code
              –      NQOPTIMIZE : Quad
              –      NDOPT : DAG
              –      NBCOPT : Bytecode
              –      NALL :     Optimization

  –                           Java5
IBM JIT Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           38




• JIT Compiler
  – JVM Parameter
        • -Xint : interpret only
        • -Xjit[:<parameter>=<value>,…]
              – count=<n>
                : compile         , n=0          method
                  compile
              – limitFile=(<Filename>,<m>,<n>)
                :        m          n           compile
              – optlevel=[noOpt | cold | warm | hot | veryHot |
                scorching]
                :      Method          Optimization level
              – Verbose
                : JIT Compiler          method compile
Java Performance
                   artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




• Class Sharing




     JVM1
Java Performance
                   artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




• Class Sharing




     JVM1
Java Performance
                           artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




• Class Sharing



              Cached Classes




     JVM1
Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




• Class Sharing



              Cached Classes




              JVM2
Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




• Class Sharing



              Cached Classes




              JVM2                JVM3                       JVM4
Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




• Class Sharing



              Cached Classes           Cached Classes




              JVM2                JVM3                       JVM4
Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




• Class Sharing

                 Shared Cache 1       Shared Cache 2
      AOT Code                                   AOT Code


                     Cached Classes           Cached Classes




                     JVM2                JVM3                       JVM4
Java Performance
                         artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




         -Xscminaot       AOT Code



                           -Xscmaxaot
    -Xscmaxaot
                      AOT Code




-Xscmx


                        Shared Classes



                           Metadata
Java Performance
          artdb@ex-em.com | performeister.tistory.com | twitter @novathinker




Hotspot Compiler
Java Performance
                                                                        42
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Hotspot Compiler



• Hotspot Compiler
  – Mixed Mode system
        • Interpreter            JIT Compiler
        • Bytecode                  interpreted
        • Profiling                  Dynamic Compile
        •             recompile                   interpreted

                                    Interpreted



         Recompile
                                                        Profiling
     Interpreted Again

                                     Dynamic
                                    Compilation
Java Performance
                                                                        43
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Hotspot Compiler



• Hotspot Compiler
  – Mixed Mode system
        • Hotspot            Default
        • Hotspot
              – Profiling             Hot Code              compile

              –              Compile

              – Hot code        Optimization
              – Compile
Java Performance
                                                                        44
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Hotspot Compiler




• Hotspot Compiler
  – Hotspot                            VM
  – Client               Server
  –                                  Compiler


                                                   Java Hotspot
                                                     Server VM
               Java Hotspot
           Performance Engine

                                                   Java Hotspot
                                                     Client VM
Java Performance
                                                                        45
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
  Hotspot Compiler




• Hotspot Compiler
  – Server VM
        • Advanced Adaptive Compiler
  – Client VM
        •                                 Compile


                       Client                         Server

                     C1 Compiler                     C2 Compiler


                       Runtime                         Runtime
Hotspot Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           46




• Hotspot Compiler
  – Client Compiler
        • C1 Compiler
        •                  Optimization
        • Value Numbering, inlining, class analysis

        •             Static                                      Compile

        • Profiling                          Counting


                                Value Numbering
Hotspot Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           47




• Hotspot Compiler
  – Server Compiler
        •   Opto             C2 Compiler
        •   High optimizing bytecode compiler
        •   ‘Intermediate’ optimizing compiler
        •   Interpreter Profiling        Optimization

        • Inlining
              – CHA        Profiling Data            Inline Decision
        • Loop Optimization
        • Loop Unrolling
Hotspot Compiler
                         Java Performance
                      Java Performance Fundamental | twitter @novathinker
                                   artdb@ex-em.com | performeister.tistory.com48




• Hotspot Compiler Optimization
   –                  Server Compiler
         • Common Sub-expression Elimination
               –

                                                     tmp   = b * c;
       a = b * c + g;                                a =   tmp + g;
       d = b * c * d;                  CSE           d =   tmp * d;
       e = b * c;                                    e =   tmp;
         • Loop unrolling
               – Loop

                                                              array[0] = 0;
for (int i; i < 3; i++)
       array[i] = i;                  Loop Unrolling          array[1] = 1;
                                                              array[2] = 2;
Hotspot Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           49




• Hotspot Compiler Optimization
  –                  Server Compiler
        • On Stack Replacement
              – Loop           Interpreted code      Compiled code


                                    • Main method     1

                                    •         Main              loop

                                    • 10000          compile

                                    •         main         interpreting

                                    • 14000          OSR

                                    • loop       Compile code
Hotspot Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           50



• Hotspot Compiler Optimization
  –                  Server Compiler
        • array-bounds check elimination
              – Array                      range check
              – Array Index                       ,


        • Dead Code Elimination
              –                   code    compile
Hotspot Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           51




• Hotspot Compiler Optimization
  –                  Server Compiler
        • Code Hoisting
              –                                                (hoist)


                                        Hoisting


        • Data Flow Analysis
              –                      Data
        • Deoptimization
              – Hotspot
              – Compile                            Interpret
Hotspot Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           52




• Hotspot Compiler Option
        • -Xint
          : Interpret Mode
        • -XX:+AggressiveOpts                         (+ Java5 update 6)
          : Compile Optimization
        • -XX:CompileThreshold=<value>
          : compile       (Client 1500, Server
          10000)
        • -Xcomp
          :    code
Hotspot Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           53




• Hotspot Compiler Option
        • -Xbatch
          : background compilation
               Method compile
          background process
        • -XX:+AlwaysCompileLoopMethods
          : Default false   Loop      method
          Compile
        • -XX:+BackgroundCompilation
          : background    JIT Compile
          enable       compile      interpreted code
Hotspot Compiler
                        Java Performance
                     Java Performance Fundamental | twitter @novathinker
                                  artdb@ex-em.com | performeister.tistory.com
                                                                           54




• Hotspot Compiler Option
        • -XX:CICompilerCount=<value>
          : Maximum concurrent compile Thread
        • -XX:+Cltime
          : JIT Compiler             Print
        • -XX:+PrintCompilation
          : Method Compile
Java Performance
                                                   55
Java Performance Fundamental | twitter @novathinker
             artdb@ex-em.com | performeister.tistory.com

Mais conteúdo relacionado

Mais procurados

Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updatesVinay H G
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
Erjang - A journey into Erlang-land
Erjang - A journey into Erlang-landErjang - A journey into Erlang-land
Erjang - A journey into Erlang-landKresten Krab Thorup
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin ProgrammingAtlassian
 
Jvm performance tuning
Jvm performance tuningJvm performance tuning
Jvm performance tuningIgor Igoroshka
 
How to train the jdt dragon
How to train the jdt dragonHow to train the jdt dragon
How to train the jdt dragonAyushman Jain
 
Invokedynamic in 45 Minutes
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 MinutesCharles Nutter
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Jeffrey Groneberg
 
Ruby Plugins for Jenkins
Ruby Plugins for JenkinsRuby Plugins for Jenkins
Ruby Plugins for Jenkinscowboyd
 
Java Performance Monitoring & Tuning
Java Performance Monitoring & TuningJava Performance Monitoring & Tuning
Java Performance Monitoring & TuningMuhammed Shakir
 
Introduction to java by priti sajja
Introduction to java by priti sajjaIntroduction to java by priti sajja
Introduction to java by priti sajjaPriti Srinivas Sajja
 
JDK7: Improved support for dynamic languages
JDK7: Improved support for dynamic languagesJDK7: Improved support for dynamic languages
JDK7: Improved support for dynamic languagesSander Mak (@Sander_Mak)
 
6010 java programming version 6
6010 java programming version 66010 java programming version 6
6010 java programming version 6bestip
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts weili_at_slideshare
 
Apache Harmony: An Open Innovation
Apache Harmony: An Open InnovationApache Harmony: An Open Innovation
Apache Harmony: An Open InnovationTim Ellison
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Ryan Cuprak
 
Florian adler minute project
Florian adler   minute projectFlorian adler   minute project
Florian adler minute projectDmitry Buzdin
 
Open Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMOpen Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMTom Lee
 

Mais procurados (19)

Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Erjang - A journey into Erlang-land
Erjang - A journey into Erlang-landErjang - A journey into Erlang-land
Erjang - A journey into Erlang-land
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
 
Jvm performance tuning
Jvm performance tuningJvm performance tuning
Jvm performance tuning
 
How to train the jdt dragon
How to train the jdt dragonHow to train the jdt dragon
How to train the jdt dragon
 
Invokedynamic in 45 Minutes
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 Minutes
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -
 
Ruby Plugins for Jenkins
Ruby Plugins for JenkinsRuby Plugins for Jenkins
Ruby Plugins for Jenkins
 
Java Performance Monitoring & Tuning
Java Performance Monitoring & TuningJava Performance Monitoring & Tuning
Java Performance Monitoring & Tuning
 
Introduction to java by priti sajja
Introduction to java by priti sajjaIntroduction to java by priti sajja
Introduction to java by priti sajja
 
Java J2EE Training in Chennai, Tambaram
Java J2EE  Training in Chennai, TambaramJava J2EE  Training in Chennai, Tambaram
Java J2EE Training in Chennai, Tambaram
 
JDK7: Improved support for dynamic languages
JDK7: Improved support for dynamic languagesJDK7: Improved support for dynamic languages
JDK7: Improved support for dynamic languages
 
6010 java programming version 6
6010 java programming version 66010 java programming version 6
6010 java programming version 6
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 
Apache Harmony: An Open Innovation
Apache Harmony: An Open InnovationApache Harmony: An Open Innovation
Apache Harmony: An Open Innovation
 
Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]Top 50 java ee 7 best practices [con5669]
Top 50 java ee 7 best practices [con5669]
 
Florian adler minute project
Florian adler   minute projectFlorian adler   minute project
Florian adler minute project
 
Open Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVMOpen Source Compiler Construction for the JVM
Open Source Compiler Construction for the JVM
 

Semelhante a 5장. Execution Engine

Bytecode Manipulation with a Java Agent and Byte Buddy
Bytecode Manipulation with a Java Agent and Byte BuddyBytecode Manipulation with a Java Agent and Byte Buddy
Bytecode Manipulation with a Java Agent and Byte BuddyKoichi Sakata
 
Eclipse Day India 2015 - Java bytecode analysis and JIT
Eclipse Day India 2015 - Java bytecode analysis and JITEclipse Day India 2015 - Java bytecode analysis and JIT
Eclipse Day India 2015 - Java bytecode analysis and JITEclipse Day India
 
Spring framework
Spring frameworkSpring framework
Spring frameworkAircon Chen
 
Code lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzCode lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzIvan Krylov
 
What is new and cool j2se & java
What is new and cool j2se & javaWhat is new and cool j2se & java
What is new and cool j2se & javaEugene Bogaart
 
Fundamentals of java --- version 2
Fundamentals of java --- version 2Fundamentals of java --- version 2
Fundamentals of java --- version 2Uday Sharma
 
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)OpenBlend society
 
How the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java CodeHow the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java CodeJim Gough
 
A Better Python for the JVM
A Better Python for the JVMA Better Python for the JVM
A Better Python for the JVMTobias Lindaaker
 
Invoke dynamic your api to hotspot
Invoke dynamic your api to hotspotInvoke dynamic your api to hotspot
Invoke dynamic your api to hotspotBoundary
 
Lifecycle of a JIT compiled code
Lifecycle of a JIT compiled codeLifecycle of a JIT compiled code
Lifecycle of a JIT compiled codeJ On The Beach
 
JRuby - Programmer's Best Friend on JVM
JRuby - Programmer's Best Friend on JVMJRuby - Programmer's Best Friend on JVM
JRuby - Programmer's Best Friend on JVMRaimonds Simanovskis
 
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...Stefan Marr
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJoseph Kuo
 
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, UkraineVladimir Ivanov
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript EngineKris Mok
 

Semelhante a 5장. Execution Engine (20)

Bytecode Manipulation with a Java Agent and Byte Buddy
Bytecode Manipulation with a Java Agent and Byte BuddyBytecode Manipulation with a Java Agent and Byte Buddy
Bytecode Manipulation with a Java Agent and Byte Buddy
 
Eclipse Day India 2015 - Java bytecode analysis and JIT
Eclipse Day India 2015 - Java bytecode analysis and JITEclipse Day India 2015 - Java bytecode analysis and JIT
Eclipse Day India 2015 - Java bytecode analysis and JIT
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Code lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzCode lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf Linz
 
What is new and cool j2se & java
What is new and cool j2se & javaWhat is new and cool j2se & java
What is new and cool j2se & java
 
Fundamentals of java --- version 2
Fundamentals of java --- version 2Fundamentals of java --- version 2
Fundamentals of java --- version 2
 
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
Byteman and The Jokre, Sanne Grinovero (JBoss by RedHat)
 
Java introduction
Java introductionJava introduction
Java introduction
 
How the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java CodeHow the HotSpot and Graal JVMs execute Java Code
How the HotSpot and Graal JVMs execute Java Code
 
A Better Python for the JVM
A Better Python for the JVMA Better Python for the JVM
A Better Python for the JVM
 
Invoke dynamic your api to hotspot
Invoke dynamic your api to hotspotInvoke dynamic your api to hotspot
Invoke dynamic your api to hotspot
 
Lifecycle of a JIT compiled code
Lifecycle of a JIT compiled codeLifecycle of a JIT compiled code
Lifecycle of a JIT compiled code
 
JAVA BYTE CODE
JAVA BYTE CODEJAVA BYTE CODE
JAVA BYTE CODE
 
JRuby - Programmer's Best Friend on JVM
JRuby - Programmer's Best Friend on JVMJRuby - Programmer's Best Friend on JVM
JRuby - Programmer's Best Friend on JVM
 
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
Metaprogramming, Metaobject Protocols, Gradual Type Checks: Optimizing the "U...
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of Java
 
Understanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual MachineUnderstanding the Dalvik Virtual Machine
Understanding the Dalvik Virtual Machine
 
Functional java 8
Functional java 8Functional java 8
Functional java 8
 
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
"JIT compiler overview" @ JEEConf 2013, Kiev, Ukraine
 
Implementing a JavaScript Engine
Implementing a JavaScript EngineImplementing a JavaScript Engine
Implementing a JavaScript Engine
 

Último

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 

Último (20)

Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 

5장. Execution Engine

  • 1. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Execution Engine
  • 2. Java Performance 2 artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Execution Engine 1) Execution Engine 2) Interpreter 3) JIT Compiler 4) Execution Engine IBM JIT Compiler 1) JIT Compiler 2) Mixed Mode Interpreter 3) JIT Compiler Optimization 4) JIT Compiler Hotspot Compiler 1) Hotspot Compiler 2) Hotspot Compiler Optimization 3) Hotspot Compiler Option
  • 3. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Execution Engine
  • 4. Java Performance 4 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • Execution Engine Bytecode Runtime Module • Instruction – Bytecode = Instruction – Execution Engine Instruction • Instruction = Opcode + Operand • Execution Engine opcode fetch opcode fetch
  • 5. Java Performance 5 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • Instruction – Bytecode method level • Method return Exception – Instruction • opcode opcode • Goto return opcode • Exception catch opcode
  • 6. Java Performance 6 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine – Bytecode mnemonic >javap –c classfile (bytecode) Java Source Code Method offset Instruction Mnemonic Operand
  • 7. Java Performance 7 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • JVM (Source: Sun Microsystems) http://java.sun.com/developer/technicalArticles/Networking/HotSpot/
  • 8. Execution Engine Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 8 • Execution Engine – Bytecode Runtime Module Java Source Classfile .java .class Javac .java JVM Runtime Interpreting Execution Bytecode Data Area Engine Stream ClassLoader
  • 9. Java Performance 9 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • Execution Engine – Bytecode Interpreting – Interpreting • Interpreter • JIT Compile
  • 10. Java Performance 10 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • Interpreter – Bytecode compile – Bytecode – Bytecode – – JVM Bytecode interpreter
  • 11. Java Performance 11 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • JIT(Just-in-time) Compiler – Bytecode native code – Native code compile – Native Code Cache – Interpreter – Lazy fashion
  • 12. Java Performance 12 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • JIT(Just-in-time) Compiler bytecode Class a{ Heap Method Table a.f1(); f1() a.f3(); ptr f1() f3() } f2() Object A f3() JIT f1() native f4() code f3() …
  • 13. Java Performance 13 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • JIT(Just-in-time) Compiler Source code bytecode Native code int a; iload_0 ld [$fp-0] , $r0 st $r0, [$sp+0] int b; iload_1 ld [$fp-4] , $r1 st $r1, [$sp+4] int c = a + b; iadd ld [$sp+0] , $r0 ld [$sp+0] , $r1 add $r0, $r1, $r2 st $r2, [$sp+0]
  • 14. Java Performance 14 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • Execution Engine – Loop bytecode
  • 15. Java Performance 15 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • Execution Engine – • Java • Array_ptr Stack A[0][0] Object_ptr A[0] Object_ptr A[0][1] length A[1] length A[1][0] Class_ptr Class_ptr A[1][1] Object_ptr Heap Class_ptr length Method Area Class runtime type Class runtime type info Method block Method block
  • 16. Java Performance 16 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Execution Engine • Execution Engine – •2 5 • Dimension
  • 17. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker IBM JIT Compiler 17
  • 18. Java Performance 18 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • JIT Compiler – JIT compiler method (1) Method Method table JIT compiler (2) JIT Compiler Method Native Code Cache (3) Method (4) Method table Native Code Code – JVM Method Call
  • 19. Java Performance 19 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • JIT Compiler Java Application Java VM(Interpreter) bytecode JIT compiler native code
  • 20. Java Performance 20 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • JIT Compiler – JIT Enable • JVM Startup Applet – JIT Disable • JVM Bytecode interpret – IBM JVM Mixed Mode Interpreter(MMI)
  • 21. Java Performance 21 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Mixed Mode Interpreter(MMI) – 1.4 – JVM Runtime – Fast Assembler bytecode interpreter – JIT – Method count threshold compile – Low-usage method compile compile
  • 22. Java Performance 22 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Mixed Mode Interpreter(MMI) – 1.4.2 JIT, MMI JVM – JIT shared library(libjitc.so) – Java5 JIT JVM component MMI – Java5 MMI
  • 23. Java Performance 23 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Mixed Mode Interpreter(MMI) Java Application Java VM(Interpreter) bytecode JIT compiler MMI native code threshold
  • 24. Java Performance 24 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Mixed Mode Interpreter(MMI) – • Method call compile • count • Count Compilation Threshold compile • Compile count 0 • Count • JIT Recompile Threshold compile Optimization recompile • method
  • 25. Java Performance 25 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Mixed Mode Interpreter(MMI) – JIT/MMI Mode MODE JIT MMI Effect •JVM , default ON ON •Method Interpret JIT Compile • IBM_MIXED_MODE_THRESHOLD=0 MMI ON OFF Disable • Method JIT Compile •JVM •-Xint • -Djava.compiler=NONE JIT • JAVA_COMPILER=NONE OFF OFF Disable • Interpret JVM Runtime •JIT compile MMI
  • 26. Java Performance 26 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Mixed Mode Interpreter(MMI) – MMI Threshold • IBM_MIXED_MODE_THRESHOLD=<x>[,<y>] • <x> interpret – method – Default OS 500 1000 • <y> compile seed – compile method – y x Threshold – default 0
  • 27. Java Performance 27 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • JIT Compiler Optimization
  • 28. Java Performance 28 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Optimization Level – Optimization – -Xjit – JVM Adaptive noOpt cold Warm hot veryHot scorching
  • 29. Java Performance 29 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Optimization Level – Adaptive compilation • Methods interpret interpreted •N ‘warm’ level compile warm • Sampling thread hot methods hot • Methods ‘hot’ ‘scorching’ recompile profiling • Temporary profiling step ‘scorching’ scorching
  • 30. Java Performance 30 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Optimization Phase (~1.4.2) – 1.4.2 4 • Bytecode Optimization : bytecode – Flow analysis – Static method inlining – Virtual method inlining – Idiomatic translation – Field privatization – Stack and register analysis – bytecode quad native code – conventional native compiler
  • 31. Java Performance 31 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Optimization Phase(~1.4.2) • Quad Optimization – Control flow optimization – Data flow optimization – Escape analysis – Loop analysis – Data flow analysis – Quad Optimization • DAG(Direct Acyclic Graph) Optimization – Induction analysis – Loop Versioning – Loop Striding – Induction removal – Dead storage analysis
  • 32. Java Performance 32 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Optimization Phase(~1.4.2) • Native code Generation – Bytecode Quad Quad DAG Native Code
  • 33. Java Performance 33 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Optimization Phase (Java5~) – Java5 5 phase – Bytecode Method tree Native Code – Compile code cache
  • 34. Java Performance 34 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com IBM JIT Compiler • Optimization Phase (Java5~) • Inlining – caller inlining – Trivial inlining – Call graph inlining – Tail recursion elimination – Virtual call guard optimization
  • 35. IBM JIT Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 35 • Optimization Phase (Java5~) • Local optimization – – Local data flow analysis and optimizations – Register usage optimization – Simplification of Java Idioms • Control flow optimizations – Method control flow – Code reordering, splitting and removal – Loop reduction and inversion – Loop Striding and loop-invariant code motion – Loop unrolling and peeling – Loop versioning and specialization – Exception-directed optimization - Switch analysis
  • 36. IBM JIT Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 36 • Optimization Phase (Java5~) • Global Optimization – method – Expensive – Global data flow analysis and optimizations – Partial redundancy elimination – Escape analysis – GC and memory allocation optimizations – Synchronization optimization • Native code generation – Method tree machine code – Platform
  • 37. IBM JIT Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 37 • JIT Compiler – • IBM_MIXED_MODE_THRESHOLD • JITC_COMPILEOPT – NMMI2JIT : hot Method compile – NINLINING : Inline code – NQOPTIMIZE : Quad – NDOPT : DAG – NBCOPT : Bytecode – NALL : Optimization – Java5
  • 38. IBM JIT Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 38 • JIT Compiler – JVM Parameter • -Xint : interpret only • -Xjit[:<parameter>=<value>,…] – count=<n> : compile , n=0 method compile – limitFile=(<Filename>,<m>,<n>) : m n compile – optlevel=[noOpt | cold | warm | hot | veryHot | scorching] : Method Optimization level – Verbose : JIT Compiler method compile
  • 39. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker • Class Sharing JVM1
  • 40. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker • Class Sharing JVM1
  • 41. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker • Class Sharing Cached Classes JVM1
  • 42. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker • Class Sharing Cached Classes JVM2
  • 43. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker • Class Sharing Cached Classes JVM2 JVM3 JVM4
  • 44. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker • Class Sharing Cached Classes Cached Classes JVM2 JVM3 JVM4
  • 45. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker • Class Sharing Shared Cache 1 Shared Cache 2 AOT Code AOT Code Cached Classes Cached Classes JVM2 JVM3 JVM4
  • 46. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker -Xscminaot AOT Code -Xscmaxaot -Xscmaxaot AOT Code -Xscmx Shared Classes Metadata
  • 47. Java Performance artdb@ex-em.com | performeister.tistory.com | twitter @novathinker Hotspot Compiler
  • 48. Java Performance 42 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Hotspot Compiler • Hotspot Compiler – Mixed Mode system • Interpreter JIT Compiler • Bytecode interpreted • Profiling Dynamic Compile • recompile interpreted Interpreted Recompile Profiling Interpreted Again Dynamic Compilation
  • 49. Java Performance 43 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Hotspot Compiler • Hotspot Compiler – Mixed Mode system • Hotspot Default • Hotspot – Profiling Hot Code compile – Compile – Hot code Optimization – Compile
  • 50. Java Performance 44 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Hotspot Compiler • Hotspot Compiler – Hotspot VM – Client Server – Compiler Java Hotspot Server VM Java Hotspot Performance Engine Java Hotspot Client VM
  • 51. Java Performance 45 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com Hotspot Compiler • Hotspot Compiler – Server VM • Advanced Adaptive Compiler – Client VM • Compile Client Server C1 Compiler C2 Compiler Runtime Runtime
  • 52. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 46 • Hotspot Compiler – Client Compiler • C1 Compiler • Optimization • Value Numbering, inlining, class analysis • Static Compile • Profiling Counting Value Numbering
  • 53. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 47 • Hotspot Compiler – Server Compiler • Opto C2 Compiler • High optimizing bytecode compiler • ‘Intermediate’ optimizing compiler • Interpreter Profiling Optimization • Inlining – CHA Profiling Data Inline Decision • Loop Optimization • Loop Unrolling
  • 54. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com48 • Hotspot Compiler Optimization – Server Compiler • Common Sub-expression Elimination – tmp = b * c; a = b * c + g; a = tmp + g; d = b * c * d; CSE d = tmp * d; e = b * c; e = tmp; • Loop unrolling – Loop array[0] = 0; for (int i; i < 3; i++) array[i] = i; Loop Unrolling array[1] = 1; array[2] = 2;
  • 55. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 49 • Hotspot Compiler Optimization – Server Compiler • On Stack Replacement – Loop Interpreted code Compiled code • Main method 1 • Main loop • 10000 compile • main interpreting • 14000 OSR • loop Compile code
  • 56. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 50 • Hotspot Compiler Optimization – Server Compiler • array-bounds check elimination – Array range check – Array Index , • Dead Code Elimination – code compile
  • 57. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 51 • Hotspot Compiler Optimization – Server Compiler • Code Hoisting – (hoist) Hoisting • Data Flow Analysis – Data • Deoptimization – Hotspot – Compile Interpret
  • 58. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 52 • Hotspot Compiler Option • -Xint : Interpret Mode • -XX:+AggressiveOpts (+ Java5 update 6) : Compile Optimization • -XX:CompileThreshold=<value> : compile (Client 1500, Server 10000) • -Xcomp : code
  • 59. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 53 • Hotspot Compiler Option • -Xbatch : background compilation Method compile background process • -XX:+AlwaysCompileLoopMethods : Default false Loop method Compile • -XX:+BackgroundCompilation : background JIT Compile enable compile interpreted code
  • 60. Hotspot Compiler Java Performance Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com 54 • Hotspot Compiler Option • -XX:CICompilerCount=<value> : Maximum concurrent compile Thread • -XX:+Cltime : JIT Compiler Print • -XX:+PrintCompilation : Method Compile
  • 61. Java Performance 55 Java Performance Fundamental | twitter @novathinker artdb@ex-em.com | performeister.tistory.com