[MLton] 64-bit pointers

Matthew Fluet fluet@cs.cornell.edu
Sun, 4 Sep 2005 17:31:36 -0400 (EDT)


> I was thinking about porting MLton to a 64-bit machine (just thoughts,
> no code!) and considered the following schemes for representing
> pointers and mapping them to virtual memory addresses.
>
> A. 32 bits, with bottom two bits zero.
> B. 32 bits, with bottom bit zero, shift left by one.
> C. 32 bits, with bottom bit zero, shift left by two.
> D. 32 bits, shift left by two.
> E. 32 bits, shift left by three.
> F. 40 bits.
> G. 64 bits.
>
> These schemes vary in the number of bits to represent a pointer in an
> object, the time to load a pointer from memory into a register, the
> amount of addressable memory, and the object alignment.
>
> 	bits	time	mem(G)	align
> A	32	fast	  4	4
> B	32	slow	  8	4
> C	32	slow	 16	8
> D	32	slow	 16	4
> E	32	slow	 32	8
> F	40	slow	256	4
> G	64	fast	 4G	8
>
> Each of the (A-F) has a variant (A1-F1) in which pointers are added to
> some constant base address.  This gives access to any region in the
> virtual address space instead of just the low addresses.

Why is the object alignment in scheme G necessarily 8 and not 4?