< prev index next >

src/hotspot/share/runtime/init.cpp

Print this page
rev 51967 : 8221392: Reduce ConcurrentGCThreads spinning during start up
Reviewed-by: eosterlund, kbarrett


  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/stringTable.hpp"
  27 #include "classfile/symbolTable.hpp"
  28 #include "code/icBuffer.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "interpreter/bytecodes.hpp"
  31 #include "memory/universe.hpp"
  32 #include "prims/methodHandles.hpp"
  33 #include "runtime/flags/jvmFlag.hpp"
  34 #include "runtime/handles.inline.hpp"
  35 #include "runtime/icache.hpp"
  36 #include "runtime/init.hpp"

  37 #include "runtime/safepoint.hpp"
  38 #include "runtime/sharedRuntime.hpp"
  39 #include "services/memTracker.hpp"
  40 #include "utilities/macros.hpp"
  41 
  42 
  43 // Initialization done by VM thread in vm_init_globals()
  44 void check_ThreadShadow();
  45 void eventlog_init();
  46 void mutex_init();
  47 void chunkpool_init();
  48 void perfMemory_init();
  49 void SuspendibleThreadSet_init();
  50 
  51 // Initialization done by Java thread in init_globals()
  52 void management_init();
  53 void bytecodes_init();
  54 void classLoader_init1();
  55 void compilationPolicy_init();
  56 void codeCache_init();


 163 void exit_globals() {
 164   static bool destructorsCalled = false;
 165   if (!destructorsCalled) {
 166     destructorsCalled = true;
 167     perfMemory_exit();
 168     if (PrintSafepointStatistics) {
 169       // Print the collected safepoint statistics.
 170       SafepointSynchronize::print_stat_on_exit();
 171     }
 172     if (PrintStringTableStatistics) {
 173       SymbolTable::dump(tty);
 174       StringTable::dump(tty);
 175     }
 176     ostream_exit();
 177   }
 178 }
 179 
 180 static volatile bool _init_completed = false;
 181 
 182 bool is_init_completed() {
 183   return _init_completed;
 184 }
 185 






 186 
 187 void set_init_completed() {
 188   assert(Universe::is_fully_initialized(), "Should have completed initialization");
 189   _init_completed = true;


 190 }


  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/stringTable.hpp"
  27 #include "classfile/symbolTable.hpp"
  28 #include "code/icBuffer.hpp"
  29 #include "gc/shared/collectedHeap.hpp"
  30 #include "interpreter/bytecodes.hpp"
  31 #include "memory/universe.hpp"
  32 #include "prims/methodHandles.hpp"
  33 #include "runtime/flags/jvmFlag.hpp"
  34 #include "runtime/handles.inline.hpp"
  35 #include "runtime/icache.hpp"
  36 #include "runtime/init.hpp"
  37 #include "runtime/orderAccess.hpp"
  38 #include "runtime/safepoint.hpp"
  39 #include "runtime/sharedRuntime.hpp"
  40 #include "services/memTracker.hpp"
  41 #include "utilities/macros.hpp"
  42 
  43 
  44 // Initialization done by VM thread in vm_init_globals()
  45 void check_ThreadShadow();
  46 void eventlog_init();
  47 void mutex_init();
  48 void chunkpool_init();
  49 void perfMemory_init();
  50 void SuspendibleThreadSet_init();
  51 
  52 // Initialization done by Java thread in init_globals()
  53 void management_init();
  54 void bytecodes_init();
  55 void classLoader_init1();
  56 void compilationPolicy_init();
  57 void codeCache_init();


 164 void exit_globals() {
 165   static bool destructorsCalled = false;
 166   if (!destructorsCalled) {
 167     destructorsCalled = true;
 168     perfMemory_exit();
 169     if (PrintSafepointStatistics) {
 170       // Print the collected safepoint statistics.
 171       SafepointSynchronize::print_stat_on_exit();
 172     }
 173     if (PrintStringTableStatistics) {
 174       SymbolTable::dump(tty);
 175       StringTable::dump(tty);
 176     }
 177     ostream_exit();
 178   }
 179 }
 180 
 181 static volatile bool _init_completed = false;
 182 
 183 bool is_init_completed() {
 184   return OrderAccess::load_acquire(&_init_completed);
 185 }
 186 
 187 void wait_init_completed() {
 188   MonitorLockerEx ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
 189   while (!_init_completed) {
 190     ml.wait(Monitor::_no_safepoint_check_flag);
 191   }
 192 }
 193 
 194 void set_init_completed() {
 195   assert(Universe::is_fully_initialized(), "Should have completed initialization");
 196   MonitorLockerEx ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
 197   OrderAccess::release_store(&_init_completed, true);
 198   ml.notify_all();
 199 }
< prev index next >