Use sidemap for GC object metadata
Zebu intends to side maps to seperate objects from their metadata.
However, currently as a compromise, I am using a 64-bit object header along with GCType
for the metadata. We will go back to using side maps.
This issue describes the design of sidemap scheme.
- we will assume a minimal object size
MIN_SIZE
, and a minimal alignmentMIN_ALIGN
. The larger the minimal size/align is, the less memory is required for metadata (see below). However, it wastes memory in the heap. MIN_SIZE of 16/24/32bitsbytes, MIN_ALIGN of 128bits are reasonable. - object metadata includes:
- 1bit/MIN_ALIGN: object start (and end - so we can decide size) (size is required for copying/dumping object)
- 1bit/64bits: reference locations
- 8bits/MIN_SIZE: gc state (mark bit, reference count, etc)
- small objects have less space to encode metadata, but large objects have plenty. We can use different schemes to encode small/large objects.
- side maps should be stored in the metadata part of a page/memory chunk.
More concrete design will be updated here once we discuss more.