8145315: VM crashes in print_task_time_stamps()
authorbrutisso
Wed, 16 Dec 2015 09:24:48 +0100
changeset 35177 22c9af3d46fd
parent 35176 11a9d4022d9e
child 35178 0f532b7cf61c
8145315: VM crashes in print_task_time_stamps() Reviewed-by: jwilhelm, jmasa
hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp
--- a/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp	Wed Dec 09 14:56:02 2015 +0100
+++ b/hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp	Wed Dec 16 09:24:48 2015 +0100
@@ -152,11 +152,15 @@
         if (log_is_enabled(Debug, gc, task, time)) {
           timer.update();
 
-          GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index++);
+          GCTaskTimeStamp* time_stamp = time_stamp_at(_time_stamp_index);
 
           time_stamp->set_name(name);
           time_stamp->set_entry_time(entry_time);
           time_stamp->set_exit_time(timer.ticks());
+
+          // Update the index after we have set up the entry correctly since
+          // GCTaskThread::print_task_time_stamps() may read this value concurrently.
+          _time_stamp_index++;
         }
       } else {
         // idle tasks complete outside the normal accounting