Self-relative pointer
A self-relative pointer represents its target as a byte displacement from the address where the pointer value is stored.
Relocation: The displacement remains valid when holder and target move together with unchanged separation; moving only one endpoint requires rebasing. The off-holder design applies this representation within an NVRegion. [1] [2]
Copying: Copying the encoded displacement to a new holder is different from assigning the same target. In an integer example, holder 0x1000 and target 0x1080 encode +0x80. Copying that value to holder 0x1100 decodes to 0x1180; preserving target 0x1080 requires -0x80. [3]
Memberwise copy: Copying a C++ struct containing a Ralloc pptr preserves the original pointee, not the corresponding member of the new struct. The native example also checks assignment and move construction; these are not deep copies or memory-image remapping. [3]
Nulls: A zero displacement can represent a reference to the holder itself. The offset_ptr implementation reserves displacement 1 for null instead, so its null convention is not interchangeable with other encodings. [1]
Boundary: Position independence does not establish object lifetime, compatible layout, atomic updates or durability. The integer model evaluates address arithmetic only; the separately labelled native probe exercises one pinned implementation. [3]
Relations
Citations
- Boost.Interprocess 1.85. Mapping Address Independent Pointer: offset_ptr.
- Chen et al. Efficient Support of Position Independence on Non-Volatile Memory. MICRO 2017, sections 4-6. DOI: 10.1145/3123939.3124543.
- Hesela. Relative-pointer relocation: integer model, native struct-copy checks and worked cases.
Sources & caveats
- Off-holder is the name used in the 2017 paper; the record groups it with the equivalent holder-relative representation, not a separate invention claim.
- Worked addresses are synthetic byte addresses, not C++ pointer arithmetic or a crash-recovery experiment.