jit compiler

21

Upload: united-international-university

Post on 23-Jan-2018

282 views

Category:

Engineering


3 download

TRANSCRIPT

Page 1: JIT Compiler
Page 2: JIT Compiler

Group Members

Mohammad Shahriar Reza 011 132 065 Samrin Ahmed Riya 011 142 021

Page 3: JIT Compiler

• What is Compiler• Introduction to JUST IN TIME COMPILERS• Basis for JIT• Relies on JIT• Time space trade off (JIT)• Functioning of JIT• Classification of JUST IN TIME COMPILERS• Conclusion• References

CONTENTS

Page 4: JIT Compiler

COMPILER

Page 5: JIT Compiler

• A program that changes source code (high-level language) to object code which that can be executed by a machine.

• Compiler:o Checks syntax of programo Checks at a time all the program

• Primary reason for compiling source code is to create an executable program

• Examples of compiler based language:• C, C++, JAVA

Page 6: JIT Compiler

JIT Compiler

• Also known as ‘Dynamic Translation’.• A method to improve the runtime performance

of computer programs based on byte code (virtual machine code).

Page 7: JIT Compiler

Structure of JIT Compiler

Page 8: JIT Compiler

Basis for JIT

• Stores the program as byte code.• Runs the code segment preoperatively compiled to physical

machine code in order to run faster.• Represents a hybrid approach translation occurring continuously,

as with interpreters.• Handles late-bound data types and the ability to enforce security

guarantees.• Converts code at runtime prior to executing it natively.

Page 9: JIT Compiler

Relies on JIT

• Microsoft's .NET Framework.• Most implementations of Java.

Reason: For high-speed code execution.

Page 10: JIT Compiler

Time space trade off (JIT)

Page 11: JIT Compiler

Functioning of JIT

Dynamic Compilation:• Can do non-conservative optimizations in dynamic• Separates optimization from product delivery cycle• – Update JVM, run the same application, realize

improved performance!• – Can be "tuned" to the target platform.

Page 12: JIT Compiler

Functioning of JIT (Contd..)• Knows about

– loaded classes, methods the program has executed• Makes optimization decisions based on code paths executed

– Code generation depends on what is observed:

-loaded classes, code paths executed, branches taken

• May re-optimize if assumption was wrong, or alternative code paths taken.

– Instruction path length may change between invocations of methods as a result of de-optimization

/ re-compilation

Page 13: JIT Compiler

Functioning of JIT (Contd..)

JVM: Makes Bytecodes Fast

• JVMs eventually JIT bytecodes

– To make them fast

– compiled when needed

- Maybe immediately before execution or when we decide it’s important

– Some JITs are high quality optimizing compilers

Page 14: JIT Compiler

Functioning of JIT (Contd..)

JVM: Makes Bytecodes Fast

• JIT'ing requires Profiling

– Because you don't want to JIT everything• Profiling allows focused code-gen• Profiling allows better code-gen

– Inline what’s hot

– Loop unrolling, range-check elimination, etc

– Branch prediction, spill-code-gen, scheduling

Page 15: JIT Compiler

Functioning of JIT (Contd..)

Dynamic Compilation (JIT)

• Is dynamic compilation overhead essential?

– The longer your application runs, the less the overhead

• Trading off compilation time, not application time

– Steal some cycles very early in execution

– Done automagically and transparently to application• Most of “perceived” overhead is compiler waiting for more data

– ...thus running semi-optimal code for time being

Overhead

Page 16: JIT Compiler

Functioning of JIT (Contd..)

ByteCode Execution

1 2

34

Interpretation Profiling

Dynamic Compilation

Deoptimization

Page 17: JIT Compiler

Classification features of JUST IN TIME COMPILERS

• JIT systems can be classified according to three properties:

1. Invocation

-Explicitly invoked the user must take some action to cause compilation at runtime. An implicitly invoked JIT compiler is transparent to the user.

2. Executability

-Performs optimization on the fly on one of the source languages namely ‘JITsystemmonoexecutable’ or ‘polyexecutable’.

3. Concurrency

-operates to execute the program concurrently; in a separate thread or process, even on a different processor.

Page 18: JIT Compiler

Conclusion

• A traditional compiler that compiles all the code to machine language before the program is first run.

• An access to dynamic runtime information.• Actually a feature of the runtime interpreter.• Ideally the efficiency of running object code will

overcome the inefficiency of recompiling the program every time it runs.

Page 19: JIT Compiler

References

•  http://www.theserverside.com/definition/just-in-time-compiler-JIT

• https://www.slideshare.net/ZeroTurnaround/vladimir-ivanovjvmjitcompilationoverview-24613146

• http://stackoverflow.com/questions/95635/what-does-a-just-in-time-jit-compiler-do

• https://en.wikipedia.org/wiki/Just-in-time_compilation

Page 20: JIT Compiler

Questions

Page 21: JIT Compiler