From f59605ce521b6eae453875cbdfe9263ab7e50d9e Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Mon, 5 Sep 2022 18:39:32 -0400 Subject: [PATCH] In CI set the GC interval to 1 for Linux only --- .github/workflows/ci.yml | 4 ++++ ci.sh | 2 +- src/machine.rs | 7 ++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8193411f8799..fde575922dd1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,10 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Set the tag GC interval to 1 on linux + if: runner.os == 'macOS' + run: echo "MIRIFLAGS=-Zmiri-tag-gc=1" >> $GITHUB_ENV + # We install gnu-tar because BSD tar is buggy on macOS builders of GHA. # See . - name: Install GNU tar diff --git a/ci.sh b/ci.sh index d70feec66f26..aa322e54a31d 100755 --- a/ci.sh +++ b/ci.sh @@ -31,7 +31,7 @@ function run_tests { # optimizations up all the way). # Optimizations change diagnostics (mostly backtraces), so we don't check them #FIXME(#2155): we want to only run the pass and panic tests here, not the fail tests. - MIRIFLAGS="-O -Zmir-opt-level=4" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic} + MIRIFLAGS="${MIRIFLAGS:-} -O -Zmir-opt-level=4" MIRI_SKIP_UI_CHECKS=1 ./miri test -- tests/{pass,panic} fi ## test-cargo-miri diff --git a/src/machine.rs b/src/machine.rs index 4eb68907337a..60fe2a91adf7 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -1015,6 +1015,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> { fn before_terminator(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { ecx.machine.basic_block_count += 1u64; // a u64 that is only incremented by 1 will "never" overflow + ecx.machine.since_gc += 1; // Possibly report our progress. if let Some(report_progress) = ecx.machine.report_progress { if ecx.machine.basic_block_count % u64::from(report_progress) == 0 { @@ -1028,13 +1029,9 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> { // stacks. // When debug assertions are enabled, run the GC as often as possible so that any cases // where it mistakenly removes an important tag become visible. - if cfg!(debug_assertions) - || (ecx.machine.gc_interval > 0 && ecx.machine.since_gc >= ecx.machine.gc_interval) - { + if ecx.machine.gc_interval > 0 && ecx.machine.since_gc >= ecx.machine.gc_interval { ecx.machine.since_gc = 0; ecx.garbage_collect_tags()?; - } else { - ecx.machine.since_gc += 1; } // These are our preemption points.