I had a quick look at the recent commits to Lua
(https://github.com/lua/lua), and was curious to see the presence of
specialized bytecodes for certain types of table access operations.
Also noted the ADDI instruction (although not sure the benefit of this
in the absence of static type information). I would be interested to
know if any performance tests have been done to measure improvements
resulting from these specialized bytecodes.
Anyway, I was wondering if there are any plans to modify the Lua
bytecode structure to adopt the LuaJIT style - which only supports one
constant operand. By doing this, there are some benefits:
a) It allows the bytecode to be 8 bits rather than 6 - without
compromising the other components (as far I understand - please
correct me if I am wrong). Enabling a larger size for bytecode enables
more type specialized bytecodes to be added to the vocabulary. (I have
to look at doing this for Ravi anyway so that I can make Ravi
compatible with some of the Lua limits).
b) The byecode decoding becomes slightly simpler and maybe faster.
The downside of course is that operations that previously could be
handled by a single instruction (where both operands are constants) -
would now need a register access.