Source Anchors
nockstack-frame-bounds
crates/nockvm/rust/nockvm/src/mem.rs
NockStack::is_in_frame
1338-1377
Classifies whether a pointer belongs to the current NockStack frame before preserving or copying runtime structures.
The check rejects null pointers, debug-asserts arena bounds, derives the pointer word offset, and compares it with the current and previous frame offsets.
nockstack-frame-lifecycle
crates/nockvm/rust/nockvm/src/mem.rs
NockStack::frame_push, NockStack::frame_pop, NockStack::with_frame
1952-2032
Pushes and pops frame metadata while preserving returned nouns into the previous frame.
Frame push bounds-checks the requested words, saves previous frame/stack/alloc pointers, and frame_pop refuses null saved pointers before restoring offsets.
interpreter-stack-frame-preserve
crates/nockvm/rust/nockvm/src/interpreter.rs
Context::with_stack_frame, NockStack::frame_push, NockStack::frame_pop
506-524
Wraps jet work in a stack frame and preserves return value plus cache/cold/warm nouns before popping.
The interpreter pushes a frame, runs the closure, preserves runtime state into the stack, then pops the frame.
cue-stack-deserialization
crates/nockvm/rust/nockvm/src/serialization.rs
cue_bitslice_with_mode, cue_bitslice, cue, CueStackEntry
125-205
Deserializes jam/cue data through an explicit stack of destination pointers and backreference entries.
Cue uses stack.with_frame, a HAMT backreference map, next-bit tag dispatch, and deterministic failure when a backreference cannot resolve.
rub-backref-bounds
crates/nockvm/rust/nockvm/src/serialization.rs
rub_atom_internal, rub_backref, get_size, next_up_to_n_bits
371-420
Bounds the atom and backreference decoding path that malformed jam/cue payloads exercise.
Atom decode uses get_size and bounded bit slices; backrefs over 64 bits return a nondeterministic failure instead of producing an unchecked offset.
jam-traversal-bounds
crates/nockvm/rust/nockvm/src/serialization.rs
jam, jam_atom, jam_cell, jam_backref, mat, double_atom_size
431-610
Serializes nouns with an iterative traversal, backreference map, and retry-on-growth atom buffer.
Jam pushes nouns onto the NockStack instead of recursing, doubles output atoms when needed, and preserves the normalized result before popping the frame.
noun-space-provenance
crates/nockvm/rust/nockvm/src/noun.rs
AllocLocation, NounSpace, NounSpace::with_brand, BrandedNounHandle
56-390, 630-650
Separates stack, PMA pointer, and PMA offset nouns while giving handles a scope tied to a specific NounSpace.
NounSpace records stack/PMA arenas, stack epoch snapshots, PMA bounds, and a branded handle API that prevents handles from escaping the intended scope.
hamt-fixed-depth-preserve
crates/nockvm/rust/nockvm/src/hamt.rs
Preserve for Hamt<T>, Hamt<T>::preserve, Hamsterator
488-620, 1018-1048
Preserves HAMT structures with a fixed-depth traversal stack matching the bounded key layout.
HAMT preserve copies in-frame stems/leaves into the previous frame and uses fixed arrays sized for maximum depth rather than unbounded recursion.
pma-direct-reader-bounds
crates/nockvm/rust/nockvm/src/pma/stream.rs
PmaDirectReader, PmaDirectReader::read_u64, PmaDirectReader::read_cell, PmaDirectReader::indirect_atom_words
98-284
Reads PMA words and noun structures directly from disk while enforcing alloc-word and indirect-atom bounds.
read_u64 rejects offsets past alloc_words, read_cell rejects cells that would cross the limit, and indirect_atom_words rejects forwarding pointers, zero-length atoms, overflow, and end offsets past alloc_words.