On Sat, Jun 08, 2002 at 02:34:19PM -0400, Dan Sugalski wrote: > Indirect function calls will take maybe 50 cycles, so I'm not worried > about their time. Compared to perl 5, that's fast.
With a JIT compiler, this starts to be significant, though. > >A continuation can be invoked just like any other function. The first > >opcode of its body can then switch the stack frames. (The register do > >not need to be switched if we specify that callcc does not preserve > >them.) > > The thing with continuations is that the code we're invoking won't > know its a continuation. That information's kept as metadata in the > sub PMC. Why? A continuation is captured by a "callcc" opcode. So, we can require this intruction to be always followed by a "execcc" intruction that perform the context switch. If the continuation is invoked, it will execute the "execc" intruction and switch to the right context. If "callcc" simply returns, it can just skip the "execcc" instruction. > (And we do need to restore the registers, otherwise we're > going to see a lot of stack pushing and popping every time we take a > continuation, and I don't know that it's worth it) I still don't understand this. "callcc" performs a function call, so why should it preserve registers? -- Jerome