[MLton] Win64 patches again

Matthew Fluet fluet at tti-c.org
Wed Feb 13 21:08:47 PST 2008


On Mon, 4 Feb 2008, Wesley W. Terpstra wrote:
> address-space.patch:
>
> On AMD64, not all 64 bits are actually accessible to userspace 
> applications. The CPU itself has a limit well below this, and win64 
> imposes further a limit of 43 bits. This would be academic except that 
> MLton carefully tries to position its heap by trying to map at 32 
> locations linearly across the address space. Since all of the attempted 
> address are larger than the maximum possible in 43 bits, this fails. On 
> linux the failure is not so important because mmap(0) succeeds. However, 
> this code has a purpose: to prevent fragmentation. In the distant future, 
> this might matter again.
>
> The attached patch fixes this by introducing POINTER_BITS and ADDRESS_BITS 
> (which is less than POINTER_BITS). POINTER_BITS is the number of bits in a 
> pointer, and ADDRESS_BITS is how many of those are actually useful as an 
> address. Also, checking the value of UINTPTR_MAX with UINT64_MAX is a 
> preprocessor friendly and portable way to configure POINTER_BITS (the old 
> code used a non-portable __WORDSIZE).

Committed, with some minor changes:
   http://mlton.org/cgi-bin/viewsvn.cgi?view=rev&rev=6401



More information about the MLton mailing list