PointerMap

Pointer map for precise heap scanning. Format: PointerMap pm = typeid(T).pointermap; pm.bits = header ~ scan_bits ~ pointer_bits size_t header is the number of pointer sized units in T (T.sizeof/size_t.sizeof) size_t[] scan_bits is the bitmap; each bit covers size_t bytes of T, meaning: 0: guaranteed not to be a pointer, don't scan 1: possibly a pointer, must scan size_t[] pointer_bits is a second bitmap similar to scan_bits. If the corrsponding bit in scan_bits is 0, the bit is 0; otherwise its meaning is: 0: pointer can not be moved, because it's possibly an integer 1: pointer can be moved, the corresponding word is always a pointer Note that not the bit-arrays are concatenated, but the size_t arrays. This implies all GC-aware pointers must be aligned on size_t boundaries. The compiler won't set any bits for unaligned pointer fields. The least significant bit of a size_t item is considered the first bit. PointerMap.init is a conservative scanning mask equivelant to void*[]

Members

Functions

canUpdatePointers
bool canUpdatePointers()

return true if and only if there are integer fields overlapping with pointer fields in this type

isPointerAt
bool isPointerAt(size_t offset)

return if the (aligned) field starting at byte offset is a moveable pointer "moveable pointer" means that the memory block referenced by the pointer can be moved by the GC (the pointer field will be updated with the new address)

mustScanWordAt
bool mustScanWordAt(size_t offset)

return if the (aligned) field starting at byte offset is a pointer Warning: the GC may access the internal data structure directly instead of using this method to make scanning faster

size
size_t size()

return size in bytes (aligned)

Variables

bits
size_t[] bits;
Undocumented in source.

Meta