[pypy-dev] Next step: gen???.py

Samuele Pedroni pedronis at strakt.com
Thu Mar 31 14:07:43 CEST 2005

Armin Rigo wrote:

>* genjava.py could be another option.  It has a simpler type system, which
>matches ours quite well, but genjava doesn't exist yet at all (the one in the
>java/ subdirectory had a different goal in mind).  We get memory management
>for free.  If we add the requirement to compile with GCJ it could be easy to
>make a CPython extension module too, with the same problems and solutions
>about SomeObject as above.
We would get gc, thread support, a runtime and useful libraries 
(unicode, big integers ...), and an object model for free. How much of 
that and with what stability if we go through gcj is a bit open, 
although for the target of self-hosting that would be the interesting 
route. Java has no gotos wich means that at some point we would have to 
generate bytecode wich is not too
hard but sometimes making the java verifier happy is harder than it 
could seem. The type system should match but there are no pointer to 
functions or delegates wich means some more involved solution to emulate 
them. We could probably reuse some things or ideas that are in Jython.

Whether the things we would get for free and the type system and basic 
object model are really a good match for the code we can easily generate 
is also a open question.

So it probably makes sense as a platform to try long term, and surely 
when we have made even more progress in annotating our codebase. Also 
because reusing java or jython stuff instead of trying to interface with 
CPython is probably easier because of ref-counting vs gc issues.

But is worth keeping it in mind as a reserve route, because its 
trade-offs come together with quite a bit of high level functionality 
already there.

But I agree that genc especially with an approach involving 
incrementally rewriting the graphs is the most natural route right now.


More information about the Pypy-dev mailing list