wlavrij...@lbl.gov, 10.07.2012 20:37: > 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).
Ok, then in the case of a callback, the runtime could simply start with totally stupid code that packs the low-level arguments into Python arguments, attaches the low-level type information to them and then passes them into the function. The JIT should then see in its trace what types originally came in and optimise the argument packing away, shouldn't it? Stefan _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev