Anto,<div><br></div><div>Thanks for your patient. I will read the code of RPython first.</div><div><br></div><div>Bo Chen</div><div><br><div class="gmail_quote">On Sat, May 21, 2011 at 6:22 PM, Antonio Cuni <span dir="ltr">&lt;<a href="mailto:anto.cuni@gmail.com">anto.cuni@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On 16/05/11 17:10, Bo Chen wrote:<br>
&gt; Anto,<br>
<br>
Hello Bo,<br>
(I&#39;ve CCed pypy-dev again, please click &quot;reply all&quot; to make sure the list is<br>
included)<br>
<div class="im"><br>
&gt; Is there any advice on reading the source code of the pypy?<br>
<br>
</div>that&#39;s a hard question, it depends what is your goal. My experience is that if<br>
you have a clear goal and start by writing a failing test, then it&#39;s easier to<br>
follow what&#39;s going on in that particular case.<br>
<br>
Personally, I love to put pdb.set_trace() here and there to watch the<br>
execution of the code in the pieces I&#39;m interested in.<br>
<div class="im"><br>
&gt; And here is my question, the JVM backend is to invoke java classes in pypy or<br>
&gt; translate the python binary to java binary, or both?<br>
<br>
</div>The JVM backend translates RPython source code into JVM bytecode (actually, it<br>
generates a textual form of the JVM bytecode, which is then assembled by jasmin).<br>
<br>
Currently, you cannot create/call Java entities from RPython code, but as I<br>
explained in the earlier emails, this is a prerequisite feature before doing<br>
the rest of the work.<br>
<div class="im"><br>
&gt; There is a prototype use JPype, is this mean the JVM backend turn the java<br>
&gt; binary code into the python&#39;s.<br>
<br>
</div>no. JPype allows to call Java code from CPython, but there is no translation<br>
of java into python involved.<br>
<br>
Note that JPype would be used only for tests, and not for the actual<br>
translation.  This is because the RPython code can be either run on top of<br>
cpython (for testing) or translated to jvm code.  JPype (or equivalent) is<br>
needed for the first case<br>
<br>
For the second case, JPype does not play any role.  What it&#39;s needed is to<br>
teach the RPython toolchain how to deal with Java classes.  Remind that the<br>
JVM backend already emits JVM bytecode, so it&#39;s &quot;enough&quot; to teach the RPython<br>
toolchain to transform e.g. &quot;rjvm.System.out.println&quot; into the corresponding<br>
invokestatic bytecode.<br>
<div class="im"><br>
&gt; And only the JIT complier will transfer the python to java.<br>
<br>
</div>no JIT is involved at this point.  I think it&#39;s better to keep the JIT out of<br>
this particular discussion, to avoid confusion.<br>
<div class="im"><br>
&gt; And the Point(1) would be not only just use the JPype, but also need<br>
&gt; implement totally?<br>
<br>
</div>see my explanation above, hoping that it answer your question.<br>
<br>
ciao,<br>
Anto<br>
</blockquote></div><br></div>