[pypy-svn] r60587 - pypy/extradoc/talk/ecoop2009
antocuni at codespeak.net
antocuni at codespeak.net
Fri Dec 19 12:48:58 CET 2008
Author: antocuni
Date: Fri Dec 19 12:48:57 2008
New Revision: 60587
Added:
pypy/extradoc/talk/ecoop2009/jitstrategy.tex
Modified:
pypy/extradoc/talk/ecoop2009/main.tex
Log:
start of the "how the generated jit works" section
Added: pypy/extradoc/talk/ecoop2009/jitstrategy.tex
==============================================================================
--- (empty file)
+++ pypy/extradoc/talk/ecoop2009/jitstrategy.tex Fri Dec 19 12:48:57 2008
@@ -0,0 +1,36 @@
+\section{Effective JIT compilation of dynamic languages}
+
+Writing efficient compilers for dynamic languages is hard. Since these
+languages are dynamically typed, usually the compiler does not have enough
+information to produce efficient code, but instead it has to insert a lot of
+runtime checks to select the appropriate implementation for each operation.
+
+By generating code at runtime, JIT compilers can exploit some extra knowledge
+compared to traditional static compilers. However, we need to take special
+care to choose a strategy for JIT compilation that lets the compiler to take
+the best of this advantage.
+
+Most JIT compilers for dynamic languages around (such as IronPython, Jython,
+JRuby \anto{XXX insert some reference}) compile code at the method
+granularity. If on one hand they can exploit some of the knowledge gathered
+at runtime (e.g. the types of method parameters), on the other hand they can
+do little to optimize most of the operations inside, because their behaviour
+depends on informations that are not available at compile time, because
+e.g. the global state of the program can change at runtime. \anto{e.g., we can
+ add/remove methods to classes, etc. Should we insert some example here?}
+
+JIT compilers generated by PyPy solve this problem by delaying the compilation
+until they know all the informations needed to generate efficient code. If at
+some point the JIT compiler does not know about something it needs, it
+generates a callback into itself.
+
+Later, when the generated code is executed, the callback is hit and the JIT
+compiler is restarted again. At this point, the JIT knows exactly the state
+of the program and can exploit all this extra knowledge to generate highly
+efficient code. Finally, the old code is patched and linked to the newly
+generated code, so that the next time the JIT compiler will not be invoked
+again. As a result, \textbf{runtime and JIT-compile time are continuously
+ intermixed}. \anto{maybe we should put the translation/compile/run time
+ distinction here}
+
+XXX: insert an example of flexswitch
Modified: pypy/extradoc/talk/ecoop2009/main.tex
==============================================================================
--- pypy/extradoc/talk/ecoop2009/main.tex (original)
+++ pypy/extradoc/talk/ecoop2009/main.tex Fri Dec 19 12:48:57 2008
@@ -83,6 +83,7 @@
\input{abstract}
\input{intro}
\input{tlc}
+\input{jitstrategy}
\input{jitgen}
\input{rainbow}
\input{clibackend}
More information about the Pypy-commit
mailing list