-
Notifications
You must be signed in to change notification settings - Fork 0
Alloc remapping #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fn get_index_and_populate_allocs(scc: &mut SerializeCycleCheck, alloc_id: &AllocId) -> usize { | ||
let galloc = &GlobalAlloc::from(*alloc_id); | ||
if !scc.seen_allocs.contains(alloc_id) { | ||
scc.seen_allocs.insert(*alloc_id); | ||
scc.gallocs_ordered.push(galloc.clone()); | ||
match galloc { | ||
GlobalAlloc::Memory(allocation) => { | ||
(&allocation.provenance.ptrs) | ||
.into_iter() | ||
.for_each(|(_, prov)| { get_index_and_populate_allocs(scc, &prov.0); }) | ||
}, | ||
_ => {}, | ||
} | ||
scc.seen_allocs.len() - 1 | ||
} else { | ||
(&scc.gallocs_ordered) | ||
.into_iter() | ||
.position(|needle| galloc == needle) | ||
.unwrap() | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not the best way to handle things, I feel like there is a lot of cloning especially since the whole vector gets cloned in global_allocs
function. What do you think @sskeirik?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, let's not worry about this. We can always fix it in a later version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for a first pass. Let's optimize later.
fn get_index_and_populate_allocs(scc: &mut SerializeCycleCheck, alloc_id: &AllocId) -> usize { | ||
let galloc = &GlobalAlloc::from(*alloc_id); | ||
if !scc.seen_allocs.contains(alloc_id) { | ||
scc.seen_allocs.insert(*alloc_id); | ||
scc.gallocs_ordered.push(galloc.clone()); | ||
match galloc { | ||
GlobalAlloc::Memory(allocation) => { | ||
(&allocation.provenance.ptrs) | ||
.into_iter() | ||
.for_each(|(_, prov)| { get_index_and_populate_allocs(scc, &prov.0); }) | ||
}, | ||
_ => {}, | ||
} | ||
scc.seen_allocs.len() - 1 | ||
} else { | ||
(&scc.gallocs_ordered) | ||
.into_iter() | ||
.position(|needle| galloc == needle) | ||
.unwrap() | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, let's not worry about this. We can always fix it in a later version.
Remove `build_sysroot` folder
Interning of
AllocId
in serialisation of SMIR, and then separate serialisation ofGlobalAlloc
mapping to interned values.