src/share/vm/runtime/init.cpp

Thu, 05 Jun 2008 15:57:56 -0700

author
ysr
date
Thu, 05 Jun 2008 15:57:56 -0700
changeset 777
37f87013dfd8
parent 548
ba764ed4b6f2
child 631
d1605aabd0a1
permissions
-rw-r--r--

6711316: Open source the Garbage-First garbage collector
Summary: First mercurial integration of the code for the Garbage-First garbage collector.
Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr

duke@435 1 /*
duke@435 2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
duke@435 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@435 20 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@435 21 * have any questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 # include "incls/_precompiled.incl"
duke@435 26 # include "incls/_init.cpp.incl"
duke@435 27
duke@435 28 // Initialization done by VM thread in vm_init_globals()
duke@435 29 void check_ThreadShadow();
duke@435 30 void eventlog_init();
duke@435 31 void mutex_init();
duke@435 32 void chunkpool_init();
duke@435 33 void perfMemory_init();
duke@435 34
duke@435 35 // Initialization done by Java thread in init_globals()
duke@435 36 void management_init();
duke@435 37 void vtune_init();
duke@435 38 void bytecodes_init();
duke@435 39 void classLoader_init();
duke@435 40 void codeCache_init();
duke@435 41 void VM_Version_init();
duke@435 42 void JDK_Version_init();
duke@435 43 void stubRoutines_init1();
duke@435 44 jint universe_init(); // dependent on codeCache_init and stubRoutines_init
duke@435 45 void interpreter_init(); // before any methods loaded
duke@435 46 void invocationCounter_init(); // before any methods loaded
duke@435 47 void marksweep_init();
duke@435 48 void accessFlags_init();
duke@435 49 void templateTable_init();
duke@435 50 void InterfaceSupport_init();
duke@435 51 void universe2_init(); // dependent on codeCache_init and stubRoutines_init
duke@435 52 void referenceProcessor_init();
duke@435 53 void jni_handles_init();
duke@435 54 void vmStructs_init();
duke@435 55
duke@435 56 void vtableStubs_init();
duke@435 57 void InlineCacheBuffer_init();
duke@435 58 void compilerOracle_init();
duke@435 59 void compilationPolicy_init();
duke@435 60
duke@435 61
duke@435 62 // Initialization after compiler initialization
duke@435 63 bool universe_post_init(); // must happen after compiler_init
duke@435 64 void javaClasses_init(); // must happen after vtable initialization
duke@435 65 void stubRoutines_init2(); // note: StubRoutines need 2-phase init
duke@435 66
duke@435 67 // Do not disable thread-local-storage, as it is important for some
duke@435 68 // JNI/JVM/JVMTI functions and signal handlers to work properly
duke@435 69 // during VM shutdown
duke@435 70 void perfMemory_exit();
duke@435 71 void ostream_exit();
duke@435 72
duke@435 73 void vm_init_globals() {
duke@435 74 check_ThreadShadow();
coleenp@548 75 basic_types_init();
duke@435 76 eventlog_init();
duke@435 77 mutex_init();
duke@435 78 chunkpool_init();
duke@435 79 perfMemory_init();
duke@435 80 }
duke@435 81
duke@435 82
duke@435 83 jint init_globals() {
duke@435 84 HandleMark hm;
duke@435 85 management_init();
duke@435 86 vtune_init();
duke@435 87 bytecodes_init();
duke@435 88 classLoader_init();
duke@435 89 codeCache_init();
duke@435 90 VM_Version_init();
duke@435 91 JDK_Version_init();
duke@435 92 stubRoutines_init1();
duke@435 93 jint status = universe_init(); // dependent on codeCache_init and stubRoutines_init
duke@435 94 if (status != JNI_OK)
duke@435 95 return status;
duke@435 96
duke@435 97 interpreter_init(); // before any methods loaded
duke@435 98 invocationCounter_init(); // before any methods loaded
duke@435 99 marksweep_init();
duke@435 100 accessFlags_init();
duke@435 101 templateTable_init();
duke@435 102 InterfaceSupport_init();
duke@435 103 SharedRuntime::generate_stubs();
duke@435 104 universe2_init(); // dependent on codeCache_init and stubRoutines_init
duke@435 105 referenceProcessor_init();
duke@435 106 jni_handles_init();
duke@435 107 #ifndef VM_STRUCTS_KERNEL
duke@435 108 vmStructs_init();
duke@435 109 #endif // VM_STRUCTS_KERNEL
duke@435 110
duke@435 111 vtableStubs_init();
duke@435 112 InlineCacheBuffer_init();
duke@435 113 compilerOracle_init();
duke@435 114 compilationPolicy_init();
duke@435 115 VMRegImpl::set_regName();
duke@435 116
duke@435 117 if (!universe_post_init()) {
duke@435 118 return JNI_ERR;
duke@435 119 }
duke@435 120 javaClasses_init(); // must happen after vtable initialization
duke@435 121 stubRoutines_init2(); // note: StubRoutines need 2-phase init
duke@435 122
duke@435 123 // Although we'd like to, we can't easily do a heap verify
duke@435 124 // here because the main thread isn't yet a JavaThread, so
duke@435 125 // its TLAB may not be made parseable from the usual interfaces.
duke@435 126 if (VerifyBeforeGC && !UseTLAB &&
duke@435 127 Universe::heap()->total_collections() >= VerifyGCStartAt) {
duke@435 128 Universe::heap()->prepare_for_verify();
duke@435 129 Universe::verify(); // make sure we're starting with a clean slate
duke@435 130 }
duke@435 131
duke@435 132 return JNI_OK;
duke@435 133 }
duke@435 134
duke@435 135
duke@435 136 void exit_globals() {
duke@435 137 static bool destructorsCalled = false;
duke@435 138 if (!destructorsCalled) {
duke@435 139 destructorsCalled = true;
duke@435 140 perfMemory_exit();
duke@435 141 if (PrintSafepointStatistics) {
duke@435 142 // Print the collected safepoint statistics.
duke@435 143 SafepointSynchronize::print_stat_on_exit();
duke@435 144 }
duke@435 145 ostream_exit();
duke@435 146 }
duke@435 147 }
duke@435 148
duke@435 149
duke@435 150 static bool _init_completed = false;
duke@435 151
duke@435 152 bool is_init_completed() {
duke@435 153 return _init_completed;
duke@435 154 }
duke@435 155
duke@435 156
duke@435 157 void set_init_completed() {
duke@435 158 _init_completed = true;
duke@435 159 }

mercurial