4 ms·
To my understanding, stack-based VMs are more common than register-based VMs, and the Lua VM is noteworthy for being both well-implemented and small enough to r
by silentbicycle 18y ago
To my understanding, stack-based VMs are more common than register-based VMs, and the Lua VM is noteworthy for being both well-implemented and small enough to read. Then again, it looks like you're quite a bit ahead of me in reading about VMs. I just found this in your "blog thing" yesterday: http://www.bentwookie.org/blog/kragen-tol/2007-September/000871.html http://www.bentwookie.org/blog/kragen-tol/2007-September/000... You've got a lot of good links. :)
By "table optimizations", I meant the way it behaves as both a dict and a table, depending on how it is used, and how much they get out of using those throughout the language. (I wrote the above in a hurry before catching the bus, and knew I had missed better examples, but it came to mind from the _Implementation_ paper.)
- kragen 18y agoYes, I agree that stack-based VMs are more common than register-based VMs, and it was an unusual decision on the part of the Lua folks to choose a register-based VM, particularly given their emphasis on implementation simplicity. And it appears to have paid off, which is pretty cool! I'm glad you've enjoyed the various links. I meant the way it behaves as both a dict and a table You mean, a dict and an array? I'm not sure I agree with their decision to unify those structures, but it does seem not to have cost them much implementation complexity or performance.
- silentbicycle 18y agoOops. Dict and an array, yes. Also, Lua had a stack-based VM until Lua 5.0.