[pypy-dev] JVM backend - status and future work possibilities?

Antonio Cuni anto.cuni at gmail.com
Sat May 21 12:22:23 CEST 2011


On 16/05/11 17:10, Bo Chen wrote:
> Anto,

Hello Bo,
(I've CCed pypy-dev again, please click "reply all" to make sure the list is
included)

> Is there any advice on reading the source code of the pypy?

that's a hard question, it depends what is your goal. My experience is that if
you have a clear goal and start by writing a failing test, then it's easier to
follow what's going on in that particular case.

Personally, I love to put pdb.set_trace() here and there to watch the
execution of the code in the pieces I'm interested in.

> And here is my question, the JVM backend is to invoke java classes in pypy or
> translate the python binary to java binary, or both?

The JVM backend translates RPython source code into JVM bytecode (actually, it
generates a textual form of the JVM bytecode, which is then assembled by jasmin).

Currently, you cannot create/call Java entities from RPython code, but as I
explained in the earlier emails, this is a prerequisite feature before doing
the rest of the work.

> There is a prototype use JPype, is this mean the JVM backend turn the java
> binary code into the python's.

no. JPype allows to call Java code from CPython, but there is no translation
of java into python involved.

Note that JPype would be used only for tests, and not for the actual
translation.  This is because the RPython code can be either run on top of
cpython (for testing) or translated to jvm code.  JPype (or equivalent) is
needed for the first case

For the second case, JPype does not play any role.  What it's needed is to
teach the RPython toolchain how to deal with Java classes.  Remind that the
JVM backend already emits JVM bytecode, so it's "enough" to teach the RPython
toolchain to transform e.g. "rjvm.System.out.println" into the corresponding
invokestatic bytecode.

> And only the JIT complier will transfer the python to java.

no JIT is involved at this point.  I think it's better to keep the JIT out of
this particular discussion, to avoid confusion.

> And the Point(1) would be not only just use the JPype, but also need
> implement totally?

see my explanation above, hoping that it answer your question.

ciao,
Anto


More information about the pypy-dev mailing list