about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2022-09-05 18:39:32 -0400
committerBen Kimock <kimockb@gmail.com>2022-09-10 23:05:56 -0400
commitf59605ce521b6eae453875cbdfe9263ab7e50d9e (patch)
treefb934fd3e6b8f35c9d35694c975d4280099757f1
parentd61d4c6af76e10a45cd743048d56f7c35d0b22ea (diff)
downloadrust-f59605ce521b6eae453875cbdfe9263ab7e50d9e.tar.gz
rust-f59605ce521b6eae453875cbdfe9263ab7e50d9e.zip
In CI set the GC interval to 1 for Linux only
-rw-r--r--.github/workflows/ci.yml4
-rwxr-xr-xci.sh2
-rw-r--r--src/machine.rs7
3 files changed, 7 insertions, 6 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8193411f879..fde575922dd 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 <https://github.com/actions/cache/issues/403>.
       - name: Install GNU tar
diff --git a/ci.sh b/ci.sh
index d70feec66f2..aa322e54a31 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 4eb68907337..60fe2a91adf 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.