Skip to content

Commit

Permalink
Remove Stacked Borrows GC heuristics
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Nov 27, 2023
1 parent 99cc77b commit 325b95d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 3 additions & 12 deletions src/borrow_tracker/stacked_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ pub struct Stacks {
history: AllocHistory,
/// The set of tags that have been exposed inside this allocation.
exposed_tags: FxHashSet<BorTag>,
/// Whether this memory has been modified since the last time the tag GC ran
modified_since_last_gc: bool,
}

/// Indicates which permissions to grant to the retagged pointer.
Expand Down Expand Up @@ -450,15 +448,10 @@ impl<'tcx> Stack {
/// Integration with the BorTag garbage collector
impl Stacks {
pub fn remove_unreachable_tags(&mut self, live_tags: &FxHashSet<BorTag>) {
if self.modified_since_last_gc {
for (_stack_range, stack) in self.stacks.iter_mut_all() {
if stack.len() > 64 {
stack.retain(live_tags);
}
}
self.history.retain(live_tags);
self.modified_since_last_gc = false;
for (_stack_range, stack) in self.stacks.iter_mut_all() {
stack.retain(live_tags);
}
self.history.retain(live_tags);
}
}

Expand Down Expand Up @@ -488,7 +481,6 @@ impl<'tcx> Stacks {
stacks: RangeMap::new(size, stack),
history: AllocHistory::new(id, item, machine),
exposed_tags: FxHashSet::default(),
modified_since_last_gc: false,
}
}

Expand All @@ -503,7 +495,6 @@ impl<'tcx> Stacks {
&mut FxHashSet<BorTag>,
) -> InterpResult<'tcx>,
) -> InterpResult<'tcx> {
self.modified_since_last_gc = true;
for (stack_range, stack) in self.stacks.iter_mut(range.start, range.size) {
let mut dcx = dcx_builder.build(&mut self.history, Size::from_bytes(stack_range.start));
f(stack, &mut dcx, &mut self.exposed_tags)?;
Expand Down
2 changes: 1 addition & 1 deletion tests/pass/stacked-borrows/stack-printing.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//@compile-flags: -Zmiri-permissive-provenance
//@compile-flags: -Zmiri-permissive-provenance -Zmiri-provenance-gc=0
#![feature(strict_provenance)]
use std::{
alloc::{self, Layout},
Expand Down

0 comments on commit 325b95d

Please sign in to comment.