[pypy-dev] The JVM backend and Jython

Antonio Cuni anto.cuni at gmail.com
Wed Mar 30 09:18:57 CEST 2011

Hi Frank,

On 30/03/11 04:40, fwierzbicki at gmail.com wrote:
> Hi all,
> It was nice meeting up with many of you at PyCon!
> I've been thinking about the first steps towards collaboration between
> the Jython project and the PyPy project. It looks like it isn't going
> to be too long before we are all (CPython, PyPy, IronPython, Jython,
> etc) working on a single shared repository for all of our standard
> library .py code. In my ideal world there would come a day when there
> is also no standalone Java code in the Jython project: that is the
> shared standard library would contain all of Jython's .py files, and
> all of the Java would be generated from PyPy and Jython as a
> standalone project would disappear. It is possible that this is too
> ambitious, but big goals are more fun, right? In reality even if this
> where to get going, I imagine it would be a 10+ year plan :)

wow, that's definitely a nice (and big) plan :-)

> So to my question - just how broken is the JVM backend? Are there
> workarounds that would allow the Java code to get generated? 

"not much broken".
Last time I tried, the only broken thing was "virtualrefs", which is something
needed for the jit, but that at the moment is not supported at all by ootype
and thus it blocks the translation.

However, I think that fixing it is probably very easy: there is a branch for
this which was started by Ademan:

Dan, do you plan to finish the work on it? Else, I can just do it probably.

> I ask
> because I would like to evaluate the generated Java parser as a
> potential replacement for our current ANTLR based parser. It seems
> like a nice baby step towards real collaboration since it seems like a
> relatively easy place to start. Clearly it would need adjustments to
> actually work for Jython - but I'd be able to look into that part. I
> don't think I have the time to try to unbreak the translation
> though...

I have to warn you that at the moment, you cannot invoke any Java code from
RPython.  Implementing it has been on my todo list for years now :-(, but I
never managed to find the time and the motivation to do it.  However, for
using the PyPy parser inside Jython it should be enough to do the other way
around, i.e. call RPython code from Java, which should be possible.


More information about the Pypy-dev mailing list