< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page

  50 #include "gc/shared/tlab_globals.hpp"
  51 #include "logging/log.hpp"
  52 #include "logging/logStream.hpp"
  53 #include "memory/memoryReserver.hpp"
  54 #include "memory/metadataFactory.hpp"
  55 #include "memory/metaspaceClosure.hpp"
  56 #include "memory/metaspaceCounters.hpp"
  57 #include "memory/metaspaceUtils.hpp"
  58 #include "memory/oopFactory.hpp"
  59 #include "memory/resourceArea.hpp"
  60 #include "memory/universe.hpp"
  61 #include "oops/compressedOops.hpp"
  62 #include "oops/instanceKlass.hpp"
  63 #include "oops/instanceMirrorKlass.hpp"
  64 #include "oops/jmethodIDTable.hpp"
  65 #include "oops/klass.inline.hpp"
  66 #include "oops/objArrayOop.inline.hpp"
  67 #include "oops/objLayout.hpp"
  68 #include "oops/oop.inline.hpp"
  69 #include "oops/oopHandle.inline.hpp"

  70 #include "oops/typeArrayKlass.hpp"
  71 #include "prims/resolvedMethodTable.hpp"
  72 #include "runtime/arguments.hpp"
  73 #include "runtime/atomicAccess.hpp"
  74 #include "runtime/cpuTimeCounters.hpp"
  75 #include "runtime/flags/jvmFlagLimit.hpp"
  76 #include "runtime/handles.inline.hpp"
  77 #include "runtime/init.hpp"
  78 #include "runtime/java.hpp"
  79 #include "runtime/javaThread.hpp"
  80 #include "runtime/jniHandles.hpp"
  81 #include "runtime/threads.hpp"
  82 #include "runtime/timerTrace.hpp"
  83 #include "sanitizers/leak.hpp"
  84 #include "services/cpuTimeUsage.hpp"
  85 #include "services/memoryService.hpp"
  86 #include "utilities/align.hpp"
  87 #include "utilities/autoRestore.hpp"
  88 #include "utilities/debug.hpp"
  89 #include "utilities/formatBuffer.hpp"

  97 // interacts with the RedefineClasses API.
  98 class LatestMethodCache {
  99   // We save the InstanceKlass* and the idnum of Method* in order to get
 100   // the current Method*.
 101   InstanceKlass*        _klass;
 102   int                   _method_idnum;
 103 
 104  public:
 105   LatestMethodCache()   { _klass = nullptr; _method_idnum = -1; }
 106 
 107   void init(JavaThread* current, InstanceKlass* ik, const char* method,
 108             Symbol* signature, bool is_static);
 109   Method* get_method();
 110 };
 111 
 112 static LatestMethodCache _finalizer_register_cache;         // Finalizer.register()
 113 static LatestMethodCache _loader_addClass_cache;            // ClassLoader.addClass()
 114 static LatestMethodCache _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError()
 115 static LatestMethodCache _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError()
 116 static LatestMethodCache _do_stack_walk_cache;              // AbstractStackWalker.doStackWalk()



 117 
 118 // Known objects
 119 TypeArrayKlass* Universe::_typeArrayKlasses[T_LONG+1] = { nullptr /*, nullptr...*/ };
 120 ObjArrayKlass* Universe::_objectArrayKlass            = nullptr;
 121 Klass* Universe::_fillerArrayKlass                    = nullptr;
 122 OopHandle Universe::_basic_type_mirrors[T_VOID+1];
 123 #if INCLUDE_CDS_JAVA_HEAP
 124 int Universe::_archived_basic_type_mirror_indices[T_VOID+1];
 125 #endif
 126 
 127 OopHandle Universe::_main_thread_group;
 128 OopHandle Universe::_system_thread_group;
 129 OopHandle Universe::_the_empty_class_array;
 130 OopHandle Universe::_the_null_string;
 131 OopHandle Universe::_the_min_jint_string;
 132 
 133 OopHandle Universe::_the_null_sentinel;
 134 
 135 // _out_of_memory_errors is an objArray
 136 enum OutOfMemoryInstance { _oom_java_heap,

 442     vmSymbols::initialize();
 443 
 444     // Initialize table for matching jmethodID, before SystemDictionary.
 445     JmethodIDTable::initialize();
 446 
 447     SystemDictionary::initialize(CHECK);
 448 
 449     // Create string constants
 450     oop s = StringTable::intern("null", CHECK);
 451     _the_null_string = OopHandle(vm_global(), s);
 452     s = StringTable::intern("-2147483648", CHECK);
 453     _the_min_jint_string = OopHandle(vm_global(), s);
 454 
 455 #if INCLUDE_CDS
 456     if (CDSConfig::is_using_archive()) {
 457       // Verify shared interfaces array.
 458       assert(_the_array_interfaces_array->at(0) ==
 459              vmClasses::Cloneable_klass(), "u3");
 460       assert(_the_array_interfaces_array->at(1) ==
 461              vmClasses::Serializable_klass(), "u3");

 462     } else
 463 #endif
 464     {
 465       // Set up shared interfaces array.  (Do this before supers are set up.)
 466       _the_array_interfaces_array->at_put(0, vmClasses::Cloneable_klass());
 467       _the_array_interfaces_array->at_put(1, vmClasses::Serializable_klass());
 468     }
 469 
 470     _the_array_interfaces_bitmap = Klass::compute_secondary_supers_bitmap(_the_array_interfaces_array);
 471     _the_empty_klass_bitmap      = Klass::compute_secondary_supers_bitmap(_the_empty_klass_array);
 472 
 473     initialize_basic_type_klass(_fillerArrayKlass, CHECK);
 474 
 475     initialize_basic_type_klass(boolArrayKlass(), CHECK);
 476     initialize_basic_type_klass(charArrayKlass(), CHECK);
 477     initialize_basic_type_klass(floatArrayKlass(), CHECK);
 478     initialize_basic_type_klass(doubleArrayKlass(), CHECK);
 479     initialize_basic_type_klass(byteArrayKlass(), CHECK);
 480     initialize_basic_type_klass(shortArrayKlass(), CHECK);
 481     initialize_basic_type_klass(intArrayKlass(), CHECK);

 489     Handle tns = java_lang_String::create_from_str("<null_sentinel>", CHECK);
 490     _the_null_sentinel = OopHandle(vm_global(), tns());
 491   }
 492 
 493   // Create a handle for reference_pending_list
 494   _reference_pending_list = OopHandle(vm_global(), nullptr);
 495 
 496   // Maybe this could be lifted up now that object array can be initialized
 497   // during the bootstrapping.
 498 
 499   // OLD
 500   // Initialize _objectArrayKlass after core bootstraping to make
 501   // sure the super class is set up properly for _objectArrayKlass.
 502   // ---
 503   // NEW
 504   // Since some of the old system object arrays have been converted to
 505   // ordinary object arrays, _objectArrayKlass will be loaded when
 506   // SystemDictionary::initialize(CHECK); is run. See the extra check
 507   // for Object_klass_is_loaded in ObjArrayKlass::allocate_objArray_klass.
 508   {
 509     Klass* oak = vmClasses::Object_klass()->array_klass(CHECK);
 510     _objectArrayKlass = ObjArrayKlass::cast(oak);




 511   }
 512   // OLD
 513   // Add the class to the class hierarchy manually to make sure that
 514   // its vtable is initialized after core bootstrapping is completed.
 515   // ---
 516   // New
 517   // Have already been initialized.
 518   _objectArrayKlass->append_to_sibling_list();
 519 
 520   #ifdef ASSERT
 521   if (FullGCALot) {
 522     // Allocate an array of dummy objects.
 523     // We'd like these to be at the bottom of the old generation,
 524     // so that when we free one and then collect,
 525     // (almost) the whole heap moves
 526     // and we find out if we actually update all the oops correctly.
 527     // But we can't allocate directly in the old generation,
 528     // so we allocate wherever, and hope that the first collection
 529     // moves these objects to the bottom of the old generation.
 530     int size = FullGCALotDummies * 2;
 531 
 532     objArrayOop    naked_array = oopFactory::new_objArray(vmClasses::Object_klass(), size, CHECK);
 533     objArrayHandle dummy_array(THREAD, naked_array);
 534     int i = 0;
 535     while (i < size) {
 536         // Allocate dummy in old generation
 537       oop dummy = vmClasses::Object_klass()->allocate_instance(CHECK);
 538       dummy_array->obj_at_put(i++, dummy);

 635   assert_pll_ownership();
 636   return _reference_pending_list.peek() != nullptr;
 637 }
 638 
 639 oop Universe::swap_reference_pending_list(oop list) {
 640   assert_pll_locked(is_locked);
 641   return _reference_pending_list.xchg(list);
 642 }
 643 
 644 #undef assert_pll_locked
 645 #undef assert_pll_ownership
 646 
 647 static void reinitialize_vtables() {
 648   // The vtables are initialized by starting at java.lang.Object and
 649   // initializing through the subclass links, so that the super
 650   // classes are always initialized first.
 651   for (ClassHierarchyIterator iter(vmClasses::Object_klass()); !iter.done(); iter.next()) {
 652     Klass* sub = iter.klass();
 653     sub->vtable().initialize_vtable();
 654   }



 655 }
 656 
 657 static void reinitialize_itables() {
 658 
 659   class ReinitTableClosure : public KlassClosure {
 660    public:
 661     void do_klass(Klass* k) {
 662       if (k->is_instance_klass()) {
 663          InstanceKlass::cast(k)->itable().initialize_itable();
 664       }
 665     }
 666   };
 667 
 668   MutexLocker mcld(ClassLoaderDataGraph_lock);
 669   ReinitTableClosure cl;
 670   ClassLoaderDataGraph::classes_do(&cl);
 671 }
 672 
 673 bool Universe::on_page_boundary(void* addr) {
 674   return is_aligned(addr, os::vm_page_size());

 880 
 881   // Initialize CPUTimeCounters object, which must be done before creation of the heap.
 882   CPUTimeCounters::initialize();
 883 
 884   ObjLayout::initialize();
 885 
 886 #ifdef _LP64
 887   AOTMetaspace::adjust_heap_sizes_for_dumping();
 888 #endif // _LP64
 889 
 890   GCConfig::arguments()->initialize_heap_sizes();
 891 
 892   jint status = Universe::initialize_heap();
 893   if (status != JNI_OK) {
 894     return status;
 895   }
 896 
 897   Universe::initialize_tlab();
 898 
 899   Metaspace::global_initialize();
 900 
 901   // Initialize performance counters for metaspaces
 902   MetaspaceCounters::initialize_performance_counters();
 903 
 904   // Checks 'AfterMemoryInit' constraints.
 905   if (!JVMFlagLimit::check_all_constraints(JVMFlagConstraintPhase::AfterMemoryInit)) {
 906     return JNI_EINVAL;
 907   }
 908 
 909 #if INCLUDE_CDS
 910   if (CDSConfig::is_using_archive()) {
 911     // Read the data structures supporting the shared spaces (shared
 912     // system dictionary, symbol table, etc.)
 913     AOTMetaspace::initialize_shared_spaces();
 914   }
 915 #endif
 916 
 917   ClassLoaderData::init_null_class_loader_data();
 918 
 919 #if INCLUDE_CDS
 920 #if INCLUDE_CDS_JAVA_HEAP

1050   _klass = ik;
1051   _method_idnum = m->method_idnum();
1052   assert(_method_idnum >= 0, "sanity check");
1053 }
1054 
1055 Method* LatestMethodCache::get_method() {
1056   if (_klass == nullptr) {
1057     return nullptr;
1058   } else {
1059     Method* m = _klass->method_with_idnum(_method_idnum);
1060     assert(m != nullptr, "sanity check");
1061     return m;
1062   }
1063 }
1064 
1065 Method* Universe::finalizer_register_method()     { return _finalizer_register_cache.get_method(); }
1066 Method* Universe::loader_addClass_method()        { return _loader_addClass_cache.get_method(); }
1067 Method* Universe::throw_illegal_access_error()    { return _throw_illegal_access_error_cache.get_method(); }
1068 Method* Universe::throw_no_such_method_error()    { return _throw_no_such_method_error_cache.get_method(); }
1069 Method* Universe::do_stack_walk_method()          { return _do_stack_walk_cache.get_method(); }



1070 
1071 void Universe::initialize_known_methods(JavaThread* current) {
1072   // Set up static method for registering finalizers
1073   _finalizer_register_cache.init(current,
1074                           vmClasses::Finalizer_klass(),
1075                           "register",
1076                           vmSymbols::object_void_signature(), true);
1077 
1078   _throw_illegal_access_error_cache.init(current,
1079                           vmClasses::internal_Unsafe_klass(),
1080                           "throwIllegalAccessError",
1081                           vmSymbols::void_method_signature(), true);
1082 
1083   _throw_no_such_method_error_cache.init(current,
1084                           vmClasses::internal_Unsafe_klass(),
1085                           "throwNoSuchMethodError",
1086                           vmSymbols::void_method_signature(), true);
1087 
1088   // Set up method for registering loaded classes in class loader vector
1089   _loader_addClass_cache.init(current,
1090                           vmClasses::ClassLoader_klass(),
1091                           "addClass",
1092                           vmSymbols::class_void_signature(), false);
1093 
1094   // Set up method for stack walking
1095   _do_stack_walk_cache.init(current,
1096                           vmClasses::AbstractStackWalker_klass(),
1097                           "doStackWalk",
1098                           vmSymbols::doStackWalk_signature(), false);















1099 }
1100 
1101 void universe2_init() {
1102   EXCEPTION_MARK;
1103   Universe::genesis(CATCH);
1104 }
1105 
1106 // Set after initialization of the module runtime, call_initModuleRuntime
1107 void universe_post_module_init() {
1108   Universe::_module_initialized = true;
1109 }
1110 
1111 bool universe_post_init() {
1112   assert(!is_init_completed(), "Error: initialization not yet completed!");
1113   Universe::_fully_initialized = true;
1114   EXCEPTION_MARK;
1115   if (!CDSConfig::is_using_archive()) {
1116     reinitialize_vtables();
1117     reinitialize_itables();
1118   }

  50 #include "gc/shared/tlab_globals.hpp"
  51 #include "logging/log.hpp"
  52 #include "logging/logStream.hpp"
  53 #include "memory/memoryReserver.hpp"
  54 #include "memory/metadataFactory.hpp"
  55 #include "memory/metaspaceClosure.hpp"
  56 #include "memory/metaspaceCounters.hpp"
  57 #include "memory/metaspaceUtils.hpp"
  58 #include "memory/oopFactory.hpp"
  59 #include "memory/resourceArea.hpp"
  60 #include "memory/universe.hpp"
  61 #include "oops/compressedOops.hpp"
  62 #include "oops/instanceKlass.hpp"
  63 #include "oops/instanceMirrorKlass.hpp"
  64 #include "oops/jmethodIDTable.hpp"
  65 #include "oops/klass.inline.hpp"
  66 #include "oops/objArrayOop.inline.hpp"
  67 #include "oops/objLayout.hpp"
  68 #include "oops/oop.inline.hpp"
  69 #include "oops/oopHandle.inline.hpp"
  70 #include "oops/refArrayKlass.hpp"
  71 #include "oops/typeArrayKlass.hpp"
  72 #include "prims/resolvedMethodTable.hpp"
  73 #include "runtime/arguments.hpp"
  74 #include "runtime/atomicAccess.hpp"
  75 #include "runtime/cpuTimeCounters.hpp"
  76 #include "runtime/flags/jvmFlagLimit.hpp"
  77 #include "runtime/handles.inline.hpp"
  78 #include "runtime/init.hpp"
  79 #include "runtime/java.hpp"
  80 #include "runtime/javaThread.hpp"
  81 #include "runtime/jniHandles.hpp"
  82 #include "runtime/threads.hpp"
  83 #include "runtime/timerTrace.hpp"
  84 #include "sanitizers/leak.hpp"
  85 #include "services/cpuTimeUsage.hpp"
  86 #include "services/memoryService.hpp"
  87 #include "utilities/align.hpp"
  88 #include "utilities/autoRestore.hpp"
  89 #include "utilities/debug.hpp"
  90 #include "utilities/formatBuffer.hpp"

  98 // interacts with the RedefineClasses API.
  99 class LatestMethodCache {
 100   // We save the InstanceKlass* and the idnum of Method* in order to get
 101   // the current Method*.
 102   InstanceKlass*        _klass;
 103   int                   _method_idnum;
 104 
 105  public:
 106   LatestMethodCache()   { _klass = nullptr; _method_idnum = -1; }
 107 
 108   void init(JavaThread* current, InstanceKlass* ik, const char* method,
 109             Symbol* signature, bool is_static);
 110   Method* get_method();
 111 };
 112 
 113 static LatestMethodCache _finalizer_register_cache;         // Finalizer.register()
 114 static LatestMethodCache _loader_addClass_cache;            // ClassLoader.addClass()
 115 static LatestMethodCache _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError()
 116 static LatestMethodCache _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError()
 117 static LatestMethodCache _do_stack_walk_cache;              // AbstractStackWalker.doStackWalk()
 118 static LatestMethodCache _is_substitutable_cache;           // ValueObjectMethods.isSubstitutable()
 119 static LatestMethodCache _value_object_hash_code_cache;     // ValueObjectMethods.valueObjectHashCode()
 120 static LatestMethodCache _is_substitutable_alt_cache;       // ValueObjectMethods.isSubstitutableAlt()
 121 
 122 // Known objects
 123 TypeArrayKlass* Universe::_typeArrayKlasses[T_LONG+1] = { nullptr /*, nullptr...*/ };
 124 ObjArrayKlass* Universe::_objectArrayKlass            = nullptr;
 125 Klass* Universe::_fillerArrayKlass                    = nullptr;
 126 OopHandle Universe::_basic_type_mirrors[T_VOID+1];
 127 #if INCLUDE_CDS_JAVA_HEAP
 128 int Universe::_archived_basic_type_mirror_indices[T_VOID+1];
 129 #endif
 130 
 131 OopHandle Universe::_main_thread_group;
 132 OopHandle Universe::_system_thread_group;
 133 OopHandle Universe::_the_empty_class_array;
 134 OopHandle Universe::_the_null_string;
 135 OopHandle Universe::_the_min_jint_string;
 136 
 137 OopHandle Universe::_the_null_sentinel;
 138 
 139 // _out_of_memory_errors is an objArray
 140 enum OutOfMemoryInstance { _oom_java_heap,

 446     vmSymbols::initialize();
 447 
 448     // Initialize table for matching jmethodID, before SystemDictionary.
 449     JmethodIDTable::initialize();
 450 
 451     SystemDictionary::initialize(CHECK);
 452 
 453     // Create string constants
 454     oop s = StringTable::intern("null", CHECK);
 455     _the_null_string = OopHandle(vm_global(), s);
 456     s = StringTable::intern("-2147483648", CHECK);
 457     _the_min_jint_string = OopHandle(vm_global(), s);
 458 
 459 #if INCLUDE_CDS
 460     if (CDSConfig::is_using_archive()) {
 461       // Verify shared interfaces array.
 462       assert(_the_array_interfaces_array->at(0) ==
 463              vmClasses::Cloneable_klass(), "u3");
 464       assert(_the_array_interfaces_array->at(1) ==
 465              vmClasses::Serializable_klass(), "u3");
 466 
 467     } else
 468 #endif
 469     {
 470       // Set up shared interfaces array.  (Do this before supers are set up.)
 471       _the_array_interfaces_array->at_put(0, vmClasses::Cloneable_klass());
 472       _the_array_interfaces_array->at_put(1, vmClasses::Serializable_klass());
 473     }
 474 
 475     _the_array_interfaces_bitmap = Klass::compute_secondary_supers_bitmap(_the_array_interfaces_array);
 476     _the_empty_klass_bitmap      = Klass::compute_secondary_supers_bitmap(_the_empty_klass_array);
 477 
 478     initialize_basic_type_klass(_fillerArrayKlass, CHECK);
 479 
 480     initialize_basic_type_klass(boolArrayKlass(), CHECK);
 481     initialize_basic_type_klass(charArrayKlass(), CHECK);
 482     initialize_basic_type_klass(floatArrayKlass(), CHECK);
 483     initialize_basic_type_klass(doubleArrayKlass(), CHECK);
 484     initialize_basic_type_klass(byteArrayKlass(), CHECK);
 485     initialize_basic_type_klass(shortArrayKlass(), CHECK);
 486     initialize_basic_type_klass(intArrayKlass(), CHECK);

 494     Handle tns = java_lang_String::create_from_str("<null_sentinel>", CHECK);
 495     _the_null_sentinel = OopHandle(vm_global(), tns());
 496   }
 497 
 498   // Create a handle for reference_pending_list
 499   _reference_pending_list = OopHandle(vm_global(), nullptr);
 500 
 501   // Maybe this could be lifted up now that object array can be initialized
 502   // during the bootstrapping.
 503 
 504   // OLD
 505   // Initialize _objectArrayKlass after core bootstraping to make
 506   // sure the super class is set up properly for _objectArrayKlass.
 507   // ---
 508   // NEW
 509   // Since some of the old system object arrays have been converted to
 510   // ordinary object arrays, _objectArrayKlass will be loaded when
 511   // SystemDictionary::initialize(CHECK); is run. See the extra check
 512   // for Object_klass_is_loaded in ObjArrayKlass::allocate_objArray_klass.
 513   {
 514     ArrayKlass* oak = vmClasses::Object_klass()->array_klass(CHECK);
 515     oak->append_to_sibling_list();
 516 
 517     // Create a RefArrayKlass (which is the default) and initialize.
 518     ObjArrayKlass* rak = ObjArrayKlass::cast(oak)->klass_with_properties(ArrayKlass::ArrayProperties::DEFAULT, THREAD);
 519     _objectArrayKlass = rak;
 520   }







 521 
 522   #ifdef ASSERT
 523   if (FullGCALot) {
 524     // Allocate an array of dummy objects.
 525     // We'd like these to be at the bottom of the old generation,
 526     // so that when we free one and then collect,
 527     // (almost) the whole heap moves
 528     // and we find out if we actually update all the oops correctly.
 529     // But we can't allocate directly in the old generation,
 530     // so we allocate wherever, and hope that the first collection
 531     // moves these objects to the bottom of the old generation.
 532     int size = FullGCALotDummies * 2;
 533 
 534     objArrayOop    naked_array = oopFactory::new_objArray(vmClasses::Object_klass(), size, CHECK);
 535     objArrayHandle dummy_array(THREAD, naked_array);
 536     int i = 0;
 537     while (i < size) {
 538         // Allocate dummy in old generation
 539       oop dummy = vmClasses::Object_klass()->allocate_instance(CHECK);
 540       dummy_array->obj_at_put(i++, dummy);

 637   assert_pll_ownership();
 638   return _reference_pending_list.peek() != nullptr;
 639 }
 640 
 641 oop Universe::swap_reference_pending_list(oop list) {
 642   assert_pll_locked(is_locked);
 643   return _reference_pending_list.xchg(list);
 644 }
 645 
 646 #undef assert_pll_locked
 647 #undef assert_pll_ownership
 648 
 649 static void reinitialize_vtables() {
 650   // The vtables are initialized by starting at java.lang.Object and
 651   // initializing through the subclass links, so that the super
 652   // classes are always initialized first.
 653   for (ClassHierarchyIterator iter(vmClasses::Object_klass()); !iter.done(); iter.next()) {
 654     Klass* sub = iter.klass();
 655     sub->vtable().initialize_vtable();
 656   }
 657 
 658   // This isn't added to the subclass list, so need to reinitialize vtables directly.
 659   Universe::objectArrayKlass()->vtable().initialize_vtable();
 660 }
 661 
 662 static void reinitialize_itables() {
 663 
 664   class ReinitTableClosure : public KlassClosure {
 665    public:
 666     void do_klass(Klass* k) {
 667       if (k->is_instance_klass()) {
 668          InstanceKlass::cast(k)->itable().initialize_itable();
 669       }
 670     }
 671   };
 672 
 673   MutexLocker mcld(ClassLoaderDataGraph_lock);
 674   ReinitTableClosure cl;
 675   ClassLoaderDataGraph::classes_do(&cl);
 676 }
 677 
 678 bool Universe::on_page_boundary(void* addr) {
 679   return is_aligned(addr, os::vm_page_size());

 885 
 886   // Initialize CPUTimeCounters object, which must be done before creation of the heap.
 887   CPUTimeCounters::initialize();
 888 
 889   ObjLayout::initialize();
 890 
 891 #ifdef _LP64
 892   AOTMetaspace::adjust_heap_sizes_for_dumping();
 893 #endif // _LP64
 894 
 895   GCConfig::arguments()->initialize_heap_sizes();
 896 
 897   jint status = Universe::initialize_heap();
 898   if (status != JNI_OK) {
 899     return status;
 900   }
 901 
 902   Universe::initialize_tlab();
 903 
 904   Metaspace::global_initialize();

 905   // Initialize performance counters for metaspaces
 906   MetaspaceCounters::initialize_performance_counters();
 907 
 908   // Checks 'AfterMemoryInit' constraints.
 909   if (!JVMFlagLimit::check_all_constraints(JVMFlagConstraintPhase::AfterMemoryInit)) {
 910     return JNI_EINVAL;
 911   }
 912 
 913 #if INCLUDE_CDS
 914   if (CDSConfig::is_using_archive()) {
 915     // Read the data structures supporting the shared spaces (shared
 916     // system dictionary, symbol table, etc.)
 917     AOTMetaspace::initialize_shared_spaces();
 918   }
 919 #endif
 920 
 921   ClassLoaderData::init_null_class_loader_data();
 922 
 923 #if INCLUDE_CDS
 924 #if INCLUDE_CDS_JAVA_HEAP

1054   _klass = ik;
1055   _method_idnum = m->method_idnum();
1056   assert(_method_idnum >= 0, "sanity check");
1057 }
1058 
1059 Method* LatestMethodCache::get_method() {
1060   if (_klass == nullptr) {
1061     return nullptr;
1062   } else {
1063     Method* m = _klass->method_with_idnum(_method_idnum);
1064     assert(m != nullptr, "sanity check");
1065     return m;
1066   }
1067 }
1068 
1069 Method* Universe::finalizer_register_method()     { return _finalizer_register_cache.get_method(); }
1070 Method* Universe::loader_addClass_method()        { return _loader_addClass_cache.get_method(); }
1071 Method* Universe::throw_illegal_access_error()    { return _throw_illegal_access_error_cache.get_method(); }
1072 Method* Universe::throw_no_such_method_error()    { return _throw_no_such_method_error_cache.get_method(); }
1073 Method* Universe::do_stack_walk_method()          { return _do_stack_walk_cache.get_method(); }
1074 Method* Universe::is_substitutable_method()       { return _is_substitutable_cache.get_method(); }
1075 Method* Universe::value_object_hash_code_method() { return _value_object_hash_code_cache.get_method(); }
1076 Method* Universe::is_substitutableAlt_method()    { return _is_substitutable_alt_cache.get_method(); }
1077 
1078 void Universe::initialize_known_methods(JavaThread* current) {
1079   // Set up static method for registering finalizers
1080   _finalizer_register_cache.init(current,
1081                           vmClasses::Finalizer_klass(),
1082                           "register",
1083                           vmSymbols::object_void_signature(), true);
1084 
1085   _throw_illegal_access_error_cache.init(current,
1086                           vmClasses::internal_Unsafe_klass(),
1087                           "throwIllegalAccessError",
1088                           vmSymbols::void_method_signature(), true);
1089 
1090   _throw_no_such_method_error_cache.init(current,
1091                           vmClasses::internal_Unsafe_klass(),
1092                           "throwNoSuchMethodError",
1093                           vmSymbols::void_method_signature(), true);
1094 
1095   // Set up method for registering loaded classes in class loader vector
1096   _loader_addClass_cache.init(current,
1097                           vmClasses::ClassLoader_klass(),
1098                           "addClass",
1099                           vmSymbols::class_void_signature(), false);
1100 
1101   // Set up method for stack walking
1102   _do_stack_walk_cache.init(current,
1103                           vmClasses::AbstractStackWalker_klass(),
1104                           "doStackWalk",
1105                           vmSymbols::doStackWalk_signature(), false);
1106 
1107   // Set up substitutability testing
1108   ResourceMark rm(current);
1109   _is_substitutable_cache.init(current,
1110                           vmClasses::ValueObjectMethods_klass(),
1111                           vmSymbols::isSubstitutable_name()->as_C_string(),
1112                           vmSymbols::object_object_boolean_signature(), true);
1113   _value_object_hash_code_cache.init(current,
1114                           vmClasses::ValueObjectMethods_klass(),
1115                           vmSymbols::valueObjectHashCode_name()->as_C_string(),
1116                           vmSymbols::object_int_signature(), true);
1117   _is_substitutable_alt_cache.init(current,
1118                           vmClasses::ValueObjectMethods_klass(),
1119                           vmSymbols::isSubstitutableAlt_name()->as_C_string(),
1120                           vmSymbols::object_object_boolean_signature(), true);
1121 }
1122 
1123 void universe2_init() {
1124   EXCEPTION_MARK;
1125   Universe::genesis(CATCH);
1126 }
1127 
1128 // Set after initialization of the module runtime, call_initModuleRuntime
1129 void universe_post_module_init() {
1130   Universe::_module_initialized = true;
1131 }
1132 
1133 bool universe_post_init() {
1134   assert(!is_init_completed(), "Error: initialization not yet completed!");
1135   Universe::_fully_initialized = true;
1136   EXCEPTION_MARK;
1137   if (!CDSConfig::is_using_archive()) {
1138     reinitialize_vtables();
1139     reinitialize_itables();
1140   }
< prev index next >