< prev index next >

src/hotspot/share/opto/compile.cpp

Print this page

        

@@ -4300,12 +4300,19 @@
   if (superk == env()->Object_klass()) {
     return SSC_always_true;     // (0) this test cannot fail
   }
 
   ciType* superelem = superk;
-  if (superelem->is_array_klass())
+  if (superelem->is_array_klass()) {
+    ciArrayKlass* ak = superelem->as_array_klass();
+    // Do not perform the subtype check on the element klasses for [V? arrays. 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 (ak->is_obj_array_klass() && !ak->storage_properties().is_null_free() && ak->element_klass()->is_valuetype()) {
+      return SSC_full_test;
+    }
     superelem = superelem->as_array_klass()->base_element_type();
+  }
 
   if (!subk->is_interface()) {  // cannot trust static interface types yet
     if (subk->is_subtype_of(superk)) {
       return SSC_always_true;   // (1) false path dead; no dynamic test needed
     }
< prev index next >