# Ralloc: copying a relative pointer
An executed source-level check of the authors' pointer header, not an allocator
benchmark, crash-recovery test or physical persistence experiment.

## Reproduce
Download this directory with its upstream subdirectory, then run:
```sh
node verify.mjs
```
Requires Node.js and g++ with C++11 support. No packages, mounted persistent heap,
privileged commands or writes to storage devices are required. Temporary binaries
are removed on success or failure. A failed check returns a nonzero exit status.

## What the checks distinguish
| Operation | Expected result |
| --- | --- |
| C++ copy construction or assignment | Same target, recalculated relative encoding |
| Transfer only the encoding to the same field of another equal-layout object | Corresponding target in the other object |
| Failed strong compare-exchange | Target unchanged; expected argument updated |
| Default null versus integer zero | Default null is a recognized nonzero pattern; zero is invalid but decodes to null |

The probe uses 16 target locations, on both sides of a pointer field. It checks
229 conditions at each of three compiler configurations: -O0, -O2 and -O2
-DNDEBUG. Its checks do not disappear when C assertions are disabled.
The encoding-transfer case assigns an integer to an already constructed object;
it does not byte-copy a nontrivial C++ object or claim that a filesystem image
has been remapped. No flush, fence or recovery path is exercised.

## Recovery boundary

The member targets exercise address encoding only. Ralloc's
[ISMM paper, section 4.5, p. 66](https://www.cs.rochester.edu/u/scott/papers/2020_ISMM_Ralloc.pdf)
does not support pointers into fields of an allocation in its recovery design.
These successful header operations do not validate such pointers as recovery
roots or tracing edges. The [companion checks](../relative-pointers/README.md)
also separate ordinary atomic pointer comparisons from counted list heads.

## Interpretation
A pointer copy and a relocated representation answer different questions. Keeping
the same target requires rebasing the encoding; retaining the encoding while
moving both locations together preserves their relative arrangement.
These checks establish only the observed behavior of the pinned header under the
recorded compiler. They do not establish portability, concurrency correctness,
allocator recovery, persistence ordering or hardware power-loss behavior.

## Sources and licensing
- [Cai et al., ISMM 2020](https://doi.org/10.1145/3381898.3397212).
- [Author repository, exact revision](https://github.com/urcs-sync/ralloc/tree/6b9d7a1af75ba75232107bfaeb6a034799d5b182).
- The three unmodified upstream headers are redistributed with their MIT
  [LICENSE](upstream/LICENSE). verify.mjs pins all four SHA-256 hashes.
- probe.cpp and verify.mjs are original Hesela test code, released under MIT.
- [Term record](https://hesela.dev/terms/ralloc/).

Generated results are in results.json. Compiler and architecture are recorded
there; this is not a reproduction of the paper's throughput figures.
