# HG changeset patch # User acorn # Date 1254155272 14400 # Node ID bd61a7ea190750511071318aaa41a3d6daee2958 # Parent fa1565f1aa3d65bf659f53543fecc373b515064f# Parent 7be2d5b3b15c04b406998186a843c5b215d04521 Merge diff -r fa1565f1aa3d -r bd61a7ea1907 hotspot/src/share/vm/runtime/safepoint.cpp --- a/hotspot/src/share/vm/runtime/safepoint.cpp Fri Sep 25 04:39:54 2009 -0700 +++ b/hotspot/src/share/vm/runtime/safepoint.cpp Mon Sep 28 12:27:52 2009 -0400 @@ -81,6 +81,14 @@ jlong safepoint_limit_time; timeout_error_printed = false; + // PrintSafepointStatisticsTimeout can be specified separately. When + // specified, PrintSafepointStatistics will be set to true in + // deferred_initialize_stat method. The initialization has to be done + // early enough to avoid any races. See bug 6880029 for details. + if (PrintSafepointStatistics || PrintSafepointStatisticsTimeout > 0) { + deferred_initialize_stat(); + } + // Begin the process of bringing the system to a safepoint. // Java threads can be in several different states and are // stopped by different mechanisms: @@ -169,8 +177,7 @@ } } - if ( (PrintSafepointStatistics || (PrintSafepointStatisticsTimeout > 0)) - && iterations == 0) { + if (PrintSafepointStatistics && iterations == 0) { begin_statistics(nof_threads, still_running); } @@ -1026,8 +1033,7 @@ } void SafepointSynchronize::begin_statistics(int nof_threads, int nof_running) { - deferred_initialize_stat(); - + assert(init_done, "safepoint statistics array hasn't been initialized"); SafepointStats *spstat = &_safepoint_stats[_cur_stat_index]; VM_Operation *op = VMThread::vm_operation();