Mercury Bugs - mercury
View Issue Details
0000432mercuryFeature Requestpublic2017-03-21 13:122018-02-22 14:06
Reporterwangp 
Assigned Tozs 
PrioritynormalSeverityminorReproducibilityalways
StatusassignedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000432: pack constructor arguments in same word as primary tag
DescriptionWhen we have a data constructor with a primary tag, whose arguments have a total width less than or equal to the number of remaining bits, we could pack the arguments into the same word as the tag instead of a separate cell.

e.g.

:- type bits_or_string
    ---> bits(bool, bool, bool)
    ; string(string).

This would be more useful once we have smaller-than-word-size ints.
TagsNo tags attached.
Attached Files

Notes
(0000944)
zs   
2017-03-21 15:48   
That is a good idea.

Actually, it could also be applied to secondary tags. If a type has enough non-constant functors to need a secondary tag for some functors, then at the moment, we allocate
the entire first word of the memory cells of those functors to the secondary tag.
However, we could allocate only the minimum number of secondary tag bits
needed to distinguish those functors, and allocate the rest to hold the packable
arguments of those functors.

However, I expect this would be useful much more rarely than Peter's original
proposal.

Issue History
2017-03-21 13:12wangpNew Issue
2017-03-21 15:48zsNote Added: 0000944
2018-02-22 14:06zsAssigned To => zs
2018-02-22 14:06zsStatusnew => assigned