4 ms·
Efficient low-level VMs implemented in high-level languages
- speek 17y agoIt would be really nice if this person commented inside their code.
- silentbicycle 17y agoMost of the code consists of small functions such as let load_prog_platter a = !platters.(0) <- a; a for which comments would just get in the way. I don't know if you know OCaml, but that's roughly the same as plat load_prog_platter(plat a) { (*platters)[0] = a; return a; } I don't think commenting that should be necessary. He did comment one part, though: "(* we deliberately use Array.get to check bounds; use unsafe_ for speed *)". (The only big function, exec, is an Opcode -> Action table.)
- zandorg 17y agoI came up with a reasonable rule that to emulate a chipset/machine/computer, you need 10x the power of that machine. EG, a 1GHZ CPU could emulate a 100 MHZ Amiga.
- dexen 17y agoCan you back the claim up with any hard numbers? You may want to run Amiga (PPC) software in qemu on IA32. Thanks to some runtime binary translation, it should have suffer closer to 2-fold rather than 10-fold performance penalty, AFAIK. On related note, that'd imply we are getting only about 10% of our IA32 processors, basically RISCs cores emulating CISCs mostly via microcode. Which is hard to believe in, given that IA64 architecture (the Itanium, not the 64bit extensions to IA32) does not outperform IA32 10 times, even thou it doesn't have to execute legacy instructions and was created almost from scratch.
- zandorg 17y agoNo hard numbers, it's just that I barely got a Sinclair Spectrum emulator to run on a 10MHZ 286. A Spectrum is about 3 MHZ. I got an Atari ST (8MHZ 68000) emulator to just about run on an old 60MHZ (or so) 486. But it's possible I was getting something wrong: The overhead to deal with, say, an Amiga emulation, might be a fixed overhead, meaning it's 20 MHZ to convert instructions, so a 100MHZ machine would run an Amiga at 80MHZ.