Skip to content

Remove min payload size restriction from the compiler and RTS

Ömer Sinan Ağacan requested to merge wip/osa1/min_payload_size into master

Previously we'd require every heap object to have at least one word space in the payload. This was incorrectly documented as follows in the source code: (now deleted)

Minimum closure sizes

This is the minimum number of words in the payload of a
heap-allocated closure, so that the closure has enough room to be
overwritten with a forwarding pointer during garbage collection.

This comment was wrong: the GC doesn't require a location in the payload, forwarding pointers are made using the info table pointer location.

The real reason why we needed a word in the payload is because mark-compact collector allocates one bit per word in the heap for bitmap, but needs two bits per object to work efficiently. Details are explained in the new note Note [Mark bits in mark-compact collector] in Compact.h.

We now allocate two bits in the bitmap per word and remove the restriction. Heap objects can now have size 1, as demonstrated in the updated tests.

Nofib results:

  • 0.0% change in binary sizes and TotalMem
  • "contaraints" now allocates -0.1% less. No other changes in allocations.
  • Runtime/Elapsed results are noisy and inconclusive
Edited by Ömer Sinan Ağacan

Merge request reports