< prev index next >
src/hotspot/share/opto/subnode.cpp
Print this page
@@ -1066,10 +1066,19 @@
// Verify that we understand the situation
if (con2 != (intptr_t) superklass->super_check_offset())
return NULL; // Might be element-klass loading from array klass
+ // Do not normalize comparisons between Java mirror loads from [V? to klass comparisons. The runtime type
+ // might be [V due to [V <: [V? and the klass for [V? and [V is the same but the component mirror is not.
+ if (superklass->is_obj_array_klass()) {
+ ciObjArrayKlass* ak = superklass->as_obj_array_klass();
+ if (!ak->storage_properties().is_null_free() && ak->element_klass()->is_valuetype()) {
+ return NULL;
+ }
+ }
+
// If 'superklass' has no subklasses and is not an interface, then we are
// assured that the only input which will pass the type check is
// 'superklass' itself.
//
// We could be more liberal here, and allow the optimization on interfaces
< prev index next >