Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8266931: [lworld] [lw3] Test InlineTypeArrays.java fails because of incorrect instanceof behavior #413

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -862,7 +862,11 @@ Klass* SystemDictionary::find_instance_or_array_klass(Symbol* class_name,
k = SystemDictionary::find_instance_klass(ss.as_symbol(), class_loader, protection_domain);
}
if (k != NULL) {
k = k->array_klass_or_null(ndims);
if (class_name->is_Q_array_signature()) {
k = InlineKlass::cast(k)->null_free_inline_array_klass_or_null(ndims);
} else {
k = k->array_klass_or_null(ndims);
}
}
} else {
k = find_instance_klass(class_name, class_loader, protection_domain);
@@ -1885,7 +1889,11 @@ Klass* SystemDictionary::find_constrained_instance_or_array_klass(
}
// If element class already loaded, allocate array klass
if (klass != NULL) {
klass = klass->array_klass_or_null(ndims);
if (class_name->is_Q_array_signature()) {
klass = InlineKlass::cast(klass)->null_free_inline_array_klass_or_null(ndims);
} else {
klass = klass->array_klass_or_null(ndims);
}
}
} else {
MutexLocker mu(current, SystemDictionary_lock);
@@ -102,7 +102,7 @@ FlatArrayKlass* FlatArrayKlass::allocate_klass(Klass* eklass, TRAPS) {
Klass* element_super = element_klass->super();
if (element_super != NULL) {
// The element type has a direct super. E.g., String[] has direct super of Object[].
super_klass = element_super->array_klass_or_null();
super_klass = element_klass->array_klass_or_null();
bool supers_exist = super_klass != NULL;
// Also, see if the element has secondary supertypes.
// We need an array type for each.
@@ -119,7 +119,7 @@ FlatArrayKlass* FlatArrayKlass::allocate_klass(Klass* eklass, TRAPS) {
Klass* ek = NULL;
{
MutexUnlocker mu(MultiArray_lock);
super_klass = element_super->array_klass(CHECK_NULL);
super_klass = element_klass->array_klass(CHECK_NULL);
for( int i = element_supers->length()-1; i >= 0; i-- ) {
Klass* elem_super = element_supers->at(i);
elem_super->array_klass(CHECK_NULL);
@@ -409,25 +409,21 @@ GrowableArray<Klass*>* FlatArrayKlass::compute_secondary_supers(int num_extra_sl
assert(transitive_interfaces == NULL, "sanity");
// interfaces = { cloneable_klass, serializable_klass, elemSuper[], ... };
Array<Klass*>* elem_supers = element_klass()->secondary_supers();
assert(elem_supers->length() > 0, "Must at least include the PrimitiveObject interface");
int num_elem_supers = elem_supers == NULL ? 0 : elem_supers->length();
int num_secondaries = num_extra_slots + 2 + num_elem_supers;
if (num_secondaries == 2) {
// Must share this for correct bootstrapping!
set_secondary_supers(Universe::the_array_interfaces_array());
return NULL;
} else {
GrowableArray<Klass*>* secondaries = new GrowableArray<Klass*>(num_elem_supers+3);
secondaries->push(vmClasses::Cloneable_klass());
secondaries->push(vmClasses::Serializable_klass());
secondaries->push(vmClasses::IdentityObject_klass());
for (int i = 0; i < num_elem_supers; i++) {
Klass* elem_super = (Klass*) elem_supers->at(i);
Klass* array_super = elem_super->array_klass_or_null();
assert(array_super != NULL, "must already have been created");
secondaries->push(array_super);
}
return secondaries;
GrowableArray<Klass*>* secondaries = new GrowableArray<Klass*>(num_elem_supers+4);

secondaries->push(vmClasses::Cloneable_klass());
secondaries->push(vmClasses::Serializable_klass());
secondaries->push(vmClasses::IdentityObject_klass());
for (int i = 0; i < num_elem_supers; i++) {
Klass* elem_super = (Klass*) elem_supers->at(i);
Klass* array_super = elem_super->array_klass_or_null();
assert(array_super != NULL, "must already have been created");
secondaries->push(array_super);
}
return secondaries;
}

void FlatArrayKlass::print_on(outputStream* st) const {
@@ -68,7 +68,11 @@ ObjArrayKlass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_da
Klass* element_super = element_klass->super();
if (element_super != NULL) {
// The element type has a direct super. E.g., String[] has direct super of Object[].
super_klass = element_super->array_klass_or_null();
if (null_free) {
super_klass = element_klass->array_klass_or_null();
} else {
super_klass = element_super->array_klass_or_null();
}
bool supers_exist = super_klass != NULL;
// Also, see if the element has secondary supertypes.
// We need an array type for each.
@@ -80,12 +84,21 @@ ObjArrayKlass* ObjArrayKlass::allocate_objArray_klass(ClassLoaderData* loader_da
break;
}
}
if (null_free) {
if (element_klass->array_klass_or_null() == NULL) {
supers_exist = false;
}
}
if (!supers_exist) {
// Oops. Not allocated yet. Back out, allocate it, and retry.
Klass* ek = NULL;
{
MutexUnlocker mu(MultiArray_lock);
super_klass = element_super->array_klass(CHECK_NULL);
if (null_free) {
element_klass->array_klass(CHECK_NULL);
} else {
element_super->array_klass(CHECK_NULL);
}
for( int i = element_supers->length()-1; i >= 0; i-- ) {
Klass* elem_super = element_supers->at(i);
elem_super->array_klass(CHECK_NULL);
@@ -131,6 +144,8 @@ ObjArrayKlass::ObjArrayKlass(int n, Klass* element_klass, Symbol* name, bool nul
set_dimension(n);
set_element_klass(element_klass);

assert(!null_free || name->is_Q_array_signature(), "sanity check");

Klass* bk;
if (element_klass->is_objArray_klass()) {
bk = ObjArrayKlass::cast(element_klass)->bottom_klass();
@@ -185,7 +200,7 @@ objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
oop ObjArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
int length = *sizes;
if (rank == 1) { // last dim may be flatArray, check if we have any special storage requirements
if (name()->is_Q_array_signature()) {
if (name()->char_at(1) != JVM_SIGNATURE_ARRAY && name()->is_Q_array_signature()) {
return oopFactory::new_flatArray(element_klass(), length, CHECK_NULL);
} else {
return oopFactory::new_objArray(element_klass(), length, CHECK_NULL);
@@ -65,7 +65,7 @@ public void run() {
}

void testClassForName() {
String arrayClsName = "[Lruntime.valhalla.inlinetypes.Point$ref;";
String arrayClsName = "[Lruntime.valhalla.inlinetypes.Point;";
String qarrayClsName = "[Qruntime.valhalla.inlinetypes.Point;";
try {
// L-type..