8146409: TestPromotionFailedEventWithParallelScavenge.java failed with assert(_time_stamps != __null) failed: Sanity
authordavid
Thu, 07 Jan 2016 14:55:12 +0100
changeset 35460 1fca55136d66
parent 35459 e5554d76304a
child 35461 1068dcb8d315
8146409: TestPromotionFailedEventWithParallelScavenge.java failed with assert(_time_stamps != __null) failed: Sanity Reviewed-by: tschatzl, jwilhelm
hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp	Tue Jan 05 10:36:34 2016 -0800
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp	Thu Jan 07 14:55:12 2016 +0100
@@ -78,19 +78,22 @@
 
 void GCTaskThread::print_task_time_stamps() {
   assert(log_is_enabled(Debug, gc, task, time), "Sanity");
-  assert(_time_stamps != NULL, "Sanity");
 
-  log_debug(gc, task, time)("GC-Thread %u entries: %d", id(), _time_stamp_index);
-  for(uint i=0; i<_time_stamp_index; i++) {
-    GCTaskTimeStamp* time_stamp = time_stamp_at(i);
-    log_debug(gc, task, time)("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
-                              time_stamp->name(),
-                              time_stamp->entry_time(),
-                              time_stamp->exit_time());
+  // Since _time_stamps is now lazily allocated we need to check that it
+  // has in fact been allocated when calling this function.
+  if (_time_stamps != NULL) {
+    log_debug(gc, task, time)("GC-Thread %u entries: %d", id(), _time_stamp_index);
+    for(uint i=0; i<_time_stamp_index; i++) {
+      GCTaskTimeStamp* time_stamp = time_stamp_at(i);
+      log_debug(gc, task, time)("\t[ %s " JLONG_FORMAT " " JLONG_FORMAT " ]",
+                                time_stamp->name(),
+                                time_stamp->entry_time(),
+                                time_stamp->exit_time());
+    }
+
+    // Reset after dumping the data
+    _time_stamp_index = 0;
   }
-
-  // Reset after dumping the data
-  _time_stamp_index = 0;
 }
 
 // GC workers get tasks from the GCTaskManager and execute