Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A historical thing:

> Traditionally, most virtual machines intended for actual execution are stack based, a trend that started with Pascal’s P-machine and continues today with Java’s JVM and Microsoft’s .Net environment. Currently, however, there has been a growing interest in register-based virtual machines (for instance, the planned new virtual machine for Perl 6 (Parrot) will be register based). As far as we know, the virtual machine of Lua 5.0 is the first register-based virtual machine to have a wide use.

The API directly reflected the (previous) internals of the VM, I guess [1].

[1] (pdf) https://www.lua.org/doc/jucs05.pdf



The new register-based virtual machine still uses the same stack under the hood. The only difference is how instructions are encoded in the bytecode. By default they can read and write to any position in the stack as opposed to pushing and popping from the top. The Lua stack API already does some of this, because several operations take stack indices as arguments.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: