tiny.stabilizer
Overview · API · Code relationships · Verification · Audit
Overview
Randomizes a program's memory layout by choosing heap addresses, stack frame padding, and code addresses at random (layout randomization), so that a benchmark can run over many layouts. A single build fixes the addresses of its code, its stack frames, and its heap blocks, and those addresses decide which cache lines and branch predictor entries collide. A caller comparing two builds of a benchmark wants the difference to come from the code, while the addresses the linker and the allocator happened to choose vary from run to run.
The heap that keeps a pool of slots per size class and serves each request from a slot drawn at random is the shuffle allocator. The shuffle allocator fills every slot ahead of time and shuffles the pool, then puts a fresh block in the drawn slot's place. A request larger than the configured maximum bypasses the shuffling and goes to the allocator the caller supplied at init, the backing allocator.
Each call takes a per-call padding size drawn from a refillable table (stack pad), so a frame sits at a different offset each time.
The state that relocates registered functions to fresh addresses and rewrites their entry traps is the code randomizer. Those entry traps catch the next call, and the code randomizer moves the layout again every 500 milliseconds.
One seed drives the heap, the stack pads, and the code layout together, so a run repeats when the seed repeats. The defaults follow the published Stabilizer runtime: 256 shuffle slots, 32 MiB regions, 32-byte code alignment, 16-byte stack alignment, and a 500 millisecond interval.
Definitions
Actions
Public operations.
Types and contracts
Public types and contracts.
MarsagliaStackPadsCodeConfigConfigConstructorFnFunctionEntryStateFunctionIdFunctionImageOptionsFunctionLocationFunctionOptionsFunctionRangeOptionsFunctionStackPadHeapConfigLocationIdReferenceStackConfigStackPadShuffleAllocatorCodeRandomizerRuntime
Values and defaults
Public values and defaults.
code_alignmentdefault_region_sizedefault_seeddefault_shuffle_slotsmax_stack_pad_unitrerandomize_interval_msstack_alignment
Code relationships
Direct static dependencies extracted from parsed source by semantic graph analysis.
Uses: tiny.bumpalo, tiny.hypothesis
Used by: tiny.bench
Verification
No verification records are cataloged for this module in this build.
Audit
| Evidence | Value |
|---|---|
| Source | lib/stabilizer/src/root.zig |
| Definitions | 0 of 33 documented |
| Members | 0 of 0 documented |
| Public names | 33 API, 105 indexed |
| Version | 26.7.0 |
| Revision | daab053ee433 |