I think imitating the irregularities of the X86 instruction set is an incorrect decision. I think your virtual machine should idealize an x86 architecture stripped of the legacy of its past. The reason x86 is so popular is that it is backward compatible to a frightening degree. You don't need this for Mu, and can presume as many registers, and memory to memory, and bitshift instructions that X86 didn't implement. Yes one has to admit that it might well end up looking a lot like the National chip instead of the intel chip, but Prof. Wirth wrote the code generator for one of his compilers for the Intel, Motorola 68k and National chips, and found that the National chip had the smallest code generator, motorola 2nd place, and Intel way larger. Of course in terms of commercial success they came out in opposite order to their regularity. Although the race is not always to the swiftest, we shouldn't immortalize ugly designs. Just don't copy the PowerPC which must have had 100 branch instructions because they had space left over and made probably the worst assembly language ever devised.
02/02/2020, 2:47 AM
all processors are optimized for x86 instructions. If you’re not going to build hardware, it is as low as you should get, and Mu goes there. You could build higher-lever abstractions on top of that (and Mu does), but the point is not to have any unpiercable opaque layer.