But there is. I'm not sure whether I've mentioned this, but LJ2
puts no limit (other than memory size) on the number of constant
keys/values of a table constructor.
The parser stores all constant key/value pairs into a lazily
allocated template table. It only emits store instructions for
variable keys or values. If a template table has been created,
it's put into the constant section. The table creation instruction
TNEW is then patched to the table duplication instruction TDUP.
Note that neither "x", "y", nor "foo" appear in the bytecode or
the constants, because they are only part of the template table.
Ah, before I forget: duplicating a large table of constants is of
course a lot faster than filling it by executing tons of bytecodes.