Skip to content

Commit

Permalink
Merge lworld
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicente Romero committed Nov 1, 2023
2 parents 7e70c26 + c328c5f commit 11ad37d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
19 changes: 5 additions & 14 deletions src/hotspot/share/opto/cfgnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1997,8 +1997,8 @@ bool PhiNode::wait_for_region_igvn(PhaseGVN* phase) {
}

// Push inline type input nodes (and null) down through the phi recursively (can handle data loops).
InlineTypeNode* PhiNode::push_inline_types_through(PhaseGVN* phase, bool can_reshape, ciInlineKlass* vk, bool is_init) {
InlineTypeNode* vt = InlineTypeNode::make_null(*phase, vk)->clone_with_phis(phase, in(0), is_init);
InlineTypeNode* PhiNode::push_inline_types_through(PhaseGVN* phase, bool can_reshape, ciInlineKlass* vk) {
InlineTypeNode* vt = InlineTypeNode::make_null(*phase, vk)->clone_with_phis(phase, in(0), !_type->maybe_null());
if (can_reshape) {
// Replace phi right away to be able to use the inline
// type node when reaching the phi again through data loops.
Expand All @@ -2024,7 +2024,7 @@ InlineTypeNode* PhiNode::push_inline_types_through(PhaseGVN* phase, bool can_res
n = InlineTypeNode::make_null(*phase, vk);
} else if (n->is_Phi()) {
assert(can_reshape, "can only handle phis during IGVN");
n = phase->transform(n->as_Phi()->push_inline_types_through(phase, can_reshape, vk, is_init));
n = phase->transform(n->as_Phi()->push_inline_types_through(phase, can_reshape, vk));
}
while (casts.size() != 0) {
// Push the cast(s) through the InlineTypeNode
Expand Down Expand Up @@ -2594,8 +2594,6 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
worklist.push(this);
bool can_optimize = true;
ciInlineKlass* vk = nullptr;
// true if all IsInit inputs of all InlineType* nodes are true
bool is_init = true;
Node_List casts;

// TODO 8302217 We need to prevent endless pushing through
Expand Down Expand Up @@ -2633,14 +2631,9 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
const Type* t = phase->type(n);
if (n->is_InlineType() && (vk == nullptr || vk == t->inline_klass())) {
vk = (vk == nullptr) ? t->inline_klass() : vk;
if (phase->find_int_con(n->as_InlineType()->get_is_init(), 0) != 1) {
is_init = false;
}
} else if (n->is_Phi() && can_reshape && n->bottom_type()->isa_ptr()) {
worklist.push(n);
} else if (t->is_zero_type()) {
is_init = false;
} else {
} else if (!t->is_zero_type()) {
can_optimize = false;
}
}
Expand All @@ -2654,9 +2647,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
}
}
if (can_optimize && vk != nullptr) {
// TODO 8302217
// assert(!_type->isa_ptr() || _type->maybe_null() || is_init, "Phi not null but a possible null was seen");
return push_inline_types_through(phase, can_reshape, vk, is_init);
return push_inline_types_through(phase, can_reshape, vk);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/cfgnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ class PhiNode : public TypeNode {
}
Node* try_clean_mem_phi(PhaseGVN *phase);

InlineTypeNode* push_inline_types_through(PhaseGVN* phase, bool can_reshape, ciInlineKlass* vk, bool is_init);
InlineTypeNode* push_inline_types_through(PhaseGVN* phase, bool can_reshape, ciInlineKlass* vk);

virtual const Type* Value(PhaseGVN* phase) const;
virtual Node* Identity(PhaseGVN* phase);
Expand Down
19 changes: 13 additions & 6 deletions src/hotspot/share/opto/type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ const Type::Offset Type::Offset::bottom(Type::OffsetBot);

const Type::Offset Type::Offset::meet(const Type::Offset other) const {
// Either is 'TOP' offset? Return the other offset!
int offset = other._offset;
if (_offset == OffsetTop) return Offset(offset);
if (offset == OffsetTop) return Offset(_offset);
if (_offset == OffsetTop) return other;
if (other._offset == OffsetTop) return *this;
// If either is different, return 'BOTTOM' offset
if (_offset != offset) return bottom;
if (_offset != other._offset) return bottom;
return Offset(_offset);
}

Expand Down Expand Up @@ -4987,7 +4986,13 @@ const TypeAryPtr* TypeAryPtr::cast_to_not_flat(bool not_flat) const {
}
assert(!not_flat || !is_flat(), "inconsistency");
const TypeAry* new_ary = TypeAry::make(elem(), size(), is_stable(), is_flat(), not_flat, is_not_null_free());
return make(ptr(), const_oop(), new_ary, klass(), klass_is_exact(), _offset, _field_offset, _instance_id, _speculative, _inline_depth, _is_autobox_cache);
const TypeAryPtr* res = make(ptr(), const_oop(), new_ary, klass(), klass_is_exact(), _offset, _field_offset, _instance_id, _speculative, _inline_depth, _is_autobox_cache);
// We keep the speculative part if it contains information about flat-/nullability.
// Make sure it's removed if it's not better than the non-speculative type anymore.
if (res->speculative() == res->remove_speculative()) {
return res->remove_speculative();
}
return res;
}

//-------------------------------cast_to_not_null_free-------------------------
Expand All @@ -4999,6 +5004,8 @@ const TypeAryPtr* TypeAryPtr::cast_to_not_null_free(bool not_null_free) const {
const TypeAry* new_ary = TypeAry::make(elem(), size(), is_stable(), is_flat(), /* not_flat= */ not_null_free ? true : is_not_flat(), not_null_free);
const TypeAryPtr* res = make(ptr(), const_oop(), new_ary, klass(), klass_is_exact(), _offset, _field_offset,
_instance_id, _speculative, _inline_depth, _is_autobox_cache);
// We keep the speculative part if it contains information about flat-/nullability.
// Make sure it's removed if it's not better than the non-speculative type anymore.
if (res->speculative() == res->remove_speculative()) {
return res->remove_speculative();
}
Expand Down Expand Up @@ -5206,7 +5213,7 @@ const Type *TypeAryPtr::xmeet_helper(const Type *t) const {
} else if (below_centerline(ptr)) {
// Result is in a non-flat representation
off = Offset(flat_offset()).meet(Offset(tap->flat_offset()));
field_off = Offset::bottom;
field_off = (field_off == Offset::top) ? Offset::top : Offset::bottom;
} else if (flat_offset() == tap->flat_offset()) {
off = Offset(!is_flat() ? offset() : tap->offset());
field_off = !is_flat() ? field_offset() : tap->field_offset();
Expand Down

0 comments on commit 11ad37d

Please sign in to comment.