8254269: simplify Node::disconnect_inputs
Node::disconnect_inputs cuts off all input edges without exception. Reviewed-by: redestad, kvn
This commit is contained in:
parent
d7128e7dac
commit
bff586f07a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -429,7 +429,7 @@ void LateInlineCallGenerator::do_late_inline() {
|
||||
// This check is done here because for_method_handle_inline() method
|
||||
// needs jvms for inlined state.
|
||||
if (!do_late_inline_check(jvms)) {
|
||||
map->disconnect_inputs(NULL, C);
|
||||
map->disconnect_inputs(C);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2772,7 +2772,7 @@ void Compile::eliminate_redundant_card_marks(Node* n) {
|
||||
// Eliminate the previous StoreCM
|
||||
prev->set_req(MemNode::Memory, mem->in(MemNode::Memory));
|
||||
assert(mem->outcnt() == 0, "should be dead");
|
||||
mem->disconnect_inputs(NULL, this);
|
||||
mem->disconnect_inputs(this);
|
||||
} else {
|
||||
prev = mem;
|
||||
}
|
||||
@ -3054,7 +3054,7 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
|
||||
n->set_req(AddPNode::Base, nn);
|
||||
n->set_req(AddPNode::Address, nn);
|
||||
if (addp->outcnt() == 0) {
|
||||
addp->disconnect_inputs(NULL, this);
|
||||
addp->disconnect_inputs(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3127,12 +3127,12 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
|
||||
|
||||
n->subsume_by(new_in1, this);
|
||||
if (in1->outcnt() == 0) {
|
||||
in1->disconnect_inputs(NULL, this);
|
||||
in1->disconnect_inputs(this);
|
||||
}
|
||||
} else {
|
||||
n->subsume_by(n->in(1), this);
|
||||
if (n->outcnt() == 0) {
|
||||
n->disconnect_inputs(NULL, this);
|
||||
n->disconnect_inputs(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -3210,10 +3210,10 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
|
||||
Node* cmpN = new CmpNNode(in1->in(1), new_in2);
|
||||
n->subsume_by(cmpN, this);
|
||||
if (in1->outcnt() == 0) {
|
||||
in1->disconnect_inputs(NULL, this);
|
||||
in1->disconnect_inputs(this);
|
||||
}
|
||||
if (in2->outcnt() == 0) {
|
||||
in2->disconnect_inputs(NULL, this);
|
||||
in2->disconnect_inputs(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3244,7 +3244,7 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
|
||||
}
|
||||
}
|
||||
if (in1->outcnt() == 0) {
|
||||
in1->disconnect_inputs(NULL, this);
|
||||
in1->disconnect_inputs(this);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3410,7 +3410,7 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
|
||||
}
|
||||
}
|
||||
if (in2->outcnt() == 0) { // Remove dead node
|
||||
in2->disconnect_inputs(NULL, this);
|
||||
in2->disconnect_inputs(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -3442,7 +3442,7 @@ void Compile::final_graph_reshaping_main_switch(Node* n, Final_Reshape_Counts& f
|
||||
wq.push(in);
|
||||
}
|
||||
}
|
||||
m->disconnect_inputs(NULL, this);
|
||||
m->disconnect_inputs(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3585,7 +3585,7 @@ void Compile::final_graph_reshaping_walk( Node_Stack &nstack, Node *root, Final_
|
||||
n->set_req(j, in->in(1));
|
||||
}
|
||||
if (in->outcnt() == 0) {
|
||||
in->disconnect_inputs(NULL, this);
|
||||
in->disconnect_inputs(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ void GraphKit::verify_exception_state(SafePointNode* ex_map) {
|
||||
void GraphKit::stop_and_kill_map() {
|
||||
SafePointNode* dead_map = stop();
|
||||
if (dead_map != NULL) {
|
||||
dead_map->disconnect_inputs(NULL, C); // Mark the map as killed.
|
||||
dead_map->disconnect_inputs(C); // Mark the map as killed.
|
||||
assert(dead_map->is_killed(), "must be so marked");
|
||||
}
|
||||
}
|
||||
@ -1960,7 +1960,7 @@ void GraphKit::replace_call(CallNode* call, Node* result, bool do_replaced_nodes
|
||||
}
|
||||
|
||||
// Disconnect the call from the graph
|
||||
call->disconnect_inputs(NULL, C);
|
||||
call->disconnect_inputs(C);
|
||||
C->gvn_replace_by(call, C->top());
|
||||
|
||||
// Clean up any MergeMems that feed other MergeMems since the
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -616,7 +616,7 @@ bool PhaseChaitin::remove_node_if_not_used(Block* b, uint location, Node* n, uin
|
||||
if (lrg._def == n) {
|
||||
lrg._def = 0;
|
||||
}
|
||||
n->disconnect_inputs(NULL, C);
|
||||
n->disconnect_inputs(C);
|
||||
_cfg.unmap_node_from_block(n);
|
||||
n->replace_by(C->top());
|
||||
return true;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -449,7 +449,7 @@ void PhaseCFG::implicit_null_check(Block* block, Node *proj, Node *val, int allo
|
||||
old_tst->set_req(i3, NULL);
|
||||
if (in->outcnt() == 0) {
|
||||
// Remove dead input node
|
||||
in->disconnect_inputs(NULL, C);
|
||||
in->disconnect_inputs(C);
|
||||
block->find_remove(in);
|
||||
}
|
||||
}
|
||||
@ -1369,7 +1369,7 @@ void PhaseCFG::call_catch_cleanup(Block* block) {
|
||||
|
||||
// Remove the now-dead cloned ops
|
||||
for(uint i3 = beg; i3 < end; i3++ ) {
|
||||
block->get_node(beg)->disconnect_inputs(NULL, C);
|
||||
block->get_node(beg)->disconnect_inputs(C);
|
||||
block->remove_node(beg);
|
||||
}
|
||||
|
||||
@ -1382,7 +1382,7 @@ void PhaseCFG::call_catch_cleanup(Block* block) {
|
||||
Node *n = sb->get_node(j);
|
||||
if (n->outcnt() == 0 &&
|
||||
(!n->is_Proj() || n->as_Proj()->in(0)->outcnt() == 1) ){
|
||||
n->disconnect_inputs(NULL, C);
|
||||
n->disconnect_inputs(C);
|
||||
sb->remove_node(j);
|
||||
new_cnt--;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -2460,7 +2460,7 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
|
||||
Node *slow_ctrl = _fallthroughproj->clone();
|
||||
transform_later(slow_ctrl);
|
||||
_igvn.hash_delete(_fallthroughproj);
|
||||
_fallthroughproj->disconnect_inputs(NULL, C);
|
||||
_fallthroughproj->disconnect_inputs(C);
|
||||
region->init_req(1, slow_ctrl);
|
||||
// region inputs are now complete
|
||||
transform_later(region);
|
||||
@ -2528,7 +2528,7 @@ void PhaseMacroExpand::expand_unlock_node(UnlockNode *unlock) {
|
||||
Node *slow_ctrl = _fallthroughproj->clone();
|
||||
transform_later(slow_ctrl);
|
||||
_igvn.hash_delete(_fallthroughproj);
|
||||
_fallthroughproj->disconnect_inputs(NULL, C);
|
||||
_fallthroughproj->disconnect_inputs(C);
|
||||
region->init_req(1, slow_ctrl);
|
||||
// region inputs are now complete
|
||||
transform_later(region);
|
||||
|
@ -894,33 +894,22 @@ int Node::replace_edges_in_range(Node* old, Node* neww, int start, int end) {
|
||||
|
||||
//-------------------------disconnect_inputs-----------------------------------
|
||||
// NULL out all inputs to eliminate incoming Def-Use edges.
|
||||
// Return the number of edges between 'n' and 'this'
|
||||
int Node::disconnect_inputs(Node *n, Compile* C) {
|
||||
int edges_to_n = 0;
|
||||
|
||||
uint cnt = req();
|
||||
for( uint i = 0; i < cnt; ++i ) {
|
||||
if( in(i) == 0 ) continue;
|
||||
if( in(i) == n ) ++edges_to_n;
|
||||
set_req(i, NULL);
|
||||
void Node::disconnect_inputs(Compile* C) {
|
||||
for (uint i = 0; i < req(); ++i) {
|
||||
if (in(i) != nullptr) {
|
||||
set_req(i, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove precedence edges if any exist
|
||||
// Note: Safepoints may have precedence edges, even during parsing
|
||||
if( (req() != len()) && (in(req()) != NULL) ) {
|
||||
uint max = len();
|
||||
for( uint i = 0; i < max; ++i ) {
|
||||
if( in(i) == 0 ) continue;
|
||||
if( in(i) == n ) ++edges_to_n;
|
||||
set_prec(i, NULL);
|
||||
}
|
||||
for (uint i = req(); i < len(); ++i) {
|
||||
set_prec(i, nullptr);
|
||||
}
|
||||
|
||||
// Node::destruct requires all out edges be deleted first
|
||||
// debug_only(destruct();) // no reuse benefit expected
|
||||
if (edges_to_n == 0) {
|
||||
C->record_dead_node(_idx);
|
||||
}
|
||||
return edges_to_n;
|
||||
C->record_dead_node(_idx);
|
||||
}
|
||||
|
||||
//-----------------------------uncast---------------------------------------
|
||||
|
@ -446,8 +446,7 @@ protected:
|
||||
int replace_edge(Node* old, Node* neww);
|
||||
int replace_edges_in_range(Node* old, Node* neww, int start, int end);
|
||||
// NULL out all inputs to eliminate incoming Def-Use edges.
|
||||
// Return the number of edges between 'n' and 'this'
|
||||
int disconnect_inputs(Node *n, Compile *c);
|
||||
void disconnect_inputs(Compile* C);
|
||||
|
||||
// Quickly, return true if and only if I am Compile::current()->top().
|
||||
bool is_top() const {
|
||||
@ -517,7 +516,7 @@ public:
|
||||
// and cutting input edges of old node.
|
||||
void subsume_by(Node* new_node, Compile* c) {
|
||||
replace_by(new_node);
|
||||
disconnect_inputs(NULL, c);
|
||||
disconnect_inputs(c);
|
||||
}
|
||||
void set_req_X( uint i, Node *n, PhaseIterGVN *igvn );
|
||||
// Find the one non-null required input. RegionNode only
|
||||
|
@ -152,7 +152,7 @@ int PhaseChaitin::yank_if_dead_recurse(Node *old, Node *orig_old, Block *current
|
||||
}
|
||||
}
|
||||
// Disconnect control and remove precedence edges if any exist
|
||||
old->disconnect_inputs(NULL, C);
|
||||
old->disconnect_inputs(C);
|
||||
}
|
||||
return blk_adjust;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -785,7 +785,7 @@ uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
|
||||
if (i >= cnt) { // Found one unique input
|
||||
assert(_lrg_map.find_id(n) == _lrg_map.find_id(u), "should be the same lrg");
|
||||
n->replace_by(u); // Then replace with unique input
|
||||
n->disconnect_inputs(NULL, C);
|
||||
n->disconnect_inputs(C);
|
||||
b->remove_node(insidx);
|
||||
insidx--;
|
||||
b->_ihrp_index--;
|
||||
|
@ -249,13 +249,13 @@ class StringConcat : public ResourceObj {
|
||||
|
||||
_stringopts->gvn()->transform(call);
|
||||
C->gvn_replace_by(uct, call);
|
||||
uct->disconnect_inputs(NULL, C);
|
||||
uct->disconnect_inputs(C);
|
||||
}
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
// disconnect the hook node
|
||||
_arguments->disconnect_inputs(NULL, _stringopts->C);
|
||||
_arguments->disconnect_inputs(_stringopts->C);
|
||||
}
|
||||
};
|
||||
|
||||
@ -373,7 +373,7 @@ void StringConcat::eliminate_initialize(InitializeNode* init) {
|
||||
C->gvn_replace_by(mem_proj, mem);
|
||||
}
|
||||
C->gvn_replace_by(init, C->top());
|
||||
init->disconnect_inputs(NULL, C);
|
||||
init->disconnect_inputs(C);
|
||||
}
|
||||
|
||||
Node_List PhaseStringOpts::collect_toString_calls() {
|
||||
@ -1983,6 +1983,6 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
|
||||
kit.replace_call(sc->end(), result);
|
||||
|
||||
// Unhook any hook nodes
|
||||
string_sizes->disconnect_inputs(NULL, C);
|
||||
string_sizes->disconnect_inputs(C);
|
||||
sc->cleanup();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user