lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

 > Yes, up to version 5.3. (Version 5.4 created several different opcodes,
 > mainly to avoid the tests you mentioned in item 1.)  

Hmmm.  Did that change add much complexity to the compiler?  In
particular, the logic in the compiler that has to fall back on a
multi-instruction sequence when the number of constants is large?

 > In the last point, it should be noted that Lua reuses constants, so
 > if the assignment `n = n + 1` is compiled after the compiler has
 > seen a large number of constants, but 1 was one of those previous
 > constants, the compiler reuses that 1 and therefore codes the
 > operation in a single opcode.

Ah, thanks for that!