9. Tracing JIT
Interpretation phase
Record actions, record branch conditions
Compiling trace
Actions compiled into branchless machine code
Guards added for conditions
If guard is broken – fall back to interpretation
10. Tracing JIT
Mozila’s TraceMonkey
1. IncrementalDynamicCodeGenerationwithTraceTrees
http://www.ics.uci.edu/~franz/Site/pubs-pdf/ICS-TR-06-16.pdf
PyPy
RPython – restrict python dialect compiling to C
Rpython based interpreter trace JITed by runtime
1. http://tratt.net/laurie/research/pubs/papers/bolz_tratt__the_impact_of_metatra
cing_on_vm_design_and_implementation.pdf
11. Tracing JIT
Limitation
Trace is EXPENSIVE
Falling out of path is EXPENSIVE
A lot of code is executed just once
– wasting resources on tracing
15. More JVM back magic
On stack replacement
Code for method could be replaced without
reentering to a method
Scalar replacement
Object not leaving method scope
can be reduced to a number of local variables