< prev index next > src/hotspot/share/runtime/init.cpp
Print this page
* questions.
*
*/
#include "precompiled.hpp"
+ #include "cds/metaspaceShared.hpp"
#include "classfile/stringTable.hpp"
#include "classfile/symbolTable.hpp"
+ #include "classfile/systemDictionary.hpp"
+ #include "code/SCCache.hpp"
#include "compiler/compiler_globals.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/gcHeapSummary.hpp"
#include "interpreter/bytecodes.hpp"
#include "logging/logAsyncWriter.hpp"
#include "memory/universe.hpp"
#include "nmt/memTracker.hpp"
+ #include "oops/trainingData.hpp"
#include "prims/downcallLinker.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/atomic.hpp"
#include "runtime/continuation.hpp"
#include "runtime/init.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/sharedRuntime.hpp"
#include "sanitizers/leak.hpp"
#include "utilities/macros.hpp"
+ #include "utilities/xmlstream.hpp"
#if INCLUDE_JVMCI
#include "jvmci/jvmci.hpp"
#endif
// Initialization done by VM thread in vm_init_globals()
bool compilerOracle_init();
bool compileBroker_init();
void dependencyContext_init();
void dependencies_init();
+ // initialize upcalls before class loading
+ bool runtimeUpcalls_open_registration();
+ bool runtimeUpcallNop_register_upcalls();
+ #if INCLUDE_CDS
+ bool cdsEndTrainingUpcall_register_upcalls();
+ #endif // INCLUDE_CDS
+ bool runtimeUpcalls_close_registration();
+
// Initialization after compiler initialization
bool universe_post_init(); // must happen after compiler_init
void javaClasses_init(); // must happen after vtable initialization
void compiler_stubs_init(bool in_compiler_thread); // compiler's StubRoutines stubs
void final_stubs_init(); // final StubRoutines stubs
// JNI/JVM/JVMTI functions and signal handlers to work properly
// during VM shutdown
void perfMemory_exit();
void ostream_exit();
+ void perf_jvm_init();
+
void vm_init_globals() {
check_ThreadShadow();
basic_types_init();
eventlog_init();
mutex_init();
ExternalsRecorder_init(); // After mutex_init() and before CodeCache_init
}
jint init_globals() {
+ perf_jvm_init();
+ MethodHandles::init_counters();
+
management_init();
JvmtiExport::initialize_oop_storage();
#if INCLUDE_JVMTI
if (AlwaysRecordEvolDependencies) {
JvmtiExport::set_can_hotswap_or_post_breakpoint(true);
}
#endif
bytecodes_init();
classLoader_init1();
compilationPolicy_init();
codeCache_init();
VM_Version_init(); // depends on codeCache_init for emitting code
// stub routines in initial blob are referenced by later generated code
initial_stubs_init();
// stack overflow exception blob is referenced by the interpreter
SharedRuntime::generate_initial_stubs();
jint status = universe_init(); // dependent on codeCache_init and
// initial_stubs_init and metaspace_init.
if (status != JNI_OK)
return status;
!
#ifdef LEAK_SANITIZER
{
// Register the Java heap with LSan.
VirtualSpaceSummary summary = Universe::heap()->create_heap_space_summary();
LSAN_REGISTER_ROOT_REGION(summary.start(), summary.reserved_size());
}
#endif // LEAK_SANITIZER
!
AsyncLogWriter::initialize();
gc_barrier_stubs_init(); // depends on universe_init, must be before interpreter_init
continuations_init(); // must precede continuation stub generation
continuation_stubs_init(); // depends on continuations_init
#if INCLUDE_JFR
}
#endif
bytecodes_init();
classLoader_init1();
compilationPolicy_init();
+ MetaspaceShared::open_static_archive();
codeCache_init();
VM_Version_init(); // depends on codeCache_init for emitting code
// stub routines in initial blob are referenced by later generated code
initial_stubs_init();
// stack overflow exception blob is referenced by the interpreter
SharedRuntime::generate_initial_stubs();
jint status = universe_init(); // dependent on codeCache_init and
// initial_stubs_init and metaspace_init.
if (status != JNI_OK)
return status;
! SCCache::initialize();
#ifdef LEAK_SANITIZER
{
// Register the Java heap with LSan.
VirtualSpaceSummary summary = Universe::heap()->create_heap_space_summary();
LSAN_REGISTER_ROOT_REGION(summary.start(), summary.reserved_size());
}
#endif // LEAK_SANITIZER
! SCCache::init2(); // depends on universe_init
AsyncLogWriter::initialize();
gc_barrier_stubs_init(); // depends on universe_init, must be before interpreter_init
continuations_init(); // must precede continuation stub generation
continuation_stubs_init(); // depends on continuations_init
#if INCLUDE_JFR
return JNI_OK;
}
jint init_globals2() {
universe2_init(); // dependent on codeCache_init and initial_stubs_init
+
+ // initialize upcalls before class loading / initialization
+ runtimeUpcalls_open_registration();
+ if (!runtimeUpcallNop_register_upcalls()) {
+ return JNI_EINVAL;
+ }
+ #if INCLUDE_CDS
+ if (!cdsEndTrainingUpcall_register_upcalls()) {
+ return JNI_EINVAL;
+ }
+ #endif // INCLUDE_CDS
+ runtimeUpcalls_close_registration();
+
javaClasses_init(); // must happen after vtable initialization, before referenceProcessor_init
interpreter_init_code(); // after javaClasses_init and before any method gets linked
referenceProcessor_init();
jni_handles_init();
#if INCLUDE_VM_STRUCTS
if (EnableJVMCI) {
JVMCI::initialize_globals();
}
#endif
+ if (TrainingData::have_data() || TrainingData::need_data()) {
+ TrainingData::initialize();
+ }
+
if (!universe_post_init()) {
return JNI_ERR;
}
compiler_stubs_init(false /* in_compiler_thread */); // compiler's intrinsics stubs
final_stubs_init(); // final StubRoutines stubs
// All the flags that get adjusted by VM_Version_init and os::init_2
// have been set so dump the flags now.
if (PrintFlagsFinal || PrintFlagsRanges) {
JVMFlag::printFlags(tty, false, PrintFlagsRanges);
+ } else if (RecordTraining && xtty != nullptr) {
+ JVMFlag::printFlags(xtty->log_only(), false, PrintFlagsRanges);
}
return JNI_OK;
}
< prev index next >