8047737: Move array component mirror to instance of java/lang/Class
Add field in java.lang.Class for componentType to simplify oop processing in JVM Reviewed-by: fparain, twisti
This commit is contained in:
parent
c689cebe98
commit
60ec6dfa0c
@ -618,6 +618,8 @@ void java_lang_Class::create_mirror(KlassHandle k, Handle class_loader,
|
||||
assert(comp_mirror.not_null(), "must have a mirror");
|
||||
|
||||
// Two-way link between the array klass and its component mirror:
|
||||
// (array_klass) k -> mirror -> component_mirror -> array_klass -> k
|
||||
set_component_mirror(mirror(), comp_mirror());
|
||||
ArrayKlass::cast(k())->set_component_mirror(comp_mirror());
|
||||
set_array_klass(comp_mirror(), k());
|
||||
} else {
|
||||
@ -679,6 +681,16 @@ void java_lang_Class::set_protection_domain(oop java_class, oop pd) {
|
||||
java_class->obj_field_put(_protection_domain_offset, pd);
|
||||
}
|
||||
|
||||
void java_lang_Class::set_component_mirror(oop java_class, oop comp_mirror) {
|
||||
if (_component_mirror_offset != 0) {
|
||||
java_class->obj_field_put(_component_mirror_offset, comp_mirror);
|
||||
}
|
||||
}
|
||||
oop java_lang_Class::component_mirror(oop java_class) {
|
||||
assert(_component_mirror_offset != 0, "must be set");
|
||||
return java_class->obj_field(_component_mirror_offset);
|
||||
}
|
||||
|
||||
oop java_lang_Class::init_lock(oop java_class) {
|
||||
assert(_init_lock_offset != 0, "must be set");
|
||||
return java_class->obj_field(_init_lock_offset);
|
||||
@ -875,6 +887,10 @@ void java_lang_Class::compute_offsets() {
|
||||
klass_oop, vmSymbols::classLoader_name(),
|
||||
vmSymbols::classloader_signature());
|
||||
|
||||
compute_optional_offset(_component_mirror_offset,
|
||||
klass_oop, vmSymbols::componentType_name(),
|
||||
vmSymbols::class_signature());
|
||||
|
||||
CLASS_INJECTED_FIELDS(INJECTED_FIELD_COMPUTE_OFFSET);
|
||||
}
|
||||
|
||||
@ -3097,6 +3113,7 @@ int java_lang_Class::_oop_size_offset;
|
||||
int java_lang_Class::_static_oop_field_count_offset;
|
||||
int java_lang_Class::_class_loader_offset;
|
||||
int java_lang_Class::_protection_domain_offset;
|
||||
int java_lang_Class::_component_mirror_offset;
|
||||
int java_lang_Class::_init_lock_offset;
|
||||
int java_lang_Class::_signers_offset;
|
||||
GrowableArray<Klass*>* java_lang_Class::_fixup_mirror_list = NULL;
|
||||
|
@ -241,6 +241,7 @@ class java_lang_Class : AllStatic {
|
||||
static int _init_lock_offset;
|
||||
static int _signers_offset;
|
||||
static int _class_loader_offset;
|
||||
static int _component_mirror_offset;
|
||||
|
||||
static bool offsets_computed;
|
||||
static int classRedefinedCount_offset;
|
||||
@ -250,6 +251,7 @@ class java_lang_Class : AllStatic {
|
||||
static void set_init_lock(oop java_class, oop init_lock);
|
||||
static void set_protection_domain(oop java_class, oop protection_domain);
|
||||
static void set_class_loader(oop java_class, oop class_loader);
|
||||
static void set_component_mirror(oop java_class, oop comp_mirror);
|
||||
static void initialize_mirror_fields(KlassHandle k, Handle mirror, Handle protection_domain, TRAPS);
|
||||
public:
|
||||
static void compute_offsets();
|
||||
@ -291,6 +293,7 @@ class java_lang_Class : AllStatic {
|
||||
// Support for embedded per-class oops
|
||||
static oop protection_domain(oop java_class);
|
||||
static oop init_lock(oop java_class);
|
||||
static oop component_mirror(oop java_class);
|
||||
static objArrayOop signers(oop java_class);
|
||||
static void set_signers(oop java_class, objArrayOop signers);
|
||||
|
||||
|
@ -573,6 +573,7 @@
|
||||
template(serializeAgentPropertiesToByteArray_name, "serializeAgentPropertiesToByteArray") \
|
||||
template(classRedefinedCount_name, "classRedefinedCount") \
|
||||
template(classLoader_name, "classLoader") \
|
||||
template(componentType_name, "componentType") \
|
||||
\
|
||||
/* trace signatures */ \
|
||||
TRACE_TEMPLATES(template) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user