Skip to main content

Module ptr

Module ptr 

Source
Expand description

GcPtr — typed pointer to a GC-managed object.

Wraps a raw pointer to a T that is preceded by a GcHeader at ptr - 8. GcPtr does NOT implement Drop — the GC handles deallocation.

§Platform-specific mark bit encoding

On platforms with hardware pointer masking, mark bits are stored inline in the upper pointer bits (zero-cost read/write):

  • ARM64 TBI: bit 56 (top byte is ignored by hardware)
  • x86-64 LAM57: bit 57 (masked by Linear Address Masking)
  • Software fallback: delegates to the GcHeader side table (the header’s color field) since we cannot store metadata in pointer bits without HW support.

The inline mark bit is a fast-path optimization for the concurrent marker: checking has_mark_bit() avoids a cache-line fetch of the GcHeader during the mark phase scan.

Structs§

GcPtr
A pointer to a GC-managed object of type T.