From: Gwenole B. <gb...@di...> - 2004-05-20 05:27:03
|
Hi, I have committed a few arrangements to make the JIT generated code somewhat reentrant. i.e. this means it is now possible to recursively generate and invoke compiled code. The reasoning was as follows: 1) NanoKernel interrupts could already run in a nested context from main execution loop. This is because we could run the interrupt only when we exited from a generated block. So, no problem for this one. 2) For nested Execute68k() compilation and invokation, that's trickier. Imagine we have the following scenario: ppc execution (toplevel loop) -> Execute68k (1) -> Execute68k (2). If Execute68k (2) were to invalidate the translation cache and possibly overwrite code from Execute68k (1) or toplevel loop return point, you are dead. The trick was to handle EmulOps on trampoline code that is not part of the real translation cache. That way, even if cache is invalidated, we could still run the continuation code at EmlOp return. In summary, this is a *massive* performance improvement for applications that cause a lot of Execute68k(). e.g. audio related applications like PlayerPRO, where we end up to around 45% of time spent in Execute68k(). It's completely unusable without this optimization. BTW, if you try PlayerPRO with current CVS code, it won't work, it needs a special workaround to avoid nested NanoKernel interrupt routine call. I still don't know why this would happen. It's not a problem in native mode because the whole CPU context is preserved. I could do the same with the emulator, but I still think this should not happen. Bye, Gwenole. |