3 ms·
> ...that comes with exactly 38 bytecodes and a total of 5 registers. The registers can't be used at the same time, because some of them are shared That's wron
by Rochus 5y ago
> ...that comes with exactly 38 bytecodes and a total of 5 registers. The registers can't be used at the same time, because some of them are shared
That's wrong. A, B, C are not registers, but sections in an instruction which reference registers. Registers are identified by an 8 bit number, so there are much more than five registers. See e.g. https://the-ravi-programming-language.readthedocs.io/en/latest/lua_bytecode_reference.html https://the-ravi-programming-language.readthedocs.io/en/late... or https://www.lua.org/doc/jucs05.pdf https://www.lua.org/doc/jucs05.pdf.
- Ferib 5y agoThe source you gave me refers to these A, B, C as 'registers'. Yes, you are correct that they are encoded inside the Lua instruction and can not be accessed globally. Will make it more obvious that these registers are part of the instruction itself as it may confuse people that are familiar with more traditional VMs.
- Rochus 5y ago> refers to these A, B, C as 'registers' No, A, B and C are called "instruction field", not "register". The registers are referenced in the text like e.g. "R(A)" meaning "the register signified by instruction field A". E.g. the instruction "MOVE A B" is described as "R(A) := R(B)". Each register carries a Lua value. The registers are not part of the instructions, but part of the activation record, which is allocated when Lua enters a function.