From a476bf01f49c52ee7cf5021eb3c540b8c72b3000 Mon Sep 17 00:00:00 2001 From: David Lindholm Date: Thu, 7 Jan 2016 14:55:12 +0100 Subject: [PATCH] 8146409: TestPromotionFailedEventWithParallelScavenge.java failed with assert(_time_stamps != __null) failed: Sanity Reviewed-by: tschatzl, jwilhelm --- .../src/share/vm/gc/parallel/gcTaskThread.cpp | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp index 47d441a1ce4..f00faf5b7d1 100644 --- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp +++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp @@ -78,19 +78,22 @@ GCTaskTimeStamp* GCTaskThread::time_stamp_at(uint index) { 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