Gregor N. Purdy <[EMAIL PROTECTED]> wrote: > Benjamin -- > #define DO_OP(PC,INTERP) \ > (PC = ((INTERP->op_func_table)[*PC])(PC,INTERP))
> The easiest way to intercept this flow with minimal cost is to > have the mechanism that wants to take over replace the interpreter's > op_func_table with a block of pointers to some Parrot_hijack() > function that conforms to the opfunc prototype. Enqueueing an > event would set the appropriate interpreter's op_func_table to > hijack_op_func_table. > On Fri, 2003-07-11 at 16:07, Benjamin Goldberg wrote: >> >> I would suggest that every flow control op check for events. Or maybe >> just every control flow op that goes to earlier instructions. >> >> And of course ops which might block for IO. Combining these ideas should work. The CG cores don't have a func_table of op functions but a table of labels. This could be switched too, pointing to different labels with op bodys that check the event queue. Its still problematic to do this kind of func_table switching in the JIT core. For best performance the branch opcodes are JITted, so they can't be switched like other run cores func_tables. OTOH the performance penalty of checking the event queue is only high for very small tight loops, like that in the mops.pasm. leo