lua-users home
lua-l archive

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


Excerpts from Philipp Janda's message of 2014-04-22 09:09:06 +0200:
> The latter used spare bits only, but you can have only 4 (5?) different 

Lua values are 128bit (2 longs) on 64bit archs, and 64bit (2 longs again) on 32bit archs.

The encoding could be made far more efficient given this budget - On 32bit - 19 bits in
total are available to lua to encode ttype. First few values could be reserved for internal
types, but rest of the 2^19 range is available. NaN tag consumes only 13 bits, and the remaining
32bits is pointer / integer. On 64 bit Lua, this would give 51 bits of tag space...

On LuaJIT though, things are tighter and only 32bit "half-pointers" could be reasonably implemented.
(conveniently, luajit exposes its low-4gb allocator so all the tools are in place..)