jvm 初始化

本文详细介绍了Java虚拟机启动时全局变量初始化的过程,包括基本类型初始化、事件日志初始化、互斥锁初始化等关键步骤,并阐述了类加载器、字节码、运行时数据区等核心组件的初始化流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

void vm_init_globals() {
check_ThreadShadow();
basic_types_init();
eventlog_init();
mutex_init();
chunkpool_init();
perfMemory_init();
}


jint init_globals() {
HandleMark hm;
management_init();
vtune_init();
bytecodes_init();
classLoader_init();
codeCache_init();
VM_Version_init();
stubRoutines_init1();
jint status = universe_init(); // dependent on codeCache_init and stubRoutines_init
if (status != JNI_OK)
return status;

interpreter_init(); // before any methods loaded
invocationCounter_init(); // before any methods loaded
marksweep_init();
accessFlags_init();
templateTable_init();
InterfaceSupport_init();
SharedRuntime::generate_stubs();
universe2_init(); // dependent on codeCache_init and stubRoutines_init
referenceProcessor_init();
jni_handles_init();
#ifndef VM_STRUCTS_KERNEL
vmStructs_init();
#endif // VM_STRUCTS_KERNEL

vtableStubs_init();
InlineCacheBuffer_init();
compilerOracle_init();
compilationPolicy_init();
VMRegImpl::set_regName();

if (!universe_post_init()) {
return JNI_ERR;
}
javaClasses_init(); // must happen after vtable initialization
stubRoutines_init2(); // note: StubRoutines need 2-phase init

// Although we'd like to, we can't easily do a heap verify
// here because the main thread isn't yet a JavaThread, so
// its TLAB may not be made parseable from the usual interfaces.
if (VerifyBeforeGC && !UseTLAB &&
Universe::heap()->total_collections() >= VerifyGCStartAt) {
Universe::heap()->prepare_for_verify();
Universe::verify(); // make sure we're starting with a clean slate
}

return JNI_OK;
}


void exit_globals() {
static bool destructorsCalled = false;
if (!destructorsCalled) {
destructorsCalled = true;
perfMemory_exit();
if (PrintSafepointStatistics) {
// Print the collected safepoint statistics.
SafepointSynchronize::print_stat_on_exit();
}
ostream_exit();
}
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值