Inline records of at most 16 bytes into the two-word RecordValue with layout-resolved storage

This commit is contained in:
Dennis Kobert
2026-08-05 17:23:09 +00:00
parent 7915800d73
commit 9fc4fcc7a0
5 changed files with 198 additions and 72 deletions

View File

@@ -481,7 +481,7 @@ impl BorrowTree {
pub fn stack_need(&self) -> usize {
self.nodes
.values()
.map(|(handle, _)| handle.layout().map_or(0, |layout| layout.size.next_multiple_of(8)))
.map(|(handle, _)| handle.layout().map_or(0, |layout| layout.frame_bytes()))
.sum()
}
}

View File

@@ -825,7 +825,9 @@ mod node_registry_macros {
return Err(ConstructionError::Arity { expected: 1, got: inputs.len() });
}
let mut inputs = inputs.into_iter();
let node = core_types::record::RecordExtract::<$type, _>::new(inputs.next().unwrap().downcast_record::<$type>()?);
let edge = inputs.next().unwrap();
let layout = edge.layout().ok_or(ConstructionError::MissingLayout)?.clone();
let node = core_types::record::RecordExtract::<$type, _>::new(edge.downcast_record::<$type>()?, &layout);
Ok(EdgeHandle::new(std::sync::Arc::new(node) as std::sync::Arc<ErasedNode<$type>>))
},
},