On Thu, Nov 14, 2002 at 04:28:00PM +0100, Leopold Toetsch wrote: > The question is "without knowing". I think the resume address is known > (somewhere at least) because the exception handler has to be set up.
If I understand it correctly, the way recent Linux handles page faulting in the kernel may be of use. It takes advantage of the ELF format to generate an list of fixup routines, one per place that could fault, ordered by the fault address. If the instruction at that address faults, the code called by the MMU searches the list, to find the correct fixup code. The fixup code is run, and execution resumes. This makes fixup slower than inline explicit check code, but fixup happens so rarely that the removal of lots of instances of explicit check code is a net win. I wonder if we could use the same idea in the JIT, with out of band exception fixup code (or tables, or whatever) that the JIT exception handler uses to restart. I'm making the assumption that exceptions can happen in many places, but rarely do, so we can ill afford to make the direct code slower to cope with them, and that it doesn't matter if it takes a lot of effort to handle them when they happen. Nicholas Clark -- perl1 better than perl? http://www.perl.org/advocacy/spoofathon/