dataToTag# doesn't take advantage of tag bits
Currently dataToTag#
always enters its argument and looks at the info table of the result to determine the tag. Now since we tag pointers to constructors of "large" sum types (#14373 (closed)) there is potentially a significant payoff to taking better advantage of pointer tagging. That is, dataToTag#
should:
if (TAG_BITS(arg) == 0)
arg = ENTER(arg);
if (TAG_BITS(arg) == 0)
return GET_INFO(arg).tag;
else
return TAG_BITS(arg) - 1;
This will be particularly beneficial to user code after teaching Ord
to compare enumerations via dataToTag#
(#16578).