Hi Stefan,

On Tue, 10 Jul 2012, Stefan Behnel wrote:
wlavrij...@lbl.gov, 10.07.2012 20:10:
that completely depends on how it is generated, of course, and in the context
of calls within Python (pypy-c), it makes sense to have the entry point of
the function expect wrapped arguments, and have the exit point re-wrap.
There's no reason you can't have multiple entry points to the same code.
Cython has been doing this for a while, and I'm sure PyPy's JIT does it, too.

I'm not sure whether the PyPy JIT does that, as an entry point somewhere in the
middle of a compiled trace would bypass guards, and as said re-wrap at an exit
point is needed (not to mention if a guard fails half-way during the trace and
the code drops in the black hole).

But a JIT expert should provide the details of what's possible. :)

Right now, that delivery method is the act of unwrapping itself (that is,
the wrapped types carry the low-level info).
I have no idea what you mean, but you make it sound backwards for the case
of a callback.

See Anto's talk at EuroPython for a better explanation of what I'm saying (or
trying to say anyway):

   https://ep2012.europython.eu/conference/talks/pypy-jit-under-the-hood

The type information going into the traces comes from the type information
that the interpreter has. I.e. from the wrapped types. This isn't backwards
AFAICS, since a general Python function (callback or otherwise) can receive
any type (and of course, is allowed to fail by raising an exception if it
can't deal with the types). It's only once the trace has been generated,
that the types are fixed for the trace (with a fallback option, or course).

Now, retrofitting the callback mechanism on top of this, may very well be
backwards, which is why I think we all do agree that a better handshake is
needed. And if somebody could pretty please code that up for PyPy, so that
I can use it. :)

As-is, I could even live with CFFI funcptrs taking a wrapped tuple of args.
After all, wrapping is easy and fast at the interpreter level. However, the
JIT will be blind to it.

Best regards,
           Wim
--
wlavrij...@lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to