lua-users home
lua-l archive

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


----- Original Message -----
From: Mike Pall
Date: 9/11/2009 8:14 PM
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.
I run into the table size problem often enough to be annoying. Is it possible to apply your work in LJ2 as a standard Lua 5.1 patch?

Thanks!

Josh