[pypy-dev] Question on the future of RPython

Paolo Giarrusso p.giarrusso at gmail.com
Fri Oct 1 00:11:17 CEST 2010


On Thu, Sep 30, 2010 at 13:01, Armin Rigo <arigo at tunes.org> wrote:
> Hi Paolo,

> On Thu, Sep 30, 2010 at 8:33 AM, Paolo Giarrusso <p.giarrusso at gmail.com> wrote:
>> My proposal, here, would be a "virtual guard", (...)

> Yes, this proposal makes sense.  It's an optimization that is
> definitely done in regular JITs, and we have a "to-do" task about it
> in http://codespeak.net/svn/pypy/extradoc/planning/jit.txt (where they
> are called "out-of-line guards").

I see - but while I know of what for instance Java does (I had an
example), here one can reuse JITted traces (up to some point) rather
than just throw everything out (except maybe profiling data), add the
new code path and redo all optimizations when recompiling it. I don't
see how a method-at-a-time JITs could reuse more than that, and my
class notes just state that code can be thrown out.

My proposal is that here, also the recorded traces could be reused (if
they are stored or can be recovered), exactly because one just adds a
different code path and tracing JITs reason in terms of single paths.
Ideally, the same trace could be recompiled (this time with a guard)
the next time it is entered, without using the trace-recording
interpreter, nor waiting again that it is executed N times with N >
compileThreshold. Potentially, in a trace-stitching JIT like PyPy, one
could even just prepend a guard to the compiled assembly/binary code
(if that's position-independent, like x86-64, or can be relocated).

Of course, all of this is dependent on the representation used for the
"code/trace caches", because I'm not sure all needed data is kept -
and this shouldn't increase too much storage requirements, especially
given that invalidations might not be very frequent.

So, do you have pointers in the code? Do you prefer me to ask by chat?
I just checked out sources on my new dev machine (lack of disk space
was one reason why I never did it).
Is the History class in pypy/jit/metainterp/history.py what represents
a trace? Grepping for "trace" in that folder didn't help a lot.

BTW, I am not used to bother authors by asking questions when reading
sources; but as far as I saw, it is considered "socially acceptable"
here, isn't it?

Best regards
-- 
Paolo Giarrusso - Ph.D. Student
http://www.informatik.uni-marburg.de/~pgiarrusso/



More information about the Pypy-dev mailing list