49 #include "gc/shared/tlab_globals.hpp"
50 #include "logging/log.hpp"
51 #include "logging/logStream.hpp"
52 #include "memory/memoryReserver.hpp"
53 #include "memory/metadataFactory.hpp"
54 #include "memory/metaspaceClosure.hpp"
55 #include "memory/metaspaceCounters.hpp"
56 #include "memory/metaspaceUtils.hpp"
57 #include "memory/oopFactory.hpp"
58 #include "memory/resourceArea.hpp"
59 #include "memory/universe.hpp"
60 #include "oops/compressedOops.hpp"
61 #include "oops/instanceKlass.hpp"
62 #include "oops/instanceMirrorKlass.hpp"
63 #include "oops/jmethodIDTable.hpp"
64 #include "oops/klass.inline.hpp"
65 #include "oops/objArrayOop.inline.hpp"
66 #include "oops/objLayout.hpp"
67 #include "oops/oop.inline.hpp"
68 #include "oops/oopHandle.inline.hpp"
69 #include "oops/typeArrayKlass.hpp"
70 #include "prims/resolvedMethodTable.hpp"
71 #include "runtime/arguments.hpp"
72 #include "runtime/atomic.hpp"
73 #include "runtime/cpuTimeCounters.hpp"
74 #include "runtime/flags/jvmFlagLimit.hpp"
75 #include "runtime/handles.inline.hpp"
76 #include "runtime/init.hpp"
77 #include "runtime/java.hpp"
78 #include "runtime/javaThread.hpp"
79 #include "runtime/jniHandles.hpp"
80 #include "runtime/threads.hpp"
81 #include "runtime/timerTrace.hpp"
82 #include "sanitizers/leak.hpp"
83 #include "services/memoryService.hpp"
84 #include "utilities/align.hpp"
85 #include "utilities/autoRestore.hpp"
86 #include "utilities/debug.hpp"
87 #include "utilities/formatBuffer.hpp"
88 #include "utilities/macros.hpp"
94 // interacts with the RedefineClasses API.
95 class LatestMethodCache {
96 // We save the InstanceKlass* and the idnum of Method* in order to get
97 // the current Method*.
98 InstanceKlass* _klass;
99 int _method_idnum;
100
101 public:
102 LatestMethodCache() { _klass = nullptr; _method_idnum = -1; }
103
104 void init(JavaThread* current, InstanceKlass* ik, const char* method,
105 Symbol* signature, bool is_static);
106 Method* get_method();
107 };
108
109 static LatestMethodCache _finalizer_register_cache; // Finalizer.register()
110 static LatestMethodCache _loader_addClass_cache; // ClassLoader.addClass()
111 static LatestMethodCache _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError()
112 static LatestMethodCache _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError()
113 static LatestMethodCache _do_stack_walk_cache; // AbstractStackWalker.doStackWalk()
114
115 // Known objects
116 TypeArrayKlass* Universe::_typeArrayKlasses[T_LONG+1] = { nullptr /*, nullptr...*/ };
117 ObjArrayKlass* Universe::_objectArrayKlass = nullptr;
118 Klass* Universe::_fillerArrayKlass = nullptr;
119 OopHandle Universe::_basic_type_mirrors[T_VOID+1];
120 #if INCLUDE_CDS_JAVA_HEAP
121 int Universe::_archived_basic_type_mirror_indices[T_VOID+1];
122 #endif
123
124 OopHandle Universe::_main_thread_group;
125 OopHandle Universe::_system_thread_group;
126 OopHandle Universe::_the_empty_class_array;
127 OopHandle Universe::_the_null_string;
128 OopHandle Universe::_the_min_jint_string;
129
130 OopHandle Universe::_the_null_sentinel;
131
132 // _out_of_memory_errors is an objArray
133 enum OutOfMemoryInstance { _oom_java_heap,
438 vmSymbols::initialize();
439
440 // Initialize table for matching jmethodID, before SystemDictionary.
441 JmethodIDTable::initialize();
442
443 SystemDictionary::initialize(CHECK);
444
445 // Create string constants
446 oop s = StringTable::intern("null", CHECK);
447 _the_null_string = OopHandle(vm_global(), s);
448 s = StringTable::intern("-2147483648", CHECK);
449 _the_min_jint_string = OopHandle(vm_global(), s);
450
451 #if INCLUDE_CDS
452 if (CDSConfig::is_using_archive()) {
453 // Verify shared interfaces array.
454 assert(_the_array_interfaces_array->at(0) ==
455 vmClasses::Cloneable_klass(), "u3");
456 assert(_the_array_interfaces_array->at(1) ==
457 vmClasses::Serializable_klass(), "u3");
458 } else
459 #endif
460 {
461 // Set up shared interfaces array. (Do this before supers are set up.)
462 _the_array_interfaces_array->at_put(0, vmClasses::Cloneable_klass());
463 _the_array_interfaces_array->at_put(1, vmClasses::Serializable_klass());
464 }
465
466 _the_array_interfaces_bitmap = Klass::compute_secondary_supers_bitmap(_the_array_interfaces_array);
467 _the_empty_klass_bitmap = Klass::compute_secondary_supers_bitmap(_the_empty_klass_array);
468
469 initialize_basic_type_klass(_fillerArrayKlass, CHECK);
470
471 initialize_basic_type_klass(boolArrayKlass(), CHECK);
472 initialize_basic_type_klass(charArrayKlass(), CHECK);
473 initialize_basic_type_klass(floatArrayKlass(), CHECK);
474 initialize_basic_type_klass(doubleArrayKlass(), CHECK);
475 initialize_basic_type_klass(byteArrayKlass(), CHECK);
476 initialize_basic_type_klass(shortArrayKlass(), CHECK);
477 initialize_basic_type_klass(intArrayKlass(), CHECK);
485 Handle tns = java_lang_String::create_from_str("<null_sentinel>", CHECK);
486 _the_null_sentinel = OopHandle(vm_global(), tns());
487 }
488
489 // Create a handle for reference_pending_list
490 _reference_pending_list = OopHandle(vm_global(), nullptr);
491
492 // Maybe this could be lifted up now that object array can be initialized
493 // during the bootstrapping.
494
495 // OLD
496 // Initialize _objectArrayKlass after core bootstraping to make
497 // sure the super class is set up properly for _objectArrayKlass.
498 // ---
499 // NEW
500 // Since some of the old system object arrays have been converted to
501 // ordinary object arrays, _objectArrayKlass will be loaded when
502 // SystemDictionary::initialize(CHECK); is run. See the extra check
503 // for Object_klass_loaded in objArrayKlassKlass::allocate_objArray_klass_impl.
504 {
505 Klass* oak = vmClasses::Object_klass()->array_klass(CHECK);
506 _objectArrayKlass = ObjArrayKlass::cast(oak);
507 }
508 // OLD
509 // Add the class to the class hierarchy manually to make sure that
510 // its vtable is initialized after core bootstrapping is completed.
511 // ---
512 // New
513 // Have already been initialized.
514 _objectArrayKlass->append_to_sibling_list();
515
516 #ifdef ASSERT
517 if (FullGCALot) {
518 // Allocate an array of dummy objects.
519 // We'd like these to be at the bottom of the old generation,
520 // so that when we free one and then collect,
521 // (almost) the whole heap moves
522 // and we find out if we actually update all the oops correctly.
523 // But we can't allocate directly in the old generation,
524 // so we allocate wherever, and hope that the first collection
525 // moves these objects to the bottom of the old generation.
526 int size = FullGCALotDummies * 2;
527
528 objArrayOop naked_array = oopFactory::new_objArray(vmClasses::Object_klass(), size, CHECK);
529 objArrayHandle dummy_array(THREAD, naked_array);
530 int i = 0;
531 while (i < size) {
532 // Allocate dummy in old generation
533 oop dummy = vmClasses::Object_klass()->allocate_instance(CHECK);
534 dummy_array->obj_at_put(i++, dummy);
626 assert_pll_ownership();
627 return _reference_pending_list.peek() != nullptr;
628 }
629
630 oop Universe::swap_reference_pending_list(oop list) {
631 assert_pll_locked(is_locked);
632 return _reference_pending_list.xchg(list);
633 }
634
635 #undef assert_pll_locked
636 #undef assert_pll_ownership
637
638 static void reinitialize_vtables() {
639 // The vtables are initialized by starting at java.lang.Object and
640 // initializing through the subclass links, so that the super
641 // classes are always initialized first.
642 for (ClassHierarchyIterator iter(vmClasses::Object_klass()); !iter.done(); iter.next()) {
643 Klass* sub = iter.klass();
644 sub->vtable().initialize_vtable();
645 }
646 }
647
648 static void reinitialize_itables() {
649
650 class ReinitTableClosure : public KlassClosure {
651 public:
652 void do_klass(Klass* k) {
653 if (k->is_instance_klass()) {
654 InstanceKlass::cast(k)->itable().initialize_itable();
655 }
656 }
657 };
658
659 MutexLocker mcld(ClassLoaderDataGraph_lock);
660 ReinitTableClosure cl;
661 ClassLoaderDataGraph::classes_do(&cl);
662 }
663
664 bool Universe::on_page_boundary(void* addr) {
665 return is_aligned(addr, os::vm_page_size());
871
872 // Initialize CPUTimeCounters object, which must be done before creation of the heap.
873 CPUTimeCounters::initialize();
874
875 ObjLayout::initialize();
876
877 #ifdef _LP64
878 MetaspaceShared::adjust_heap_sizes_for_dumping();
879 #endif // _LP64
880
881 GCConfig::arguments()->initialize_heap_sizes();
882
883 jint status = Universe::initialize_heap();
884 if (status != JNI_OK) {
885 return status;
886 }
887
888 Universe::initialize_tlab();
889
890 Metaspace::global_initialize();
891
892 // Initialize performance counters for metaspaces
893 MetaspaceCounters::initialize_performance_counters();
894
895 // Checks 'AfterMemoryInit' constraints.
896 if (!JVMFlagLimit::check_all_constraints(JVMFlagConstraintPhase::AfterMemoryInit)) {
897 return JNI_EINVAL;
898 }
899
900 ClassLoaderData::init_null_class_loader_data();
901
902 #if INCLUDE_CDS
903 if (CDSConfig::is_using_archive()) {
904 // Read the data structures supporting the shared spaces (shared
905 // system dictionary, symbol table, etc.)
906 MetaspaceShared::initialize_shared_spaces();
907 }
908 if (CDSConfig::is_dumping_archive()) {
909 CDSConfig::prepare_for_dumping();
910 }
911 #endif
1026 _klass = ik;
1027 _method_idnum = m->method_idnum();
1028 assert(_method_idnum >= 0, "sanity check");
1029 }
1030
1031 Method* LatestMethodCache::get_method() {
1032 if (_klass == nullptr) {
1033 return nullptr;
1034 } else {
1035 Method* m = _klass->method_with_idnum(_method_idnum);
1036 assert(m != nullptr, "sanity check");
1037 return m;
1038 }
1039 }
1040
1041 Method* Universe::finalizer_register_method() { return _finalizer_register_cache.get_method(); }
1042 Method* Universe::loader_addClass_method() { return _loader_addClass_cache.get_method(); }
1043 Method* Universe::throw_illegal_access_error() { return _throw_illegal_access_error_cache.get_method(); }
1044 Method* Universe::throw_no_such_method_error() { return _throw_no_such_method_error_cache.get_method(); }
1045 Method* Universe::do_stack_walk_method() { return _do_stack_walk_cache.get_method(); }
1046
1047 void Universe::initialize_known_methods(JavaThread* current) {
1048 // Set up static method for registering finalizers
1049 _finalizer_register_cache.init(current,
1050 vmClasses::Finalizer_klass(),
1051 "register",
1052 vmSymbols::object_void_signature(), true);
1053
1054 _throw_illegal_access_error_cache.init(current,
1055 vmClasses::internal_Unsafe_klass(),
1056 "throwIllegalAccessError",
1057 vmSymbols::void_method_signature(), true);
1058
1059 _throw_no_such_method_error_cache.init(current,
1060 vmClasses::internal_Unsafe_klass(),
1061 "throwNoSuchMethodError",
1062 vmSymbols::void_method_signature(), true);
1063
1064 // Set up method for registering loaded classes in class loader vector
1065 _loader_addClass_cache.init(current,
1066 vmClasses::ClassLoader_klass(),
1067 "addClass",
1068 vmSymbols::class_void_signature(), false);
1069
1070 // Set up method for stack walking
1071 _do_stack_walk_cache.init(current,
1072 vmClasses::AbstractStackWalker_klass(),
1073 "doStackWalk",
1074 vmSymbols::doStackWalk_signature(), false);
1075 }
1076
1077 void universe2_init() {
1078 EXCEPTION_MARK;
1079 Universe::genesis(CATCH);
1080 }
1081
1082 // Set after initialization of the module runtime, call_initModuleRuntime
1083 void universe_post_module_init() {
1084 Universe::_module_initialized = true;
1085 }
1086
1087 bool universe_post_init() {
1088 assert(!is_init_completed(), "Error: initialization not yet completed!");
1089 Universe::_fully_initialized = true;
1090 EXCEPTION_MARK;
1091 if (!CDSConfig::is_using_archive()) {
1092 reinitialize_vtables();
1093 reinitialize_itables();
1094 }
|
49 #include "gc/shared/tlab_globals.hpp"
50 #include "logging/log.hpp"
51 #include "logging/logStream.hpp"
52 #include "memory/memoryReserver.hpp"
53 #include "memory/metadataFactory.hpp"
54 #include "memory/metaspaceClosure.hpp"
55 #include "memory/metaspaceCounters.hpp"
56 #include "memory/metaspaceUtils.hpp"
57 #include "memory/oopFactory.hpp"
58 #include "memory/resourceArea.hpp"
59 #include "memory/universe.hpp"
60 #include "oops/compressedOops.hpp"
61 #include "oops/instanceKlass.hpp"
62 #include "oops/instanceMirrorKlass.hpp"
63 #include "oops/jmethodIDTable.hpp"
64 #include "oops/klass.inline.hpp"
65 #include "oops/objArrayOop.inline.hpp"
66 #include "oops/objLayout.hpp"
67 #include "oops/oop.inline.hpp"
68 #include "oops/oopHandle.inline.hpp"
69 #include "oops/refArrayKlass.hpp"
70 #include "oops/typeArrayKlass.hpp"
71 #include "prims/resolvedMethodTable.hpp"
72 #include "runtime/arguments.hpp"
73 #include "runtime/atomic.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/memoryService.hpp"
85 #include "utilities/align.hpp"
86 #include "utilities/autoRestore.hpp"
87 #include "utilities/debug.hpp"
88 #include "utilities/formatBuffer.hpp"
89 #include "utilities/macros.hpp"
95 // interacts with the RedefineClasses API.
96 class LatestMethodCache {
97 // We save the InstanceKlass* and the idnum of Method* in order to get
98 // the current Method*.
99 InstanceKlass* _klass;
100 int _method_idnum;
101
102 public:
103 LatestMethodCache() { _klass = nullptr; _method_idnum = -1; }
104
105 void init(JavaThread* current, InstanceKlass* ik, const char* method,
106 Symbol* signature, bool is_static);
107 Method* get_method();
108 };
109
110 static LatestMethodCache _finalizer_register_cache; // Finalizer.register()
111 static LatestMethodCache _loader_addClass_cache; // ClassLoader.addClass()
112 static LatestMethodCache _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError()
113 static LatestMethodCache _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError()
114 static LatestMethodCache _do_stack_walk_cache; // AbstractStackWalker.doStackWalk()
115 static LatestMethodCache _is_substitutable_cache; // ValueObjectMethods.isSubstitutable()
116 static LatestMethodCache _value_object_hash_code_cache; // ValueObjectMethods.valueObjectHashCode()
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,
441 vmSymbols::initialize();
442
443 // Initialize table for matching jmethodID, before SystemDictionary.
444 JmethodIDTable::initialize();
445
446 SystemDictionary::initialize(CHECK);
447
448 // Create string constants
449 oop s = StringTable::intern("null", CHECK);
450 _the_null_string = OopHandle(vm_global(), s);
451 s = StringTable::intern("-2147483648", CHECK);
452 _the_min_jint_string = OopHandle(vm_global(), s);
453
454 #if INCLUDE_CDS
455 if (CDSConfig::is_using_archive()) {
456 // Verify shared interfaces array.
457 assert(_the_array_interfaces_array->at(0) ==
458 vmClasses::Cloneable_klass(), "u3");
459 assert(_the_array_interfaces_array->at(1) ==
460 vmClasses::Serializable_klass(), "u3");
461
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_loaded in objArrayKlassKlass::allocate_objArray_klass_impl.
508 {
509 ArrayKlass* oak = vmClasses::Object_klass()->array_klass(CHECK);
510 oak->append_to_sibling_list();
511
512 // Create a RefArrayKlass (which is the default) and initialize.
513 ObjArrayKlass* rak = ObjArrayKlass::cast(oak)->klass_with_properties(ArrayKlass::ArrayProperties::DEFAULT, THREAD);
514 _objectArrayKlass = rak;
515 }
516
517 #ifdef ASSERT
518 if (FullGCALot) {
519 // Allocate an array of dummy objects.
520 // We'd like these to be at the bottom of the old generation,
521 // so that when we free one and then collect,
522 // (almost) the whole heap moves
523 // and we find out if we actually update all the oops correctly.
524 // But we can't allocate directly in the old generation,
525 // so we allocate wherever, and hope that the first collection
526 // moves these objects to the bottom of the old generation.
527 int size = FullGCALotDummies * 2;
528
529 objArrayOop naked_array = oopFactory::new_objArray(vmClasses::Object_klass(), size, CHECK);
530 objArrayHandle dummy_array(THREAD, naked_array);
531 int i = 0;
532 while (i < size) {
533 // Allocate dummy in old generation
534 oop dummy = vmClasses::Object_klass()->allocate_instance(CHECK);
535 dummy_array->obj_at_put(i++, dummy);
627 assert_pll_ownership();
628 return _reference_pending_list.peek() != nullptr;
629 }
630
631 oop Universe::swap_reference_pending_list(oop list) {
632 assert_pll_locked(is_locked);
633 return _reference_pending_list.xchg(list);
634 }
635
636 #undef assert_pll_locked
637 #undef assert_pll_ownership
638
639 static void reinitialize_vtables() {
640 // The vtables are initialized by starting at java.lang.Object and
641 // initializing through the subclass links, so that the super
642 // classes are always initialized first.
643 for (ClassHierarchyIterator iter(vmClasses::Object_klass()); !iter.done(); iter.next()) {
644 Klass* sub = iter.klass();
645 sub->vtable().initialize_vtable();
646 }
647
648 // This isn't added to the subclass list, so need to reinitialize vtables directly.
649 Universe::objectArrayKlass()->vtable().initialize_vtable();
650 }
651
652 static void reinitialize_itables() {
653
654 class ReinitTableClosure : public KlassClosure {
655 public:
656 void do_klass(Klass* k) {
657 if (k->is_instance_klass()) {
658 InstanceKlass::cast(k)->itable().initialize_itable();
659 }
660 }
661 };
662
663 MutexLocker mcld(ClassLoaderDataGraph_lock);
664 ReinitTableClosure cl;
665 ClassLoaderDataGraph::classes_do(&cl);
666 }
667
668 bool Universe::on_page_boundary(void* addr) {
669 return is_aligned(addr, os::vm_page_size());
875
876 // Initialize CPUTimeCounters object, which must be done before creation of the heap.
877 CPUTimeCounters::initialize();
878
879 ObjLayout::initialize();
880
881 #ifdef _LP64
882 MetaspaceShared::adjust_heap_sizes_for_dumping();
883 #endif // _LP64
884
885 GCConfig::arguments()->initialize_heap_sizes();
886
887 jint status = Universe::initialize_heap();
888 if (status != JNI_OK) {
889 return status;
890 }
891
892 Universe::initialize_tlab();
893
894 Metaspace::global_initialize();
895 // Initialize performance counters for metaspaces
896 MetaspaceCounters::initialize_performance_counters();
897
898 // Checks 'AfterMemoryInit' constraints.
899 if (!JVMFlagLimit::check_all_constraints(JVMFlagConstraintPhase::AfterMemoryInit)) {
900 return JNI_EINVAL;
901 }
902
903 ClassLoaderData::init_null_class_loader_data();
904
905 #if INCLUDE_CDS
906 if (CDSConfig::is_using_archive()) {
907 // Read the data structures supporting the shared spaces (shared
908 // system dictionary, symbol table, etc.)
909 MetaspaceShared::initialize_shared_spaces();
910 }
911 if (CDSConfig::is_dumping_archive()) {
912 CDSConfig::prepare_for_dumping();
913 }
914 #endif
1029 _klass = ik;
1030 _method_idnum = m->method_idnum();
1031 assert(_method_idnum >= 0, "sanity check");
1032 }
1033
1034 Method* LatestMethodCache::get_method() {
1035 if (_klass == nullptr) {
1036 return nullptr;
1037 } else {
1038 Method* m = _klass->method_with_idnum(_method_idnum);
1039 assert(m != nullptr, "sanity check");
1040 return m;
1041 }
1042 }
1043
1044 Method* Universe::finalizer_register_method() { return _finalizer_register_cache.get_method(); }
1045 Method* Universe::loader_addClass_method() { return _loader_addClass_cache.get_method(); }
1046 Method* Universe::throw_illegal_access_error() { return _throw_illegal_access_error_cache.get_method(); }
1047 Method* Universe::throw_no_such_method_error() { return _throw_no_such_method_error_cache.get_method(); }
1048 Method* Universe::do_stack_walk_method() { return _do_stack_walk_cache.get_method(); }
1049 Method* Universe::is_substitutable_method() { return _is_substitutable_cache.get_method(); }
1050 Method* Universe::value_object_hash_code_method() { return _value_object_hash_code_cache.get_method(); }
1051
1052 void Universe::initialize_known_methods(JavaThread* current) {
1053 // Set up static method for registering finalizers
1054 _finalizer_register_cache.init(current,
1055 vmClasses::Finalizer_klass(),
1056 "register",
1057 vmSymbols::object_void_signature(), true);
1058
1059 _throw_illegal_access_error_cache.init(current,
1060 vmClasses::internal_Unsafe_klass(),
1061 "throwIllegalAccessError",
1062 vmSymbols::void_method_signature(), true);
1063
1064 _throw_no_such_method_error_cache.init(current,
1065 vmClasses::internal_Unsafe_klass(),
1066 "throwNoSuchMethodError",
1067 vmSymbols::void_method_signature(), true);
1068
1069 // Set up method for registering loaded classes in class loader vector
1070 _loader_addClass_cache.init(current,
1071 vmClasses::ClassLoader_klass(),
1072 "addClass",
1073 vmSymbols::class_void_signature(), false);
1074
1075 // Set up method for stack walking
1076 _do_stack_walk_cache.init(current,
1077 vmClasses::AbstractStackWalker_klass(),
1078 "doStackWalk",
1079 vmSymbols::doStackWalk_signature(), false);
1080
1081 // Set up substitutability testing
1082 ResourceMark rm(current);
1083 _is_substitutable_cache.init(current,
1084 vmClasses::ValueObjectMethods_klass(),
1085 vmSymbols::isSubstitutable_name()->as_C_string(),
1086 vmSymbols::object_object_boolean_signature(), true);
1087 _value_object_hash_code_cache.init(current,
1088 vmClasses::ValueObjectMethods_klass(),
1089 vmSymbols::valueObjectHashCode_name()->as_C_string(),
1090 vmSymbols::object_int_signature(), true);
1091 }
1092
1093 void universe2_init() {
1094 EXCEPTION_MARK;
1095 Universe::genesis(CATCH);
1096 }
1097
1098 // Set after initialization of the module runtime, call_initModuleRuntime
1099 void universe_post_module_init() {
1100 Universe::_module_initialized = true;
1101 }
1102
1103 bool universe_post_init() {
1104 assert(!is_init_completed(), "Error: initialization not yet completed!");
1105 Universe::_fully_initialized = true;
1106 EXCEPTION_MARK;
1107 if (!CDSConfig::is_using_archive()) {
1108 reinitialize_vtables();
1109 reinitialize_itables();
1110 }
|