Skip to content

Turn OccInfo into a bitfield

This is what it looks like to access OccInfo inside IdInfo on the heap:

    IdInfo
+-----------+             OneOcc
|  occInfo  +-------->+------------+
+-----------+         |  InsideLam |
|   .....   |         +------------+
                      |  OneBranch |
                      +------------+
                      |Interesting |
                      +------------+
                      |TailCallInfo|
                      +------------+

the fields in OneOcc are simple enumerations and most probably tagged, so I left out pointer-chasing there.

Still, it's quite bad: We use 4 words for each OneOcc where we could get by with just one word and some bit fiddling (see #17497 (closed), where we did the same to IdInfo fields). Similarly the other constructors, they fit comfortably into 1 word.

Additionally (but optionally), we could make the occInfo field strict and unbox the Word64 bitfield.

The simplest way to accomplish this, is probably by changing the definition of OccInfo to

newtype OccInfo = OccInfo Word64

pattern IAmDead ...
pattern IAmALoopBreaker ...
pattern OneOcc ...
pattern ManyOccs ...

Now there isn't even any serialisation involved (which would likely cancel away at use sites anyway) when accessing IdInfo.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information