On Thu, Jan 21, 2010 at 3:14 PM, Collin Winter <collinwin...@google.com> wrote:
>> P.S. Is there any chance of LLVM doing something like tracing JITs?
>> Those seem somewhat more promising to me (even though I understand
>> they're quite hard in the face of Python features like stack frames).
>
> Yes, you could implement a tracing JIT with LLVM. We chose a
> function-at-a-time JIT because it would a) be an easy-to-implement
> baseline to measure future improvement, and b) create much of the
> infrastructure for a future tracing JIT. Implementing a tracing JIT
> that crosses the C/Python boundary would be interesting.

I was thinking about this recently.  I think it would be a good 3
month project for someone.

Basically, we could turn off feedback recording until we decide to
start a trace at a loop header, at which point we switch to recording
everything, and compile the trace into a single stream of IR with a
bunch of guards and side exits.  The side exits could be indirect tail
calls to either a side exit handler, or a freshly compiled trace
starting at the opcode where the side exit occurred.  The default
handler would switch back to the interpreter, record the trace, kick
off compilation, and patch the indirect tail call target.

The only limitation with that approach is that you would have to do
extra work to propagate conditions like passed guards across the call
boundary, since we currently try to throw away as much LLVM IR as
possible after compilation to save memory.

So yes, I think it would be possible to implement a tracing JIT in the
future.  If people are really interested in that, I think the best way
to get there is to land unladen in py3k as described in the PEP and do
more perf work like this there and in branches on python.org, where it
can be supported by the wider Python developer community.

Reid
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to