< prev index next >
src/hotspot/share/opto/parse2.cpp
Print this page
@@ -65,11 +65,11 @@
const TypeOopPtr* elemptr = elemtype->make_oopptr();
const TypeAryPtr* ary_t = _gvn.type(ary)->is_aryptr();
if (elemtype->isa_valuetype() != NULL) {
// Load from flattened value type array
ciValueKlass* vk = elemtype->is_valuetype()->value_klass();
- ValueTypeNode* vt = ValueTypeNode::make_from_flattened(this, vk, ary, adr);
+ Node* vt = ValueTypeNode::make_from_flattened(this, vk, ary, adr);
push(vt);
return;
} else if (elemptr != NULL && elemptr->is_valuetypeptr()) {
// Load from non-flattened value type array (elements can never be null)
bt = T_VALUETYPE;
@@ -152,13 +152,15 @@
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(bt);
Node* ld = access_load_at(ary, adr, adr_type, elemtype, bt,
IN_HEAP | IS_ARRAY | C2_CONTROL_DEPENDENT_LOAD);
if (bt == T_VALUETYPE) {
// Loading a non-flattened (but flattenable) value type from an array
- assert(!gvn().type(ld)->is_ptr()->maybe_null(), "value type array elements should never be null");
+ assert(!gvn().type(ld)->maybe_null(), "value type array elements should never be null");
+ if (elemptr->value_klass()->is_scalarizable()) {
ld = ValueTypeNode::make_from_oop(this, ld, elemptr->value_klass());
}
+ }
push_node(bt, ld);
}
@@ -180,22 +182,30 @@
if (bt == T_OBJECT) {
const TypeOopPtr* elemptr = elemtype->make_oopptr();
const Type* val_t = _gvn.type(val);
if (elemtype->isa_valuetype() != NULL) {
// Store to flattened value type array
- if (!val->is_ValueType() && val_t == TypePtr::NULL_PTR) {
+ val_t = _gvn.type(cast_val);
+ if (!cast_val->is_ValueType()) {
+ if (val_t->maybe_null()) {
// Can not store null into a value type array
+ assert(val_t == TypePtr::NULL_PTR, "Anything other than null?");
inc_sp(3);
uncommon_trap(Deoptimization::Reason_null_check, Deoptimization::Action_none);
return;
}
+ assert(!val_t->maybe_null(), "should never be null");
+ cast_val = ValueTypeNode::make_from_oop(this, cast_val, elemtype->is_valuetype()->value_klass());
+ }
cast_val->as_ValueType()->store_flattened(this, ary, adr);
return;
} else if (elemptr->is_valuetypeptr()) {
// Store to non-flattened value type array
- if (!val->is_ValueType() && val_t == TypePtr::NULL_PTR) {
+ val_t = _gvn.type(cast_val);
+ if (!cast_val->is_ValueType() && val_t->maybe_null()) {
// Can not store null into a value type array
+ assert(val_t == TypePtr::NULL_PTR, "Anything other than null?");
inc_sp(3);
uncommon_trap(Deoptimization::Reason_null_check, Deoptimization::Action_none);
return;
}
} else if (elemptr->can_be_value_type() && !ary_t->klass_is_exact() &&
@@ -229,19 +239,13 @@
val->as_ValueType()->store_flattened(this, ary, adr);
ideal.sync_kit(this);
} else {
if (TypePtr::NULL_PTR->higher_equal(val_t)) {
sync_kit(ideal);
- Node* null_ctl = top();
- val = null_check_oop(val, &null_ctl);
- {
- assert(null_ctl != top(), "expected to possibly be null");
- PreserveJVMState pjvms(this);
- set_control(null_ctl);
inc_sp(3);
- uncommon_trap(Deoptimization::Reason_null_check, Deoptimization::Action_none);
- }
+ val = filter_null(val);
+ dec_sp(3);
ideal.sync_kit(this);
}
if (!ideal.ctrl()->is_top()) {
ideal.make_leaf_call(OptoRuntime::store_unknown_value_Type(),
< prev index next >