< prev index next >

src/share/vm/runtime/thread.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2016, 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  *


3392                                          vmSymbols::void_method_signature(), CHECK);
3393 }
3394 
3395 // Phase 2. Module system initialization
3396 //     This will initialize the module system.  Only java.base classes
3397 //     can be loaded until phase 2 completes.
3398 //
3399 //     Call System.initPhase2 after the compiler initialization and jsr292
3400 //     classes get initialized because module initialization runs a lot of java
3401 //     code, that for performance reasons, should be compiled.  Also, this will
3402 //     enable the startup code to use lambda and other language features in this
3403 //     phase and onward.
3404 //
3405 //     After phase 2, The VM will begin search classes from -Xbootclasspath/a.
3406 static void call_initPhase2(TRAPS) {
3407   TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, modules, startuptime));
3408 
3409   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
3410   instanceKlassHandle klass (THREAD, k);
3411 
3412   JavaValue result(T_VOID);



3413   JavaCalls::call_static(&result, klass, vmSymbols::initPhase2_name(),
3414                                          vmSymbols::void_method_signature(), CHECK);




3415   universe_post_module_init();
3416 }
3417 
3418 // Phase 3. final setup - set security manager, system class loader and TCCL
3419 //
3420 //     This will instantiate and set the security manager, set the system class
3421 //     loader as well as the thread context class loader.  The security manager
3422 //     and system class loader may be a custom class loaded from -Xbootclasspath/a,
3423 //     other modules or the application's classpath.
3424 static void call_initPhase3(TRAPS) {
3425   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
3426   instanceKlassHandle klass (THREAD, k);
3427 
3428   JavaValue result(T_VOID);
3429   JavaCalls::call_static(&result, klass, vmSymbols::initPhase3_name(),
3430                                          vmSymbols::void_method_signature(), CHECK);
3431 }
3432 
3433 void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
3434   TraceTime timer("Initialize java.lang classes", TRACETIME_LOG(Info, startuptime));


   1 /*
   2  * Copyright (c) 1997, 2017, 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  *


3392                                          vmSymbols::void_method_signature(), CHECK);
3393 }
3394 
3395 // Phase 2. Module system initialization
3396 //     This will initialize the module system.  Only java.base classes
3397 //     can be loaded until phase 2 completes.
3398 //
3399 //     Call System.initPhase2 after the compiler initialization and jsr292
3400 //     classes get initialized because module initialization runs a lot of java
3401 //     code, that for performance reasons, should be compiled.  Also, this will
3402 //     enable the startup code to use lambda and other language features in this
3403 //     phase and onward.
3404 //
3405 //     After phase 2, The VM will begin search classes from -Xbootclasspath/a.
3406 static void call_initPhase2(TRAPS) {
3407   TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, modules, startuptime));
3408 
3409   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
3410   instanceKlassHandle klass (THREAD, k);
3411 
3412   JavaValue result(T_INT);
3413   JavaCallArguments args;
3414   args.push_int(DisplayVMOutputToStderr);
3415   args.push_int(log_is_enabled(Debug, init)); // print stack trace if exception thrown
3416   JavaCalls::call_static(&result, klass, vmSymbols::initPhase2_name(),
3417                                          vmSymbols::boolean_boolean_int_signature(), &args, CHECK);
3418   if (result.get_jint() != JNI_OK) {
3419     vm_exit_during_initialization(); // no message or exception
3420   }
3421 
3422   universe_post_module_init();
3423 }
3424 
3425 // Phase 3. final setup - set security manager, system class loader and TCCL
3426 //
3427 //     This will instantiate and set the security manager, set the system class
3428 //     loader as well as the thread context class loader.  The security manager
3429 //     and system class loader may be a custom class loaded from -Xbootclasspath/a,
3430 //     other modules or the application's classpath.
3431 static void call_initPhase3(TRAPS) {
3432   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
3433   instanceKlassHandle klass (THREAD, k);
3434 
3435   JavaValue result(T_VOID);
3436   JavaCalls::call_static(&result, klass, vmSymbols::initPhase3_name(),
3437                                          vmSymbols::void_method_signature(), CHECK);
3438 }
3439 
3440 void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
3441   TraceTime timer("Initialize java.lang classes", TRACETIME_LOG(Info, startuptime));


< prev index next >