< prev index next >

src/hotspot/share/opto/parse2.cpp

Print this page

        

@@ -228,11 +228,11 @@
       }
       cast_val->as_ValueType()->store_flattened(this, ary, adr);
       return;
     } else if (elemptr->is_valuetypeptr() && !elemptr->maybe_null()) {
       // Store to non-flattened but flattenable value type array (elements can never be null)
-      if (!cast_val->is_ValueType()) {
+      if (!cast_val->is_ValueType() && val_t->maybe_null()) {
         inc_sp(3);
         cast_val = null_check(cast_val);
         if (stopped()) return;
         dec_sp(3);
       }

@@ -263,11 +263,11 @@
           ideal.sync_kit(this);
         }
         ideal.else_();
         {
           // flattened
-          if (!cast_val->is_ValueType() && TypePtr::NULL_PTR->higher_equal(val_t)) {
+          if (!cast_val->is_ValueType() && val_t->maybe_null()) {
             // Add null check
             sync_kit(ideal);
             Node* null_ctl = top();
             cast_val = null_check_oop(cast_val, &null_ctl);
             if (null_ctl != top()) {
< prev index next >