3 ms·
As a hobbyist I agree that generating code for stack machines is much easier than for register machines. Because you get to ignore register allocation entirely!
by eatonphil 4y ago
As a hobbyist I agree that generating code for stack machines is much easier than for register machines. Because you get to ignore register allocation entirely! I hate register allocation (implementing it I mean).
But it's normally agreed to be less efficient. See Y Shi's 2005 paper Virtual Machine Showdown:
> We found that a register architecture requires an average
of 47% fewer executed VM instructions, and that the re-
sulting register code is 25% larger than the correpsonding
stack code. The increased cost of fetching more VM code
due to larger code size involves only 1.07% extra real ma-
chine loads per VM instruction eliminated. On a Pentium
4 machine, the register machine required 32.3% less time to
execute standard benchmarks if dispatch is performed using
a C switch statement. Even if more efficient threaded dis-
patch is available (which requires labels as first class values),
the reduction in running time is still around 26.5% for the
register architecture.
- LAC-Tech 4y agoIs that the paper where they pop twice for a 2 -- 1 operation?