From http://code.google.com/p/unladen-swallow/wiki/ProjectPlan I quote:
"Using a JIT will also allow us to move Python from a stack-based machine to a register machine, which has been shown to improve performance in other similar languages (Ierusalimschy et al, 2005; Shi et al, 2005)."
In college I built a simple compiler for a language with recursive procedures - which maintained stack frames for each procedure called - so that they can be called recursively and so that parameters and return values would work....
2 things:
1) Am I right in thinking that what I implemented would be considered a "stack-based machine" given the terminology used in the quotation above?
2) If my assumption in point (1) was right, how does a "register machine" work? i.e. how is it different from a stack-based machine?
Thanks!
A register machine is a hardware or software unit that when working with data takes it from memory, puts it in a location where it can work with it quickly, and then returns the result.
For example a regular CPU is a register machine. Since the ALU (the unit that works with numbers in a CPU) can only work with numbers in a register.
A stack based machine adds the data onto a stack and then either pops or pushes stuff onto it.
For example, adding two numbers would be
When in a register machine it would be something like this.