Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/hotspot/share/opto/inlinetypenode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,19 @@ bool InlineTypeNode::has_phi_inputs(Node* region) {
}

// Merges 'this' with 'other' by updating the input PhiNodes added by 'clone_with_phis'
InlineTypeNode* InlineTypeNode::merge_with(PhaseGVN* gvn, const InlineTypeNode* other, int pnum, bool transform) {
InlineTypeNode* InlineTypeNode::merge_with(PhaseGVN* gvn, const InlineTypeNode* other, int phi_index, bool transform) {
assert(inline_klass() == other->inline_klass(), "Merging incompatible types");

// Merge oop inputs
PhiNode* phi = get_oop()->as_Phi();
phi->set_req(pnum, other->get_oop());
phi->set_req(phi_index, other->get_oop());
if (transform) {
set_oop(*gvn, gvn->transform(phi));
}

// Merge is_buffered inputs
phi = get_is_buffered()->as_Phi();
phi->set_req(pnum, other->get_is_buffered());
phi->set_req(phi_index, other->get_is_buffered());
if (transform) {
set_req(IsBuffered, gvn->transform(phi));
}
Expand All @@ -142,7 +142,7 @@ InlineTypeNode* InlineTypeNode::merge_with(PhaseGVN* gvn, const InlineTypeNode*
Node* null_marker = get_null_marker();
if (null_marker->is_Phi()) {
phi = null_marker->as_Phi();
phi->set_req(pnum, other->get_null_marker());
phi->set_req(phi_index, other->get_null_marker());
if (transform) {
set_req(NullMarker, gvn->transform(phi));
}
Expand All @@ -158,10 +158,15 @@ InlineTypeNode* InlineTypeNode::merge_with(PhaseGVN* gvn, const InlineTypeNode*
if (val2->is_Phi()) {
val2 = gvn->transform(val2);
}
val1->as_InlineType()->merge_with(gvn, val2->as_InlineType(), pnum, transform);
if (val2->is_top()) {
// The path where 'other' is used is dying. Therefore, we do not need to process the merge with 'other' further.
// The phi inputs of 'this' at 'phi_index' will eventually be removed.
break;
}
val1->as_InlineType()->merge_with(gvn, val2->as_InlineType(), phi_index, transform);
} else {
assert(val1->is_Phi(), "must be a phi node");
val1->set_req(pnum, val2);
val1->set_req(phi_index, val2);
}
if (transform) {
set_field_value(i, gvn->transform(val1));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/inlinetypenode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class InlineTypeNode : public TypeNode {
// Support for control flow merges
bool has_phi_inputs(Node* region);
InlineTypeNode* clone_with_phis(PhaseGVN* gvn, Node* region, SafePointNode* map = nullptr, bool is_non_null = false, bool init_with_top = false);
InlineTypeNode* merge_with(PhaseGVN* gvn, const InlineTypeNode* other, int pnum, bool transform);
InlineTypeNode* merge_with(PhaseGVN* gvn, const InlineTypeNode* other, int phi_index, bool transform);
void add_new_path(Node* region);

// Get oop for heap allocated inline type (may be TypePtr::NULL_PTR)
Expand Down