< prev index next > src/hotspot/share/memory/universe.cpp
Print this page
#include "oops/klass.inline.hpp"
#include "oops/objArrayOop.inline.hpp"
#include "oops/objLayout.hpp"
#include "oops/oop.inline.hpp"
#include "oops/oopHandle.inline.hpp"
+ #include "oops/refArrayKlass.hpp"
#include "oops/typeArrayKlass.hpp"
#include "prims/resolvedMethodTable.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/cpuTimeCounters.hpp"
static LatestMethodCache _finalizer_register_cache; // Finalizer.register()
static LatestMethodCache _loader_addClass_cache; // ClassLoader.addClass()
static LatestMethodCache _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError()
static LatestMethodCache _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError()
static LatestMethodCache _do_stack_walk_cache; // AbstractStackWalker.doStackWalk()
+ static LatestMethodCache _is_substitutable_cache; // ValueObjectMethods.isSubstitutable()
+ static LatestMethodCache _value_object_hash_code_cache; // ValueObjectMethods.valueObjectHashCode()
// Known objects
TypeArrayKlass* Universe::_typeArrayKlasses[T_LONG+1] = { nullptr /*, nullptr...*/ };
ObjArrayKlass* Universe::_objectArrayKlass = nullptr;
Klass* Universe::_fillerArrayKlass = nullptr;
// Verify shared interfaces array.
assert(_the_array_interfaces_array->at(0) ==
vmClasses::Cloneable_klass(), "u3");
assert(_the_array_interfaces_array->at(1) ==
vmClasses::Serializable_klass(), "u3");
+
} else
#endif
{
// Set up shared interfaces array. (Do this before supers are set up.)
_the_array_interfaces_array->at_put(0, vmClasses::Cloneable_klass());
// Since some of the old system object arrays have been converted to
// ordinary object arrays, _objectArrayKlass will be loaded when
// SystemDictionary::initialize(CHECK); is run. See the extra check
// for Object_klass_loaded in objArrayKlassKlass::allocate_objArray_klass_impl.
{
- Klass* oak = vmClasses::Object_klass()->array_klass(CHECK);
- _objectArrayKlass = ObjArrayKlass::cast(oak);
+ ArrayKlass* oak = vmClasses::Object_klass()->array_klass(CHECK);
+ oak->append_to_sibling_list();
+
+ // Create a RefArrayKlass (which is the default) and initialize.
+ ObjArrayKlass* rak = ObjArrayKlass::cast(oak)->klass_with_properties(ArrayKlass::ArrayProperties::DEFAULT, THREAD);
+ _objectArrayKlass = rak;
}
- // OLD
- // Add the class to the class hierarchy manually to make sure that
- // its vtable is initialized after core bootstrapping is completed.
- // ---
- // New
- // Have already been initialized.
- _objectArrayKlass->append_to_sibling_list();
#ifdef ASSERT
if (FullGCALot) {
// Allocate an array of dummy objects.
// We'd like these to be at the bottom of the old generation,
// classes are always initialized first.
for (ClassHierarchyIterator iter(vmClasses::Object_klass()); !iter.done(); iter.next()) {
Klass* sub = iter.klass();
sub->vtable().initialize_vtable();
}
+
+ // This isn't added to the subclass list, so need to reinitialize vtables directly.
+ Universe::objectArrayKlass()->vtable().initialize_vtable();
}
static void reinitialize_itables() {
class ReinitTableClosure : public KlassClosure {
}
Universe::initialize_tlab();
Metaspace::global_initialize();
-
// Initialize performance counters for metaspaces
MetaspaceCounters::initialize_performance_counters();
// Checks 'AfterMemoryInit' constraints.
if (!JVMFlagLimit::check_all_constraints(JVMFlagConstraintPhase::AfterMemoryInit)) {
Method* Universe::finalizer_register_method() { return _finalizer_register_cache.get_method(); }
Method* Universe::loader_addClass_method() { return _loader_addClass_cache.get_method(); }
Method* Universe::throw_illegal_access_error() { return _throw_illegal_access_error_cache.get_method(); }
Method* Universe::throw_no_such_method_error() { return _throw_no_such_method_error_cache.get_method(); }
Method* Universe::do_stack_walk_method() { return _do_stack_walk_cache.get_method(); }
+ Method* Universe::is_substitutable_method() { return _is_substitutable_cache.get_method(); }
+ Method* Universe::value_object_hash_code_method() { return _value_object_hash_code_cache.get_method(); }
void Universe::initialize_known_methods(JavaThread* current) {
// Set up static method for registering finalizers
_finalizer_register_cache.init(current,
vmClasses::Finalizer_klass(),
// Set up method for stack walking
_do_stack_walk_cache.init(current,
vmClasses::AbstractStackWalker_klass(),
"doStackWalk",
vmSymbols::doStackWalk_signature(), false);
+
+ // Set up substitutability testing
+ ResourceMark rm(current);
+ _is_substitutable_cache.init(current,
+ vmClasses::ValueObjectMethods_klass(),
+ vmSymbols::isSubstitutable_name()->as_C_string(),
+ vmSymbols::object_object_boolean_signature(), true);
+ _value_object_hash_code_cache.init(current,
+ vmClasses::ValueObjectMethods_klass(),
+ vmSymbols::valueObjectHashCode_name()->as_C_string(),
+ vmSymbols::object_int_signature(), true);
}
void universe2_init() {
EXCEPTION_MARK;
Universe::genesis(CATCH);
< prev index next >