On Thu, 17 Jul 2003, Leopold Toetsch wrote:
>   PC = ((op_func_t*) (*PC)) (PC, INTERP); // prederef functions
>
> To be able to switch function tables, this then should become:
>
>   PC = ((op_func_t*) (func_table + *PC)) (PC, INTERP);
>
> Thus predereferncing the function pointer would place an offset into the
> function table, not an absolute address.
>
> Or is there a better way to do it?

Replacing the next instruction with a branch to the signal handler
(like adding a breakpoint) out of the question?  Of course, if we're
sharing bytecode this is expensive, since you'd have to do something
like this:

        bsr handler
        ...
handler:
        if cur_thread == thread_with_signal goto real_handler
        # replaced instruction
        ret

which penalizes all other bytecode users.  I guess it depends how
common we expect signal handling to be.

/s

Reply via email to