Skip to content

Commit

Permalink
use HashSet instead of IntMap
Browse files Browse the repository at this point in the history
  • Loading branch information
drbeefsupreme committed Nov 13, 2024
1 parent b5756f1 commit 2fe8ad1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crown/src/noun/slab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,17 +410,16 @@ impl NounSlab {
/// allocated memory regions or the PMA
pub fn validate_root(&self) -> Result<(), String> {
let mut stack = vec![self.root];
let mut visited = IntMap::new();
let mut visited = std::collections::HashSet::new();

while let Some(noun) = stack.pop() {
if let Ok(allocated) = noun.as_allocated() {
let ptr = unsafe { allocated.to_raw_pointer() };

// Skip if we've seen this pointer before
if visited.contains_key(ptr as u64) {
if !visited.insert(ptr as u64) {
continue;
}
visited.insert(ptr as u64, ());

// Check if pointer is in any of the slabs
let mut found_in_slab = false;
Expand Down

0 comments on commit 2fe8ad1

Please sign in to comment.