Well, a computer scientist named Cathy May at IBM Research did this for the
S370 / Power PC architecture pair back in the mid-1980s. The work was
novel to me at the time ... she and her long-term partner were close
friends of mine, so I heard about her work over shared dinners across
several years.
The basic technique was to load pages of 360 machine code unmodified into
Power PC memory, marking the pages as dirty. If the machine branched into
one of these pages the VM trap handler would take the page and translate
all of its code from 370 instructions to Power PC instructions. Once that
was done the branch, suitably recalculated, was reinstated.
It turned out to be remarkably easy to do the translation. And in practice
the resulting Power PC code was only about 10% bigger than the original 370
code. AND, since tons of code is never touched (corner cases on corner
cases) the result is quite efficient.
I don't know if IBM ever built a product based on her research, but it
seemed remarkably clever to me.
Marc
=====
nygeek.net
mindthegapdialogs.com/home <https://www.mindthegapdialogs.com/home>
On Tue, Jul 9, 2024 at 10:37 PM John Levine <johnl(a)taugh.com> wrote:
It appears that Douglas McIlroy
<douglas.mcilroy(a)dartmouth.edu> said:
> portable implementation language by
'compiling' the
> high-level CISC VAX instructions (and addressing modes)
> into sequences of RISC instructions.
This idea, emulating one machine on another by translating strings of
instructions (basic blocks in compiler-ese) is quite old. I don't know
who did it first, and would be interested to hear if anyone knows,
although I expect it was reinvented multiple times.
It used to be harder because programs would store into the instruction
stream but these days code is all read-only it's quite standard. I'm
typing this on my M1 Macbook using an editor that thinks it's running
on an x86.
R's,
John