diff a/src/hotspot/share/gc/shenandoah/shenandoahVMOperations.cpp b/src/hotspot/share/gc/shenandoah/shenandoahVMOperations.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahVMOperations.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahVMOperations.cpp
@@ -25,30 +25,49 @@
 #include "precompiled.hpp"
 
 #include "gc/shenandoah/shenandoahConcurrentGC.hpp"
 #include "gc/shenandoah/shenandoahDegeneratedGC.hpp"
 #include "gc/shenandoah/shenandoahFullGC.hpp"
+#include "gc/shenandoah/shenandoahGeneration.hpp"
 #include "gc/shenandoah/shenandoahHeap.inline.hpp"
 #include "gc/shenandoah/shenandoahMark.inline.hpp"
 #include "gc/shenandoah/shenandoahOopClosures.inline.hpp"
 #include "gc/shenandoah/shenandoahUtils.hpp"
 #include "gc/shenandoah/shenandoahVMOperations.hpp"
 #include "interpreter/oopMapCache.hpp"
+#include "logging/log.hpp"
 #include "memory/universe.hpp"
 
 bool VM_ShenandoahOperation::doit_prologue() {
+  log_active_generation("Prologue");
   assert(!ShenandoahHeap::heap()->has_gc_state_changed(), "GC State can only be changed on a safepoint.");
   return true;
 }
 
 void VM_ShenandoahOperation::doit_epilogue() {
+  log_active_generation("Epilogue");
   assert(!ShenandoahHeap::heap()->has_gc_state_changed(), "GC State was not synchronized to java threads.");
   // GC thread root traversal likely used OopMapCache a lot, which
   // might have created lots of old entries. Trigger the cleanup now.
   OopMapCache::try_trigger_cleanup();
 }
 
+void VM_ShenandoahOperation::log_active_generation(const char* prefix) {
+  ShenandoahGeneration* agen = ShenandoahHeap::heap()->active_generation();
+  ShenandoahGeneration* ggen = ShenandoahHeap::heap()->gc_generation();
+  log_debug(gc, heap)("%s: active_generation is %s, gc_generation is %s", prefix,
+                      agen == nullptr ? "nullptr" : shenandoah_generation_name(agen->type()),
+                      ggen == nullptr ? "nullptr" : shenandoah_generation_name(ggen->type()));
+}
+
+void VM_ShenandoahOperation::set_active_generation() {
+  if (evaluate_at_safepoint()) {
+    assert(SafepointSynchronize::is_at_safepoint(), "Error??");
+    ShenandoahHeap::heap()->set_active_generation();
+  }
+}
+
 bool VM_ShenandoahReferenceOperation::doit_prologue() {
   VM_ShenandoahOperation::doit_prologue();
   Heap_lock->lock();
   return true;
 }
@@ -61,44 +80,51 @@
   Heap_lock->unlock();
 }
 
 void VM_ShenandoahInitMark::doit() {
   ShenandoahGCPauseMark mark(_gc_id, "Init Mark", SvcGCMarker::CONCURRENT);
+  set_active_generation();
   _gc->entry_init_mark();
   ShenandoahHeap::heap()->propagate_gc_state_to_java_threads();
 }
 
 void VM_ShenandoahFinalMarkStartEvac::doit() {
   ShenandoahGCPauseMark mark(_gc_id, "Final Mark", SvcGCMarker::CONCURRENT);
+  set_active_generation();
   _gc->entry_final_mark();
   ShenandoahHeap::heap()->propagate_gc_state_to_java_threads();
 }
 
 void VM_ShenandoahFullGC::doit() {
   ShenandoahGCPauseMark mark(_gc_id, "Full GC", SvcGCMarker::FULL);
+  set_active_generation();
   _full_gc->entry_full(_gc_cause);
   ShenandoahHeap::heap()->propagate_gc_state_to_java_threads();
 }
 
 void VM_ShenandoahDegeneratedGC::doit() {
   ShenandoahGCPauseMark mark(_gc_id, "Degenerated GC", SvcGCMarker::CONCURRENT);
+  set_active_generation();
   _gc->entry_degenerated();
   ShenandoahHeap::heap()->propagate_gc_state_to_java_threads();
 }
 
 void VM_ShenandoahInitUpdateRefs::doit() {
   ShenandoahGCPauseMark mark(_gc_id, "Init Update Refs", SvcGCMarker::CONCURRENT);
+  set_active_generation();
   _gc->entry_init_updaterefs();
   ShenandoahHeap::heap()->propagate_gc_state_to_java_threads();
 }
 
 void VM_ShenandoahFinalUpdateRefs::doit() {
   ShenandoahGCPauseMark mark(_gc_id, "Final Update Refs", SvcGCMarker::CONCURRENT);
+  set_active_generation();
   _gc->entry_final_updaterefs();
   ShenandoahHeap::heap()->propagate_gc_state_to_java_threads();
 }
 
 void VM_ShenandoahFinalRoots::doit() {
   ShenandoahGCPauseMark mark(_gc_id, "Final Roots", SvcGCMarker::CONCURRENT);
+  set_active_generation();
   _gc->entry_final_roots();
   ShenandoahHeap::heap()->propagate_gc_state_to_java_threads();
 }
