compiling to python byte codes

"Martin v. Löwis" martin at v.loewis.de
Sun Sep 5 19:39:36 EDT 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? It seems 
> wierd to me that if stack-based machines (physical processors or VMs) 
> are so good, why hadn't the processor engineering caught up?

Stack-based microprocessors would be very inefficient. If you don't
have registers, every operation will need to access the stack, which
is an access to main memory, which is expensive. The counter-argument
of interpreters against registers (difficult to decode opcodes, long
opcodes) does not hold for microprocessors, as they can decode the
instruction in parallel with doing other things (which an interpreter
couldn't).

For interpreters, the same rationale does not hold - even registers
would live in main memory, so there would be no performance gained.

Virtual machines are quite different from real machines, in many
respects.

Regards,
Martin



More information about the Python-list mailing list