src/share/vm/runtime/init.cpp

Wed, 11 Aug 2010 05:51:21 -0700

author
twisti
date
Wed, 11 Aug 2010 05:51:21 -0700
changeset 2047
d2ede61b7a12
parent 1999
2a47bd84841f
child 2085
f55c4f82ab9d
permissions
-rw-r--r--

6976186: integrate Shark HotSpot changes
Summary: Shark is a JIT compiler for Zero that uses the LLVM compiler infrastructure.
Reviewed-by: kvn, twisti
Contributed-by: Gary Benson <gbenson@redhat.com>

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

mercurial