This commit is contained in:
Ralf Jung 2023-11-21 18:24:57 +01:00
parent eed24ac572
commit f1b944d1a2
3 changed files with 4 additions and 11 deletions

View File

@ -125,7 +125,7 @@ pub use crate::machine::{
};
pub use crate::mono_hash_map::MonoHashMap;
pub use crate::operator::EvalContextExt as _;
pub use crate::provenance_gc::{EvalContextExt as _, VisitProvenance, VisitWith, LiveAllocs};
pub use crate::provenance_gc::{EvalContextExt as _, LiveAllocs, VisitProvenance, VisitWith};
pub use crate::range_map::RangeMap;
/// Insert rustc arguments at the beginning of the argument list that Miri wants to be

View File

@ -157,15 +157,13 @@ pub struct LiveAllocs<'a, 'mir, 'tcx> {
impl LiveAllocs<'_, '_, '_> {
pub fn is_live(&self, id: AllocId) -> bool {
self.collected.contains(&id) ||
self.ecx.is_alloc_live(id)
self.collected.contains(&id) || self.ecx.is_alloc_live(id)
}
}
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> {
fn run_provenance_gc(&mut self) {
// We collect all tags from various parts of the interpreter, but also
let this = self.eval_context_mut();
@ -196,10 +194,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: MiriInterpCxExt<'mir, 'tcx> {
fn remove_unreachable_allocs(&mut self, allocs: FxHashSet<AllocId>) {
let this = self.eval_context_ref();
let allocs = LiveAllocs {
ecx: this,
collected: allocs,
};
let allocs = LiveAllocs { ecx: this, collected: allocs };
this.machine.allocation_spans.borrow_mut().retain(|id, _| allocs.is_live(*id));
this.machine.intptrcast.borrow_mut().remove_unreachable_allocs(&allocs);
if let Some(borrow_tracker) = &this.machine.borrow_tracker {

View File

@ -12,7 +12,5 @@ pub use miri_extern::*;
pub fn run_provenance_gc() {
// SAFETY: No preconditions. The GC is fine to run at any time.
unsafe {
miri_run_provenance_gc()
}
unsafe { miri_run_provenance_gc() }
}