On Tue, Nov 12, 2002 at 04:03:35PM +0100, Leopold Toetsch wrote: > Some notes WRT implementation in i386: > The first code in JIT is emitted by Parrot_jit_begin, the last 5 bytes > of this code are 5 nop's now. > When JIT is called again with a pc != code_start, i.e. for restart at > pc, then a jump instruction to the native offset to this pc is patched > into the JIT code.
Instead of patching the code, we can pass pc to the native code and have the preamble jump to the corresponding native code address. This avoids the need to flush the instruction cache since we don't modify any code that the CPU has already executed. This works for now, but the way I was going to fix this was to call longjmp (through a wrapper function) from the native code in order to exit the native code and get back to the runops loop. Once multiple bytecode segments become a reality, this will be necessary as the native code will need to transfer control to an interpreter loop in order to execute code that has not been compiled. -- Jason