< prev index next >

src/hotspot/share/runtime/init.cpp

Print this page
*** 21,19 ***
--- 21,23 ---
   * 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"

*** 44,10 ***
--- 48,11 ---
  #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()

*** 98,10 ***
--- 103,12 ---
  // 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();

*** 111,10 ***
--- 118,13 ---
    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);

*** 122,29 ***
    }
  #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
--- 132,30 ---
    }
  #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

*** 182,21 ***
--- 193,28 ---
    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
    MethodHandles::generate_adapters();
+   SystemDictionary::restore_archived_method_handle_intrinsics();
  
    // 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 >