diff --git a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
index bb20c02629b..07aa390c539 100644
--- a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
@@ -64,7 +64,7 @@ void ShenandoahBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, Dec
         __ andi(t0, t0, ShenandoahHeap::HAS_FORWARDED);
         __ beqz(t0, done);
       } else {
-        __ andi(t0, t0, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::MARKING);
+        __ andi(t0, t0, ShenandoahHeap::HAS_FORWARDED | ShenandoahHeap::YOUNG_MARKING | ShenandoahHeap::OLD_MARKING);
         __ beqz(t0, done);
       }
 
@@ -642,7 +642,7 @@ void ShenandoahBarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAss
   // Is marking still active?
   Address gc_state(thread, in_bytes(ShenandoahThreadLocalData::gc_state_offset()));
   __ lb(tmp, gc_state);
-  __ andi(tmp, tmp, ShenandoahHeap::MARKING);
+  __ andi(tmp, tmp, ShenandoahHeap::YOUNG_MARKING | ShenandoahHeap::OLD_MARKING);
   __ beqz(tmp, done);
 
   // Can we store original value in the thread's buffer?
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp b/src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp
index bd563e4d498..87188b75358 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahEvacTracker.cpp
@@ -21,7 +21,9 @@
  * questions.
  *
  */
+#include "precompiled.hpp"
 
+#include "gc/shenandoah/shenandoahHeap.inline.hpp"
 #include "gc/shenandoah/shenandoahEvacTracker.hpp"
 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
index da5488e57c7..0729e0466ad 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
@@ -832,9 +832,9 @@ void ShenandoahHeap::report_promotion_failure(Thread* thread, size_t size) {
   // We squelch excessive reports to reduce noise in logs.  Squelch enforcement is not "perfect" because
   // this same code can be in-lined in multiple contexts, and each context will have its own copy of the static
   // last_report_epoch and this_epoch_report_count variables.
-  const uint MaxReportsPerEpoch = 4;
-  static uint last_report_epoch = 0;
-  static uint epoch_report_count = 0;
+  const size_t MaxReportsPerEpoch = 4;
+  static size_t last_report_epoch = 0;
+  static size_t epoch_report_count = 0;
 
   size_t promotion_reserve;
   size_t promotion_expended;
@@ -857,7 +857,7 @@ void ShenandoahHeap::report_promotion_failure(Thread* thread, size_t size) {
                        size, plab == nullptr? "no": "yes",
                        words_remaining, promote_enabled, promotion_reserve, promotion_expended);
     if ((gc_id == last_report_epoch) && (epoch_report_count >= MaxReportsPerEpoch)) {
-      log_info(gc, ergo)("Squelching additional promotion failure reports for epoch %d", last_report_epoch);
+      log_info(gc, ergo)("Squelching additional promotion failure reports for epoch " SIZE_FORMAT, last_report_epoch);
     } else if (gc_id != last_report_epoch) {
       last_report_epoch = gc_id;;
       epoch_report_count = 1;
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionCounters.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionCounters.cpp
index f0f6c6b3b6c..d36f5ce8dcf 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionCounters.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionCounters.cpp
@@ -91,13 +91,13 @@ void ShenandoahHeapRegionCounters::write_snapshot(PerfLongVariable** regions,
     ResourceMark rm;
     LogStream ls(lt);
 
-    ls.print_cr("%li %li %lu %lu %lu",
+    ls.print_cr(JLONG_FORMAT " " JLONG_FORMAT " " SIZE_FORMAT " " SIZE_FORMAT " " SIZE_FORMAT,
             ts->get_value(), status->get_value(), num_regions, region_size, protocol_version);
     if (num_regions > 0) {
-      ls.print("%li", regions[0]->get_value());
+      ls.print(JLONG_FORMAT, regions[0]->get_value());
     }
     for (uint i = 1; i < num_regions; ++i) {
-      ls.print(" %li", regions[i]->get_value());
+      ls.print(" " JLONG_FORMAT, regions[i]->get_value());
     }
     ls.cr();
   }
diff --git a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
index 850a8b63b4d..8ac2926bb5f 100644
--- a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
+++ b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldHeuristic.cpp
@@ -17,13 +17,19 @@
 // collector in ways that are not compatible with a normal collection run.
 // If these tests take longer than the minimum time between gc intervals -
 // or, more likely, if you have them paused in a debugger longer than this
-// interval - you can expect trouble.
-
+// interval - you can expect trouble. These tests will also not run in a build
+// with asserts enabled because they use APIs that expect to run on a safepoint.
+#ifdef ASSERT
+#define SKIP_IF_NOT_SHENANDOAH()           \
+  tty->print_cr("skipped (debug build)" ); \
+  return;
+#else
 #define SKIP_IF_NOT_SHENANDOAH() \
     if (!UseShenandoahGC) {      \
       tty->print_cr("skipped");  \
       return;                    \
     }
+#endif
 
 class ShenandoahResetRegions : public ShenandoahHeapRegionClosure {
  public:
@@ -45,9 +51,13 @@ class ShenandoahOldHeuristicTest : public ::testing::Test {
   ShenandoahCollectionSet* _collection_set;
 
   ShenandoahOldHeuristicTest()
-    : _heap(ShenandoahHeap::heap()),
-      _heuristics(_heap->old_heuristics()),
-      _collection_set(_heap->collection_set()) {
+    : _heap(nullptr),
+      _heuristics(nullptr),
+      _collection_set(nullptr) {
+    SKIP_IF_NOT_SHENANDOAH();
+    _heap = ShenandoahHeap::heap();
+    _heuristics = _heap->old_heuristics();
+    _collection_set = _heap->collection_set();
     ShenandoahHeapLocker locker(_heap->lock());
     ShenandoahResetRegions reset;
     _heap->heap_region_iterate(&reset);