Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:

24
Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper: A Brief History of Just-In-Time (2003) John Aycock

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 Presentation

Transcript of Just-In-Time Compilation Keith W. Krajewski 3/4/2011 paper:

Page 1: Just-In-Time Compilation Keith W.  Krajewski 3/4/2011 paper:

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:

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:

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:

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:

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:

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:

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:

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:

APL

Phillip S. Abrams, 1970 Drag-along Beating

Page 10: Just-In-Time Compilation Keith W.  Krajewski 3/4/2011 paper:

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:

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:

Smalltalk

Lazy compilation to native code No pagination of compiled code

Page 13: Just-In-Time Compilation Keith W.  Krajewski 3/4/2011 paper:

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:

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:

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:

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:

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:

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:

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:

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:

Classifying JIT

3 properties Invocation – explicit/implicit Executability – monoexecutable/polyexecutable Concurrency

Page 22: Just-In-Time Compilation Keith W.  Krajewski 3/4/2011 paper:

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:

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:

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