changeset 4356:6f73a3a47ba4

8011699: CMS: assert(_shared_gc_info.id() != SharedGCInfo::UNSET_GCID) failed: GC not started? Reviewed-by: stefank, mgerdin
author ehelin
date Thu, 11 Apr 2013 00:02:45 +0200
parents 97f2e3ceb67c
children 7c942384867f
files src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
diffstat 3 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Apr 10 09:43:53 2013 +0200
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Apr 11 00:02:45 2013 +0200
@@ -2205,6 +2205,7 @@
     } else {
       assert(_collectorState == Idling, "Should be idling before start.");
       _collectorState = InitialMarking;
+      register_gc_start(GCCause::_cms_concurrent_mark);
       // Reset the expansion cause, now that we are about to begin
       // a new cycle.
       clear_expansion_cause();
@@ -2427,13 +2428,16 @@
   }
 }
 
+void CMSCollector::register_foreground_gc_start(GCCause::Cause cause) {
+  if (!_cms_start_registered) {
+    register_gc_start(cause);
+  }
+}
+
 void CMSCollector::register_gc_start(GCCause::Cause cause) {
   _cms_start_registered = true;
   _gc_timer_cm->register_gc_start(os::elapsed_counter());
   _gc_tracer_cm->report_gc_start(cause, _gc_timer_cm->gc_start());
-
-  save_heap_summary();
-  report_heap_summary(GCWhen::BeforeGC);
 }
 
 void CMSCollector::register_gc_end() {
@@ -2489,7 +2493,7 @@
     }
     switch (_collectorState) {
       case InitialMarking:
-        register_gc_start(GenCollectedHeap::heap()->gc_cause());
+        register_foreground_gc_start(GenCollectedHeap::heap()->gc_cause());
         init_mark_was_synchronous = true;  // fact to be exploited in re-mark
         checkpointRootsInitial(false);
         assert(_collectorState == Marking, "Collector state should have changed"
@@ -3527,6 +3531,9 @@
   check_correct_thread_executing();
   TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
 
+  save_heap_summary();
+  report_heap_summary(GCWhen::BeforeGC);
+
   ReferenceProcessor* rp = ref_processor();
   SpecializationStats::clear();
   assert(_restart_addr == NULL, "Control point invariant");
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Wed Apr 10 09:43:53 2013 +0200
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Thu Apr 11 00:02:45 2013 +0200
@@ -621,6 +621,7 @@
   GCHeapSummary _last_heap_summary;
   PermGenSummary _last_perm_gen_summary;
 
+  void register_foreground_gc_start(GCCause::Cause cause);
   void register_gc_start(GCCause::Cause cause);
   void register_gc_end();
   void save_heap_summary();
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Wed Apr 10 09:43:53 2013 +0200
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Thu Apr 11 00:02:45 2013 +0200
@@ -145,7 +145,6 @@
                                 );
 #endif /* USDT2 */
 
-  _collector->register_gc_start(GCCause::_cms_concurrent_mark);
   _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark", os::elapsed_counter());
 
   GenCollectedHeap* gch = GenCollectedHeap::heap();