[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Re: NaN packing for TValue
- From: Yura Sokolov <funny.falcon@...>
- Date: Thu, 24 Feb 2011 23:04:59 +0300
-10.01.-28163 22:59, Henk Boom пишет:
I spent a while trying to figure out how it would work on 64-bit
before I reread your email and saw that it was x86 only ;)
This makes me wonder, how does luajit do it on 64-bit? I can
understand that in terms of supply, much less than 64 bits is
sufficient, but how do you store pointers that happen not to lie in
the available range? mmap'd storage in particular gives back pointers
that are clearly uncontiguous with the rest of your allocated memory.
Well, x64 at the moment uses only 48 bits for addresses.
1bit for a sign + 11bits for mantis + 1bit for quiet NaN + 48 bits for
an address = 61bit
So that there is 3bits for tagging.
Currently Lua uses 13 different tag values, so that it would be tricky
to pack them into three bits :)
But possible in general. May be, one could use lower bits from aligned
Manipulating with them would not be so simple.
And I have no machine running in 64bit mode at the moment :(
For x86 I used another 16 free bits for speed and simplicity.
Sokolov Yura aka funny_falcon