just-in-time compilation keith w. krajewski 3/4/2011 paper:
DESCRIPTION
Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper: A Brief History of Just-In-Time (2003) John Aycock. Overview. What is JIT? Why know about JIT? Who has used JIT (and to what end)? Simulation JIT in modern languages Classifying JIT techniques Tools for JIT compilation. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/1.jpg)
Just-In-Time Compilation
Keith W. Krajewski3/4/2011
paper:A Brief History of Just-In-Time (2003)
John Aycock
![Page 2: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/2.jpg)
Overview
What is JIT? Why know about JIT? Who has used JIT (and to what end)? Simulation JIT in modern languages Classifying JIT techniques Tools for JIT compilation
![Page 3: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/3.jpg)
What is JIT?
Dynamic compilation “JIT” itself a new term to computing, ~1993 Theoretically unnecessary
![Page 4: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/4.jpg)
Goals of JIT
Compiled programs are faster Interpreted programs are smaller Interpreted programs are more portable Interpreter has access to runtime info
![Page 5: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/5.jpg)
Why know about JIT?
Because JIT is like the cure for scurvy.
![Page 6: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/6.jpg)
Who has used JIT (and how)?
Early sightings LC^2 APL mixed/throw-away
code Fortran Smalltalk Self
Oberon Erlang O'caml Modern stuff
![Page 7: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/7.jpg)
Ancient Runes
McCarthy, Lisp (1960), punch cards! Univ. of Michigan IBM 7060 (1966) Thompson, regular expressions (1968)
![Page 8: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/8.jpg)
LC^2
Language for conversational computing Mitchell, Perlis, & van Zoeren (1968) Mostly forgettable Cached the actions it performed
![Page 9: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/9.jpg)
APL
Phillip S. Abrams, 1970 Drag-along Beating
![Page 10: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/10.jpg)
Mixed & Throw-Away Code
Mixed – Dakin & Poole (1973) & Dawson (1973)
Throw-away – Basic
![Page 11: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/11.jpg)
Fortran
Hansen's 1974 optimization Frequency-of-execution counter Threshold levels Ordered set of machine-specific optimizations
![Page 12: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/12.jpg)
Smalltalk
Lazy compilation to native code No pagination of compiled code
![Page 13: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/13.jpg)
Self
David Ungar, Randall Smith, 1987 Pure OO, dynamically typed 3 generations
Customization (Pitfall: over-customization) Optimized type info for loops (Pitfall: compilation
time) Illusion of speed
Influenced Sun's later works (Java)
![Page 14: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/14.jpg)
Oberon
Niklaus Wirth, 1986 Compiled to “slim binary” Supported dynamic loading of modules Continuous re-optimization in background
![Page 15: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/15.jpg)
Erlang
Ericsson, 1986 HiPe – explicit invocation Mixed code, switch upon method invocation or
exception
![Page 16: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/16.jpg)
O'caml
Specialized the interpreter's instruction set to include “macro opcodes”
… without much benefit
![Page 17: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/17.jpg)
Simulation
1st gen – straight 1 by 1 translation 2nd gen – 1 by 1 translation with cache 3rd gen – blocks of source 4th gen
Profiled execution Hot path detection Code generation Bailout
![Page 18: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/18.jpg)
HP Dynamo
Compiled HPA-8000 code into HPA-8000 code ...amazingly, this worked. 30% performance
increase Important to be able to bail out
![Page 19: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/19.jpg)
Java
Static explicit compilation to JVM bytecode Early JVM did straight interpretation Motivation for JIT research Now very portable and relatively quick
![Page 20: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/20.jpg)
C#/.Net
Static compilation to CIL (MSIL), then bytecode Dynamic per-method compilation to native
machine
![Page 21: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/21.jpg)
Classifying JIT
3 properties Invocation – explicit/implicit Executability – monoexecutable/polyexecutable Concurrency
![Page 22: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/22.jpg)
Toolkits for JIT compilation
Keppel (1991), Engler & Proebsting (1994), Ramsey & Fernandez (1995), Engler (1996), Fraser & Proebsting (1999)
Address three main problems Binary code generation Cache coherence Execution
![Page 23: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/23.jpg)
Summary
Dynamic compilation Combines best features of both compiled and
interpreted programs Lazy compilation, incremental optimization,
mixed code, throw-away code, hotspot detection, machine-specific optimization, customization, simulation
Don't re-invent the wheel again
![Page 24: Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:](https://reader035.vdocument.in/reader035/viewer/2022081512/568163c7550346895dd4fa51/html5/thumbnails/24.jpg)
Works cited
Aycock, John. A Brief History Of Just-In-Time. 2003.
Petzold, Charles. .NET Book Zero. 2006.http://www.charlespetzold.com/dotnet/DotNetBookZero11.pdf
Wikipedia: Just-In-Time Compilation.http://en.wikipedia.org/wiki/JIT_compilation