feat(registry): checkpoint PLN-0176 foundations and validated partial integrations

This commit is contained in:
2026-10-07 17:49:46 +01:00
parent 01fab56cc6
commit 126a9e50e7
63 changed files with 8499 additions and 1462 deletions
+8 -4
View File
@@ -7,9 +7,13 @@ pub trait RootVisitor {
}
/// Helper: if `val` is a `Value::HeapRef`, call the visitor.
pub(crate) fn value_heap_ref(value: &Value) -> Option<HeapRef> {
if let Value::HeapRef(r) = value { Some(*r) } else { None }
}
pub fn visit_value_for_roots<V: RootVisitor + ?Sized>(val: &Value, visitor: &mut V) {
if let Value::HeapRef(r) = val {
visitor.visit_heap_ref(*r);
if let Some(r) = value_heap_ref(val) {
visitor.visit_heap_ref(r);
}
}
@@ -31,11 +35,11 @@ mod tests {
fn visits_heapref_on_operand_stack() {
let mut vm = VirtualMachine::default();
// Place a HeapRef on the operand stack
vm.push_operand_for_test(Value::HeapRef(HeapRef(123)));
vm.push_operand_for_test(Value::HeapRef(HeapRef { index: 123, generation: 1 }));
let mut v = CollectVisitor { seen: vec![] };
vm.visit_roots(&mut v);
assert_eq!(v.seen, vec![HeapRef(123)]);
assert_eq!(v.seen, vec![HeapRef { index: 123, generation: 1 }]);
}
}