[MLton] x86_64 port status

Matthew Fluet fluet@cs.cornell.edu
Wed, 10 May 2006 23:06:27 -0400 (EDT)


>> I ask again: Union with what?
>
> One type with the same alignment and size as every type used
> to manipulate a PointerAux. There is a finite and fixed number
> of such types (basic C integers, floats, and void*).

Nothing every 'manipulates' a PointerAux.  It's just a proxy for the 
"universal" type of ML objects on the ML heap.  There are not a finite 
and fixed number of such types.

> If everything aligns at 1, then PointerAux will too.

But we don't want it to align at 1.  And, if the machine aligns floats at 
8, then via your suggestion above, it will align at 8.

> I'm having to guess you need this scenario: a pointer pointing
> at a PointerAux interior to some other object, or, on the
> machine stack.

No, never.  'PointerAux's don't exit.  And ML objects are never interior 
to other ML objects.

> And you want to steal some low n=2 bits of the pointer
> for another purpose, so what it points at must be
> 4 byte aligned. yes?

Not entirely.  We will use the low bit to represent particular datatypes. 
For example:
   datatype t = A of int array | B | C
will be represented as either an (ML) pointer (with low order bits 00) for 
the A variant or as a word (using the same number of bits as an ML 
pointer) with 0x01 for the B variant and 0x11 for the C variant.  The low 
order bit suffices to distinguish pointer from non-pointer.

So, for efficient datatype representations, we need at least 2-byte 
alignment.  In practice, machines seem happier with 4-byte alignment, so 
we minimally align at 4-bytes.