-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand Miri's BorTag GC to a Provenance GC #118029
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -692,6 +692,15 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { | |
Ok((&mut alloc.extra, machine)) | ||
} | ||
|
||
/// Check whether an allocation is live. This is faster than calling | ||
/// [`InterpCx::get_alloc_info`] if all you need to check is whether the kind is | ||
/// [`AllocKind::Dead`] because it doesn't have to look up the type and layout of statics. | ||
pub fn is_alloc_live(&self, id: AllocId) -> bool { | ||
self.tcx.try_get_global_alloc(id).is_some() | ||
|| self.memory.alloc_map.contains_key_ref(&id) | ||
|| self.memory.extra_fn_ptr_map.contains_key(&id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth thinking about the order in which we check these? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tuned the order against the test 0weak_memory_consistency, because its runtime explodes after this PR with GC every block. I'll try some other programs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looked a bit more into this. I've run (chunks of) the test suites for Since all the global allocs can never be deallocated I think it might be worth stealing a bit from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So you're saying we should stay with "global first" for now? Works for me. |
||
} | ||
|
||
/// Obtain the size and alignment of an allocation, even if that allocation has | ||
/// been deallocated. | ||
pub fn get_alloc_info(&self, id: AllocId) -> (Size, Align, AllocKind) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,16 @@ cat /tmp/toolstate/toolstates.json | |
python3 "$X_PY" test --stage 2 check-tools | ||
python3 "$X_PY" test --stage 2 src/tools/clippy | ||
python3 "$X_PY" test --stage 2 src/tools/rustfmt | ||
python3 "$X_PY" test --stage 2 src/tools/miri | ||
|
||
# Testing Miri is a bit more complicated. | ||
# We set the GC interval to the shortest possible value (0 would be off) to increase the chance | ||
# that bugs which only surface when the GC runs at a specific time are more likely to cause CI to fail. | ||
# This significantly increases the runtime of our test suite, or we'd do this in PR CI too. | ||
if [[ -z "${PR_CI_JOB:-}" ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had suggested the version without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried to look up docs for shell expansion and I could only find the ones with :- documented and that's what the Miri repo uses. What changes if the colon is omitted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't find the page I got this from but https://stackoverflow.com/a/16753536 lists them all. They behave differently when the variable exists but is empty. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html says this before the list that has
I'd say the version without the colon is the more reasonable semantics (null != does-not-exist), but the shell world is weird.^^ |
||
MIRIFLAGS=-Zmiri-provenance-gc=1 python3 "$X_PY" test --stage 2 src/tools/miri | ||
else | ||
python3 "$X_PY" test --stage 2 src/tools/miri | ||
fi | ||
# We natively run this script on x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc. | ||
# Also cover some other targets via cross-testing, in particular all tier 1 targets. | ||
export BOOTSTRAP_SKIP_TARGET_SANITY=1 # we don't need `cc` for these targets | ||
|
Uh oh!
There was an error while loading. Please reload this page.