[MLton-devel] datatype variant tag optimization

Stephen Weeks MLton@mlton.org
Fri, 15 Nov 2002 17:51:50 -0800


> I read Xavier's comment and was a bit worried about the fact that they steal
> some bits from the size.

There are two ways we could do it.  As a reminder, the "type index"
field in the object header currently has 19 bits, limiting us to 2^19
different object types.  We only use about 100 in a self-compile, and
so there are a lot to spare.

1. We could steal a few bits from the type index
2. We could store it in the object type

The advantage of 1 is fast access, but limitations on the number of
variants and further limitations on the number of object types.

The advantage of 2 is no additional limitations.  It just costs us
extra memory references at runtime to get the variant tag from the
object type table.

I would go with 2 at first, guessing that the runtime cost is more
than offset by the space win.  But I could imagine a hybrid approach
working if the cost is too high.


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel