mirror of
https://github.com/urbit/ares.git
synced 2024-12-24 13:55:23 +03:00
nouns: function to assert a noun doesn't contain any forwarding pointers
This commit is contained in:
parent
994c657476
commit
3022bf9ce6
@ -895,6 +895,20 @@ impl Noun {
|
||||
Noun { raw }
|
||||
}
|
||||
|
||||
pub unsafe fn assert_no_forwarding_pointers(self) {
|
||||
let mut dbg_stack = Vec::new();
|
||||
dbg_stack.push(self);
|
||||
while !dbg_stack.is_empty() {
|
||||
let noun = dbg_stack.pop().unwrap();
|
||||
if noun.raw & FORWARDING_MASK == FORWARDING_TAG {
|
||||
panic!("Noun {:#x} has a forwarding pointer as a child", self.raw);
|
||||
} else if let Ok(cell) = noun.as_cell() {
|
||||
dbg_stack.push(cell.tail());
|
||||
dbg_stack.push(cell.head());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Produce the total size of a noun, in words
|
||||
*
|
||||
* This counts the total size, see mass_frame() to count the size in the current frame.
|
||||
|
Loading…
Reference in New Issue
Block a user