Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 24 additions & 23 deletions crates/victory-gpu/src/watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1989,33 +1989,34 @@ fn guard(start: usize, end: usize) -> Option<Vec<usize>> {
// runtime's. Windows is asked with the lock not held (the range is, no
// other thread asks about it: `ASKING`); what the runtime tells meanwhile
// takes the block out of the set, and it is looked at as any other.
let unsure: Vec<usize> = {
let g = guards_timed();
if g.clean.range(first..last).count() == last - first && !BESIDE.any(first, last) && !unsettled(first, last) {
// Nothing written, mapped or new since the range was last taken.
#[cfg(feature = "diagnostics")]
tally(3, 1);
return Some(Vec::new());
}
g.absent.range(first..last).filter(|block| !g.held.contains(*block)).collect()
};
let mut g = guards_timed();
if g.clean.range(first..last).count() == last - first && !BESIDE.any(first, last) && !unsettled(first, last) {
// Nothing written, mapped or new since the range was last taken.
#[cfg(feature = "diagnostics")]
tally(3, 1);
return Some(Vec::new());
}
let unsure: Vec<_> = g.absent.range(first..last).filter(|block| !g.held.contains(*block)).collect();
let mut came: Vec<(usize, bool)> = Vec::new();
let mut uncommitted_until = first;
for block in unsure {
// One question for the blocks of a region.
if block >= uncommitted_until {
uncommitted_until = uncommitted_end(block);
#[cfg(feature = "diagnostics")]
tally(9, 1);
}
if block >= uncommitted_until {
// The hole may have been given up, and its address be the
// title's heap's, or code's, now: not ours to guard.
came.push((block, is_view(block * BLOCK, (block + 1) * BLOCK)));
if !unsure.is_empty() || !crate::asked_for!("VICTORY_KEEP_GUARD_LOCK") {
drop(g);
let mut uncommitted_until = first;
for block in unsure {
// One question for the blocks of a region.
if block >= uncommitted_until {
uncommitted_until = uncommitted_end(block);
#[cfg(feature = "diagnostics")]
tally(9, 1);
}
if block >= uncommitted_until {
// The hole may have been given up, and its address be the
// title's heap's, or code's, now: not ours to guard.
came.push((block, is_view(block * BLOCK, (block + 1) * BLOCK)));
}
}
g = guards_timed();
}
let rest = rest();
let mut g = guards_timed();
#[cfg(feature = "diagnostics")]
tally(4, 1);
for &(block, view) in &came {
Expand Down
Loading