8219976: GarbageCollectionNotificationInfo always says "No GC" when running Shenandoah
authorzgu
Sat, 02 Mar 2019 08:33:32 -0500
changeset 53980 f3fd73c3a077
parent 53979 70c7c4db9c9a
child 53981 d489081c5650
8219976: GarbageCollectionNotificationInfo always says "No GC" when running Shenandoah Reviewed-by: rkennke
src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp	Sat Mar 02 11:42:04 2019 +0300
+++ b/src/hotspot/share/gc/shenandoah/shenandoahUtils.cpp	Sat Mar 02 08:33:32 2019 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
@@ -44,13 +44,14 @@
   assert(!ShenandoahGCPhase::is_valid_phase(ShenandoahGCPhase::current_phase()),
     "No current GC phase");
 
+  _heap->set_gc_cause(cause);
   _timer->register_gc_start();
   _tracer->report_gc_start(cause, _timer->gc_start());
   _heap->trace_heap(GCWhen::BeforeGC, _tracer);
 
   _heap->shenandoah_policy()->record_cycle_start();
   _heap->heuristics()->record_cycle_start();
-  _trace_cycle.initialize(_heap->cycle_memory_manager(), _heap->gc_cause(),
+  _trace_cycle.initialize(_heap->cycle_memory_manager(), cause,
           /* allMemoryPoolsAffected */    true,
           /* recordGCBeginTime = */       true,
           /* recordPreGCUsage = */        true,
@@ -69,6 +70,7 @@
   _tracer->report_gc_end(_timer->gc_end(), _timer->time_partitions());
   assert(!ShenandoahGCPhase::is_valid_phase(ShenandoahGCPhase::current_phase()),
     "No current GC phase");
+  _heap->set_gc_cause(GCCause::_no_gc);
 }
 
 ShenandoahGCPauseMark::ShenandoahGCPauseMark(uint gc_id, SvcGCMarker::reason_type type) :