News for hackers. Stuff that matters.
Re:The secret life of NaN by cryptonector on Thursday April 05, 2018 @06:09PM (#16769217)
The x86_64 address-space size is currently 49 bits. There are two 48-bit halves. It could get bigger eventually. So NaN-coding (or Nan boxing, or whatever you want to call it), is risky.

I remember Solaris had a problem because it would put anonymous mmap()s in one 48-bit range and the heap and stacks in the other range, and this broke some ECMAScript implementation that used NaN-coding with the assumption that all data would be in the top 48-bit address space.

Re:The secret life of NaN by jwilk on Thursday April 05, 2018 @07:54PM (#16769856)
No, there are two 47-bit halves. (But see my other comment about 57-bit address space.)
Re:The secret life of NaN by cryptonector on Thursday April 05, 2018 @10:10PM (#16770403)
Ay, sry.
Re:The secret life of NaN by apaprocki on Thursday April 05, 2018 @09:55PM (#16770338)
I had this issue on both Solaris/SPARC and AIX/POWER because both use the full 64-bit address space. It required jumping through hoops to make sure the custom allocator could both allocate 1MB aligned pages that were also < 48 bits so that it would play nice with SpiderMonkey.
Re:The secret life of NaN by akira2501 on Thursday April 05, 2018 @06:43PM (#16769443)
> There are two 48-bit halves. It could get bigger eventually.

Which is precisely why the implemented in that way, to prevent "clever" uses like this from eventually breaking on chipsets that define more address bits than the early default.

Re:The secret life of NaN by kccqzy on Friday April 06, 2018 @08:49AM (#16772777)
I believe the address space size has recently been expanded through 5-level paging. This is now supported in Linux since commit b1b6f83ac938d176742c85757960dec2cf10e468.