< 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,

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

 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     Klass* oak = vmClasses::Object_klass()->array_klass(CHECK);
 515     _objectArrayKlass = ObjArrayKlass::cast(oak);




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

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



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

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



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















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

  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,

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

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







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

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

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

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

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