FAQ

[Perl6-internals] stackless python

Chaim Frenkel
Oct 25, 2000 at 11:04 pm
"KF" == Ken Fox writes:
KF> Adam Turoff wrote:
when dealing with threaded bytecode is that the threading specifically
eliminates the indirection in the name of speed.
KF> Yes. Chaim was saying that for the functions that need indirection,
KF> they could use stubs. You don't need to guess in advance which ones
KF> need indirection because at run-time you can just copy the old code
KF> to a new location and *write over* the old location with a "fetch pointer
KF> and tail call" stub. All bytecode pointers stay the same -- they just
KF> point to the stub now. The only restriction on this technique is that
KF> the no sub body can be smaller than the indirection stub. (We could
KF> easily make a single bytecode op that does a symbol table lookup
KF> and tail call so I don't see any practical restrictions at all.)

We may not even need to copy the body. If the header of the function
is target location, the header could any one of
nop,
nest another inner loop
lookup current symbol
fixup caller
or jump to new target.

(Hmm, with Q::S, it could be all of them in constant time.)

<chaim>
--
Chaim Frenkel Nonlinear Knowledge, Inc.
chaimf@pobox.com +1-718-236-0183
reply

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions