Group Members
Mohammad Shahriar Reza 011 132 065 Samrin Ahmed Riya 011 142 021
• 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
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
JIT Compiler
• Also known as ‘Dynamic Translation’.• A method to improve the runtime performance
of computer programs based on byte code (virtual machine code).
Structure of 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.
Relies on JIT
• Microsoft's .NET Framework.• Most implementations of Java.
Reason: For high-speed code execution.
Time space trade off (JIT)
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.
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
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
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
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
Functioning of JIT (Contd..)
ByteCode Execution
1 2
34
Interpretation Profiling
Dynamic Compilation
Deoptimization
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.
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.
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
Questions
Top Related