|
On Monday, August 19, 2002, at 09:58 AM, Roberto Ierusalimschy wrote:
I'm also just generically curious about this change. What led to it? What are the tradeoffs?In Lua 4.0 we already decided to use a whole 32-bit integer for each instruction, because of alignment problems with arguments inside bytecodes. But with 32-bit instructions and a stack machine, most istructions do not use most bits. Also, we know that copying values is a "slow" operation in Lua (because each value is a structure). Then, we decided to try this register-based architecture.
Are there any docs on this? How many registers are there and how many are the same after a return from a function call? Is there a return register? How does it deal with lua's multiple return values?
> Now it is difficult to estimate the real gains with that change, because
> there are many other changes too. But I would say that for "opcode > intensive" code (that is, code with few function calls and lots of > locals) the gain in performance is around 20%.Just curious - do you think this reflects the fact that the hw lua typically runs on is register based? Would you still expect a performance improvement if lua were running on stack-based hw(like some forth CPUs)?
Cheers, Steve