News for hackers. Stuff that matters.
Re:DynASM by zde on Saturday December 03, 2016 @02:51PM (#13097221)
Not sure what you talk about.. lua5.3 stores 64bit integers in the same tagged union it stored doubles so the value size didn't grow at all. 64bit ints only need a new tag value (which was available before).
Re:DynASM by pygy_ on Saturday December 03, 2016 @03:27PM (#13097361)
IIRC, Lua 5.2 uses NaN tagging as LuaJIT does, and has 64bits values.
Re:DynASM by zde on Saturday December 03, 2016 @04:43PM (#13097656)
All Lua5.x versions use 8-byte union plus 1-byte tag, that's 12-byte TValue (16-byte on 64bit targets).

(somewhat off topic) Mike authored a cunning patch to un-box short strings, sadly it got never mainlined. http://lua-users.org/wiki/FastStringPatch

Re:DynASM by pygy_ on Saturday December 03, 2016 @05:53PM (#13097889)
Edit, yes, v5.2 supports the NaN trick (see the comments above http://www.lua.org/source/5.2/lobject.h.html#NNMARK), but only on x86.

I suppose the Lua authors wanted to avoid the memory limitations of LuaJIT on 64bits machines.

---- Original below:

I thought v5.2 used NaN tagging but I may be wrong. At least the beta versions did. I misremembered that post to refer to the final version: http://lua-users.org/lists/lua-l/2011-07/msg00180.html

Quoted in full:

----

Lua 5.2 beta implements the "NaN trick": it packs all Lua values into a single double value by representing non-numeric values as signaled NaNs, which are (usually) not produced by the system.

This trick should work on most 32-bit machines that follow IEEE 754-2008 for double representation. However, currently it is being enabled only by predefined macro __i386__ (and similars). We would like to know what other platforms could benefit from this trick (and what macros should we check in luaconf.h). You can force the trick by compiling Lua with -DLUA_NANTRICKLE (for little endian systems) or -DLUA_NANTRICKBE (for big endian).

(Of course, we would also like to know whether there are problems with this implementation.)

-- Roberto

----

I also think I remember people (maybe Mike Pall) reporting perf regressions between 5.2 and 5.3 because of the cache bloat introduced by mandatory 128bits values (on 64bits systems).

Re:DynASM by zde on Sunday December 04, 2016 @12:25PM (#13100733)
Thanks, my bad. I didn't know they tried it in 5.2.