Amiga.org

The "Not Quite Amiga but still computer related category" => Alternative Operating Systems => Topic started by: TheMagicM on August 10, 2003, 12:38:27 AM

Title: What excatly is JIT emulation?
Post by: TheMagicM on August 10, 2003, 12:38:27 AM
Is it basically a way to speed up 68k code to run on the host machine? (take MOS 1.4 w/JIT or UAE w/JIT)..this isnt a way to emulate the custom chipset right?
Title: Re: What excatly is JIT emulation?
Post by: T_Bone on August 10, 2003, 12:41:23 AM
It's a special type of emulation, instead of emulating instruction-by-instruction, the code is pre-translated to native and then run, making it faster than one-by-one emulation.

Repetative tasks speed up considerably as the code only needs to be translated once, rather than emulated over and over

Something like that anyway :_P
Title: Re: What excatly is JIT emulation?
Post by: TheMagicM on August 10, 2003, 12:41:47 AM
thats what I thought.. thanks!!
Title: Re: What excatly is JIT emulation?
Post by: tonyw on August 10, 2003, 02:05:41 AM
As T-Bone said, it's translated just once and the resulting translated code is stored in memory until it's needed again (like for subsequent calls to the same function). So next time that function is called, it'll be much faster.

Comparing interpreted code with JIT, a JIT is usually about ten times as fast. Certainly in the Kaffe Java virtual machine, the JIT is ten times as fast as the interpreter. What would be good then would be to write the translated code out to a sharable Amiga-like library, so that it doesn't have to be translated again. I don't think any one does this yet.

tony


Title: Re: What excatly is JIT emulation?
Post by: Karlos on August 10, 2003, 02:20:50 AM
@tony

As far as I know, the problem with saving off code is down to the nature in which it is transcripted.

Transcription generally works on a block granularity even smaller than individual functions in many cases.

Many addresses etc. are present in the transcripted code that depend on the current machine state and would be meaningless were the code saved and reloaded later.

Even during a single session, transcripted code occasionally becomes stale (much like an instruction cache in a real processor) requiring re transcription. Things like patching functions etc will change code that may have been transcripted already and require transcriptig again.

For pure vm systems like Java, the above issues are virtually non existant - its pretty much possible to trasncript java code in a class once (while it loads usually) since it never uses absolute addresses for anything and never modifies its own code etc..

Unfortunatley, JIT emulations of real CPU's such as the 68K are considerably more complex.