don't erase ptr type early when construction a Cons HeapCellValue

rather than passing an address as usize pass the ArenaHeader pointer
similarly don't return a u8 ptr but use a ArenaHeader pointer instead

Don't convert the pointer to a ConsPtr by going through native endian
bytes in between.
We are exploiting the fact that the 3 least significant bytes are zero
for pointer to types of alignment 8 and we expect these to line up with
the f, m, and tag field at the end of the ConsPtr struct, but using
native endiannes for this would only work on big endian systems.
This commit is contained in:
Skgland
2026-04-22 23:22:27 +02:00
parent 6765921666
commit b4db85c8c3
4 changed files with 61 additions and 54 deletions

View File

@@ -690,8 +690,7 @@ mod tests {
// term is: [a, <stream ptr>]
let stream = Stream::from_static_string("test", &mut wam.machine_st.arena);
let stream_cell =
HeapCellValue::from(ConsPtr::build_with(stream.as_ptr(), ConsPtrMaskTag::Cons));
let stream_cell = HeapCellValue::from_arena_header_ptr(stream.as_ptr());
let mut writer = wam.machine_st.heap.reserve(16).unwrap();