[pypy-dev] pypy for typed languages?

Armin Rigo arigo at tunes.org
Fri Mar 13 12:13:02 CET 2009

Hi Geoffrey,

On Thu, Mar 12, 2009 at 08:57:21PM -0400, Geoffrey Irving wrote:
> I've come to the conclusion that JIT compilation is essential to avoid
> abstract penalties even for typed languages.

Indeed: our approach to JIT compilation was first tried with machine
code (see Dynamo/DynamoRio) and then with Java.

> Thus, I'm curious about whether pypy could be practically applied to a
> typed front end language, say with the following basic set of
> features:

I suppose you can try.  For a direct application you need a language for
which it makes sense to write an interpreter in RPython.

> In particular, what restrictions does pypy impose on storage layout?
> For example, would it be able to handle dynamically-typed homogeneous
> lists, represented as a single pointer to a type object and an array
> of structs required to be of that type?

RPython doesn't have support for this.  If you go directly to the lltype
type system, then it's possible -- but our current JIT generator doesn't
support it.  And also, if you write an interpreter using the lltype type
system directly, you loose the abstraction level of writing an
interpreter in RPython in the first place -- e.g. it would not be
translatable any more to the ootype type system, thus to Java or CLI.

So all in all, PyPy could probably be subverted to do what you want, but
it's not really meant to (and we are a bit unlikely to give much
support, as far as I can see).

> Also, if pypy can target LLVM, how do you imagine the two JIT systems
> cooperating (if at all)?

That's a longer-term goal, but I can easily imagine that the code
produced by our JIT could be sent to LLVM at runtime for further

A bientot,


More information about the Pypy-dev mailing list