[MLton] Constant folding vector expressions

Matthew Fluet fluet at tti-c.org
Mon Sep 17 08:07:00 PDT 2007


On Mon, 17 Sep 2007, Vesa Karvonen wrote:
> Is there some reason why vector expressions are not subject to
> constant folding?

> The probably incorrect part is "WordSize.cint ()".  The code shouldn't
> use the size of cint (C-integers), but the size of SML integers,
> Int.int, but I couldn't see where to find the correct size.

You want "WordSize.seqIndex ()", the size of sequence (i.e., array and 
vector) indices (and lengths).  The size of SML integers ("Int.int") is 
just a front-end fiction -- none of the primitives, Basis Library 
C-functions, or middle/back-end phases care about the default SML types. 
The Basis Library implementation takes care of converting between Int.int 
and the underlying representation of sequence indices.  (For 32-bit 
platforms, sequence indices are 32-bits; for 64-bit platforms, sequence 
indices are 64-bits.)



More information about the MLton mailing list