[pypy-dev] C interpreter written in Python, and running CPython on top of PyPy

Timothy Baldridge tbaldridge at gmail.com
Fri Jan 6 17:46:05 CET 2012


On Fri, Jan 6, 2012 at 10:27 AM, Celil <celil.kj at gmail.com> wrote:
> So if I understand correctly, the flow graph is simply there to help deduce
> low level types for the high level python objects so that rpython can be
> translated into C, and they play no role in the interpreter?

Correct. When pypy loads .py modules, it compiles and interprets them
as normal python bytecode. Then as bytecode is run, the JIT starts
profiling the code and creating machine code versions of the bytecode
instructions. This is a rather nice feature, that I am taking
advantage of in my clojure-on-pypy implementation:
https://github.com/halgari/clojure-py

In my implementation of Clojure we compile the clojure code to pure
python bytecode, then let the JIT do its work. According to the JIT,
this code is no different than a normal bytecode program.

All that to say, the pypy jit doesn't look at python ASTs, it runs
directly off the bytecode contents of functions.

Timothy


More information about the pypy-dev mailing list