changeset 35177:22c9af3d46fd

8145315: VM crashes in print_task_time_stamps() Reviewed-by: jwilhelm, jmasa
author brutisso
date Wed, 16 Dec 2015 09:24:48 +0100
parents 11a9d4022d9e
children 0f532b7cf61c
files hotspot/src/share/vm/gc/parallel/gcTaskThread.cpp
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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