Karlos wrote:
@neuron
Unlike emulation of alien CPUs. such a 680x0->Coldfire JIT mechanism could be optimised in such a fashion as to leave big chunks of 680x0 code that is 100% coldfire compatible alone and avoid processing it.
However, when you consider HP's Dynamo it even begins to make sense to process it all. They get speed increases for code as a result of cacheing a linear sequence of instructions that represent a path through a complex set of conditions or a loop (its even more surprising when you consider dynamo is actually an interpreter 99% of the time and JIT converts hotspot areas only).
I've often wondered if such a JIT also makes sense on 68040/60 for running code that uses missing instructions emulated by the respective 680x0.library. Oxypatcher etc. is almost like this, but IIRC it patches the unimplemented instructions with a jump to code to emulate the instruction. Not as efficient as a genuine JIT, but much less work too. Its another alternative for running full 680x0 code on coldfire (maybe motorola's software does this ?).
You are probably more familier with JIT than I am, but I have been reading up about them. Yes I want that $10 bounty for AROS 68k emulator :lol:
They seem to work by scanning the code up to the first branch (conditional or otherwise), then translating the code it's just scaned into the native code and locating it as a block of code somewhere in the RAM.
In the case of a Coldfire->68K emu that would not need to change too much of the code.
Then it executes the translated block of code whch will jump to a point in the original code. This causes an exception which can be trapped, If the code jumps to a block of code that has been translated the pointer is updated to point to the translated code, if not, the JIT then scans this code until the next branch and translates it to Native code (as done before). This code block is then located somewhere in ram.
This procedure is repeated during the execution of the program, after some time most of the code has been translated and executes at full speed, ie the blocks of code only ever get get trasnlated once.
If someone has any better explaination, I'd love to hear it!