mirror of
https://github.com/urbit/ares.git
synced 2024-11-26 09:57:56 +03:00
[ares] [hamt] jam and cue work with mutable hamt
This commit is contained in:
parent
e2743e24e7
commit
abfd642868
@ -141,7 +141,7 @@ impl<T: Copy> MutHamt<T> {
|
||||
assert!(leaf.len == 1);
|
||||
let new_stem = stack.struct_alloc::<MutStem<T>>(1);
|
||||
let leaf_mug = mug_u32(stack, (*leaf.buffer).0);
|
||||
let leaf_chunk = (leaf_mug >> (depth * 5)) & 0x1f;
|
||||
let leaf_chunk = (leaf_mug >> ((depth + 1) * 5)) & 0x1f;
|
||||
(*new_stem).bitmap = chunk_to_bit(leaf_chunk);
|
||||
(*new_stem).typemap = 0;
|
||||
(*new_stem).buffer[leaf_chunk as usize] = MutEntry{ leaf: leaf};
|
||||
|
@ -114,6 +114,9 @@ pub fn mug_u32_one(noun: Noun) -> Option<u32> {
|
||||
}
|
||||
|
||||
pub fn mug_u32(stack: &mut NockStack, noun: Noun) -> u32 {
|
||||
if let Some(mug) = get_mug(noun) {
|
||||
return mug;
|
||||
}
|
||||
assert_acyclic!(noun);
|
||||
stack.push(1);
|
||||
unsafe {
|
||||
|
@ -194,6 +194,9 @@ pub fn jam(stack: &mut NockStack, noun: Noun) -> Atom {
|
||||
jam_backref(stack, &mut state, backref);
|
||||
},
|
||||
}
|
||||
unsafe {
|
||||
stack.reclaim_in_previous_frame::<Noun>();
|
||||
};
|
||||
continue 'jam;
|
||||
};
|
||||
backref_map.insert(stack, &mut noun, state.cursor as u64);
|
||||
|
Loading…
Reference in New Issue
Block a user