* Re: Legacy CPU emulators
[not found] ` <34B8E81A.8B0C17A9@compuserve.com>
@ 1998-01-11 5:00 ` John Bayko
0 siblings, 0 replies; only message in thread
From: John Bayko @ 1998-01-11 5:00 UTC (permalink / raw)
In article <34B8E81A.8B0C17A9@compuserve.com>,
Ed Dana II <EDanaII@compuserve.com> wrote:
[...]
>I assume that these emulators operate by taking the original machine co
>de and translating it to native
>machine code. This makes it a machine code interpreter. Is it possible
>for such a legacy emulator to
>compile this code rather than interpret it?
>
>It would be nice, naturally, not only to have your legacy applications,
> but to have it operating at
>speeds comparable to your current CPU.
>
>I assume that this has not been done, and for practical reasons.
It is done, just not very widely. There are two strategies for
this, called just-in-time (JIT) recompiling and binary translation.
Apple's PowerPC emulation of the 68040 uses JIT to translate
segments of 68040 code to PowerPC code as it encounters it. The payoff
to doing this is in loops, where a block of code is executed over and
over. I believe that DEC also has a product to do this so you can run
x86 binaries on an Alpha under NT.
Some Java Virtual Machines also do this, translating Java Bytecode
to the native instruction set.
The IBM AS/400 uses binary translation, I believe. Programs
written for an abstract machine are translated to the native CPU when
they are run for the first time, and saved for future use. This
allowed IBM to switch AS/400 systems to PowerPC CPUs without any
compatibility problems, and increased performance. DEC also used
binary translation to convert old VAX VMS programs to OpenVMS on Alpha
CPUs.
The factors which make binary translation easy are a well defined
and behaved operating system and programs. Programs which modify their
own code, such as earlier DOS and Macintosh programs, can't be
translated. Operating systems which have hidden or unreliable APIs or
functionality like Windows are hard.
If you're wondering about the Amiga, it has badly behaved programs
which would probably make this hard. Emulation would be more
reliable.
--
John Bayko (Tau).
bayko@cs.uregina.ca
http://www.cs.uregina.ca/~bayko
^ permalink raw reply [flat|nested] only message in thread