I think a better and simpler (and probably faster as well) solution would be to simply use an extra "tag word" for all constructors of the "large-tag type". It could even probably be implemented using camlp4 extenstion (turning all "large-tag types" into records with an implicit first word indicating the tag, and then transforming the pattern matching of these values to pattern matching of records. To simplify things, you could even use a special annotation for such blocks (for the camlp4 version only, of course).

- Tom

On 06/05/07, Brian Hurt <bhurt@spnz.org> wrote:

I think a better solution, although I have no idea how difficult it'd be
to implement, would be "large tag blocks".  For blocks with large tag
values (say, >245), the tag value in the tag word would be the special
"large tag" tag (say, value 246), and the last word of the block would be
the "large" tag value.  I say last, as this means you can still get the
nth word of a block without needing to special case large blocks.  This
would allow a full word to be used for tag values (giving way more than
enough tag values), and wouldn't change either memory usage or code for
blocks with small tag values.