arrays
Stephen Weeks
MLton@sourcelight.com
Thu, 4 Jan 2001 09:26:32 -0800 (PST)
> re the array flattening transformation, I assume that nothing can currently
> be done in the case that the array elements are values of some datatype which
> has actual unions with 2 or more cases being `large'.
> I.e., consider
> datatype t = A of int
> | B of real
> Note that space-wise, the optimal storage is 9 bytes per element (one byte
> tag, with 4 bytes of junk if the tag is A). If you have to go indirect for
> the value being carried, then it costs a lot (although if there is a lot of
> sharing of reals it could save some space).
> Any way, the point is that I don't think that there is a way to express this
> chunk of memory large enough to hold the largest case with a tag that tells you
> which it is.
Datatype representations are decided after CPS optimization is complete, so
although this isn't done right now, it wouldn't be nearly as big a deal as
changing the CPS IL. All that needs to be changed is a new kind of TyconRep.t
needs to be added to backend/machine/representation and the backend needs to be
tweaked somewhat.