Jason Gloudon wrote:
On Tue, Nov 12, 2002 at 04:03:35PM +0100, Leopold Toetsch wrote:
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.
Yes, this was my first intention, how to implement this beast. But I know very little aboit i386 asm, so I took the more simple approach.
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.
Sounds reasonable, though a restart op like trace_i does the same, get out of JIT and return to the runops loop.
But anyway, jumping directly to the PC in Parrot_jit_begin is the way to go.
leo