compiling to python byte codes
greg at cosc.canterbury.ac.nz
Mon Sep 6 04:44:33 CEST 2004
Maurice LING wrote:
> Probably my question should be phrased as, given what x86/PPC processors
> are register-based (even after more than a decade from the publication
> of the book "Stack Machines - the new wave") and there isn't much
> examples of stack-based processors, why is there a difference?
If you're implementing a machine in hardware, access to
registers is much faster than access to memory. Since the
current trend in hardware design seems to be "as fast as
possible, whatever it takes", today's architectures are
But with an interpreter, things are very different. The
"registers" of the VM probably aren't going to be real
registers, but memory locations. Even if you do manage to
keep them in real registers, the time spent accessing them
is going to be small compared to the time spent fetching
instructions, decoding them and figuring out what operands
they refer to, so the speed advantage would be quite minimal.
Given that, and the fact that stack architectures are much
easier to generate code for, it's not surprising that most
VMs tend to have stack architectures.
More information about the Python-list