Пример #1
0
jint init_globals() {
  HandleMark hm;
  management_init();
  bytecodes_init();
  classLoader_init();
  codeCache_init();
  VM_Version_init();
  os_init_globals();
  stubRoutines_init1();
  jint status = universe_init();  // dependent on codeCache_init and
                                  // stubRoutines_init1
  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_init1
  referenceProcessor_init();
  jni_handles_init();
#ifndef VM_STRUCTS_KERNEL
  vmStructs_init();
#endif // VM_STRUCTS_KERNEL

  vtableStubs_init();
  InlineCacheBuffer_init();
  compilerOracle_init();
  compilationPolicy_init();
  compileBroker_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
  }

  // All the flags that get adjusted by VM_Version_init and os::init_2
  // have been set so dump the flags now.
  if (PrintFlagsFinal) {
    CommandLineFlags::printFlags(tty, false);
  }

  return JNI_OK;
}
Пример #2
0
jint init_globals() {
  HandleMark hm;
  management_init();
  bytecodes_init();
  classLoader_init();
  codeCache_init();
  VM_Version_init();
  os_init_globals();
  stubRoutines_init1();
  jint status = universe_init();  // dependent on codeCache_init and
                                  // stubRoutines_init1 and metaspace_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_init1
  referenceProcessor_init();
  jni_handles_init();
#if INCLUDE_VM_STRUCTS
  vmStructs_init();
#endif // INCLUDE_VM_STRUCTS

  vtableStubs_init();
  InlineCacheBuffer_init();
  compilerOracle_init();
  compilationPolicy_init();
  compileBroker_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

  // All the flags that get adjusted by VM_Version_init and os::init_2
  // have been set so dump the flags now.
  if (PrintFlagsFinal) {
    CommandLineFlags::printFlags(tty, false);
  }

  return JNI_OK;
}
Пример #3
0
jint init_globals() {
  HandleMark hm;
  management_init();
  bytecodes_init();
  classLoader_init1();
  compilationPolicy_init();
  codeCache_init();
  CodeCacheExtensions::initialize();
  VM_Version_init();
  CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::VMVersion);
  os_init_globals();
  stubRoutines_init1();
  CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::StubRoutines1);
  jint status = universe_init();  // dependent on codeCache_init and
                                  // stubRoutines_init1 and metaspace_init.
  if (status != JNI_OK)
    return status;

  CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::Universe);
  interpreter_init();  // before any methods loaded
  CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::Interpreter);
  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_init1
  referenceProcessor_init();
  jni_handles_init();
#if INCLUDE_VM_STRUCTS
  vmStructs_init();
#endif // INCLUDE_VM_STRUCTS

  vtableStubs_init();
  InlineCacheBuffer_init();
  compilerOracle_init();
  dependencyContext_init();

  if (!compileBroker_init()) {
    return JNI_EINVAL;
  }
  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
  MethodHandles::generate_adapters();
  CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::StubRoutines2);

#if INCLUDE_NMT
  // Solaris stack is walkable only after stubRoutines are set up.
  // On Other platforms, the stack is always walkable.
  NMT_stack_walkable = true;
#endif // INCLUDE_NMT

  // 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) {
    CommandLineFlags::printFlags(tty, false, PrintFlagsRanges);
  }

  CodeCacheExtensions::complete_step(CodeCacheExtensionsSteps::InitGlobals);
  return JNI_OK;
}
Пример #4
0
jint init_globals() {

  HandleMark hm;
  // 初始化各子系统的监控及管理服务
  // JMX、线程和同步子系统、类加载子系统的监控和管理
  management_init();
  // 初始化字节码表,如istore、iload、iadd
  bytecodes_init();
  // 类加载器初始化
  classLoader_init();
  // 代码缓存池初始化
  codeCache_init();
  // VM版本初始化
  VM_Version_init();
  // 系统初始化
  os_init_globals();
  stubRoutines_init1();
  // ============================
  // 初始化堆以及决定所使用GC策略
  // ============================
  jint status = universe_init();  // dependent on codeCache_init and
                                  // stubRoutines_init1
  if (status != JNI_OK)
    return status;
  // 初始化解析器
  interpreter_init();  // before any methods loaded
  // 初始化动作触发器
  invocationCounter_init();  // before any methods loaded
  // 初始化MarkSweep
  marksweep_init();
  // 初始化访问标识
  accessFlags_init();
  // 初始化操作码模板表
  templateTable_init();
  // 接口支持提供了VM_LEAF_BASE和VM_ENTRY_BASE宏
  InterfaceSupport_init();
  SharedRuntime::generate_stubs();
  // 初始化语法表及系统字典等
  universe2_init();  // dependent on codeCache_init and stubRoutines_init1
  // 初始化软引用时间戳表并设定软引用清除策略
  referenceProcessor_init();
  jni_handles_init();
  // 代码数据结构的必要性检查(仅限debug版本)
  vmStructs_init();
  vtableStubs_init();
  InlineCacheBuffer_init();
  // oracle编译器初始化(oracle编译器是一个编译器开关接口)
  compilerOracle_init();
  // 初始化编译策略(根据启动参数决定编译策略)
  compilationPolicy_init();
  compileBroker_init();
  VMRegImpl::set_regName();
  // 执行初始化
  if (!universe_post_init()) {
    return JNI_ERR;
  }
  // 计算各种filed的偏移量??
  javaClasses_init();   // must happen after vtable initialization
  stubRoutines_init2(); // note: StubRoutines need 2-phase init

  // All the flags that get adjusted by VM_Version_init and os::init_2
  // have been set so dump the flags now.
  if (PrintFlagsFinal) {
    CommandLineFlags::printFlags(tty, false);
  }

  return JNI_OK;
}