Tagging info table pointers with closure types?
A closure is composed of an info table pointer + some payload.
Many times when we traverse the heap (evacuate
, scavenge
, etc.) we switch
on the type
field in the pointed info table. In many cases that's the only use of the info table.
Couldn't we store the closure type as a tag in the info table pointer? I would expect this to reduce the number of memory accesses by quite a lot.
Currently there are 64 closure types: we just have to align info tables on 64 bytes to get the 6 free bits we need in info table pointers.
If we need to add more closure types we can renumber the "generic" ones---like FUN
or THUNK
for which we always need to consult ptrs/nptrs
fields in the info table---to give them numbers >= 64 and use tag = 0 for them (where tag 0 means: check the type
field in the info table). Or we may decide to align info tables on 128 bytes to get 1 more free bit if it doesn't waste too much space.
(Note that some tagging is already used to identify forwarding pointers. Perhaps we'll have to reserve the least significant bit for this)