Skip to content

Commit fbfd4ea

Browse files
y1yang0TobiHartmann
authored andcommittedApr 27, 2021
8265914: Duplicated NotANode and not_a_node
Reviewed-by: thartmann
1 parent 9481fad commit fbfd4ea

File tree

5 files changed

+22
-36
lines changed

5 files changed

+22
-36
lines changed
 

‎src/hotspot/share/opto/compile.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,6 @@ void Compile::gvn_replace_by(Node* n, Node* nn) {
287287
}
288288

289289

290-
static inline bool not_a_node(const Node* n) {
291-
if (n == NULL) return true;
292-
if (((intptr_t)n & 1) != 0) return true; // uninitialized, etc.
293-
if (*(address*)n == badAddress) return true; // kill by Node::destruct
294-
return false;
295-
}
296-
297290
// Identify all nodes that are reachable from below, useful.
298291
// Use breadth-first pass that records state in a Unique_Node_List,
299292
// recursive traversal is slower.

‎src/hotspot/share/opto/multnode.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ void ProjNode::dump_spec(outputStream *st) const { st->print("#%d",_con); if(_is
140140
void ProjNode::dump_compact_spec(outputStream *st) const {
141141
for (DUIterator i = this->outs(); this->has_out(i); i++) {
142142
Node* o = this->out(i);
143-
if (NotANode(o)) {
143+
if (not_a_node(o)) {
144144
st->print("[?]");
145145
} else if (o == NULL) {
146146
st->print("[_]");

‎src/hotspot/share/opto/node.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ Node* Node::find(const int idx, bool only_ctrl) {
16591659
}
16601660

16611661
bool Node::add_to_worklist(Node* n, Node_List* worklist, Arena* old_arena, VectorSet* old_space, VectorSet* new_space) {
1662-
if (NotANode(n)) {
1662+
if (not_a_node(n)) {
16631663
return false; // Gracefully handle NULL, -1, 0xabababab, etc.
16641664
}
16651665

@@ -1687,14 +1687,14 @@ static bool is_disconnected(const Node* n) {
16871687
void Node::dump_orig(outputStream *st, bool print_key) const {
16881688
Compile* C = Compile::current();
16891689
Node* orig = _debug_orig;
1690-
if (NotANode(orig)) orig = NULL;
1690+
if (not_a_node(orig)) orig = NULL;
16911691
if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL;
16921692
if (orig == NULL) return;
16931693
if (print_key) {
16941694
st->print(" !orig=");
16951695
}
16961696
Node* fast = orig->debug_orig(); // tortoise & hare algorithm to detect loops
1697-
if (NotANode(fast)) fast = NULL;
1697+
if (not_a_node(fast)) fast = NULL;
16981698
while (orig != NULL) {
16991699
bool discon = is_disconnected(orig); // if discon, print [123] else 123
17001700
if (discon) st->print("[");
@@ -1703,16 +1703,16 @@ void Node::dump_orig(outputStream *st, bool print_key) const {
17031703
st->print("%d", orig->_idx);
17041704
if (discon) st->print("]");
17051705
orig = orig->debug_orig();
1706-
if (NotANode(orig)) orig = NULL;
1706+
if (not_a_node(orig)) orig = NULL;
17071707
if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL;
17081708
if (orig != NULL) st->print(",");
17091709
if (fast != NULL) {
17101710
// Step fast twice for each single step of orig:
17111711
fast = fast->debug_orig();
1712-
if (NotANode(fast)) fast = NULL;
1712+
if (not_a_node(fast)) fast = NULL;
17131713
if (fast != NULL && fast != orig) {
17141714
fast = fast->debug_orig();
1715-
if (NotANode(fast)) fast = NULL;
1715+
if (not_a_node(fast)) fast = NULL;
17161716
}
17171717
if (fast == orig) {
17181718
st->print("...");
@@ -1725,7 +1725,7 @@ void Node::dump_orig(outputStream *st, bool print_key) const {
17251725
void Node::set_debug_orig(Node* orig) {
17261726
_debug_orig = orig;
17271727
if (BreakAtNode == 0) return;
1728-
if (NotANode(orig)) orig = NULL;
1728+
if (not_a_node(orig)) orig = NULL;
17291729
int trip = 10;
17301730
while (orig != NULL) {
17311731
if (orig->debug_idx() == BreakAtNode || (int)orig->_idx == BreakAtNode) {
@@ -1734,7 +1734,7 @@ void Node::set_debug_orig(Node* orig) {
17341734
BREAKPOINT;
17351735
}
17361736
orig = orig->debug_orig();
1737-
if (NotANode(orig)) orig = NULL;
1737+
if (not_a_node(orig)) orig = NULL;
17381738
if (trip-- <= 0) break;
17391739
}
17401740
}
@@ -1830,8 +1830,8 @@ void Node::dump_req(outputStream *st) const {
18301830
Node* d = in(i);
18311831
if (d == NULL) {
18321832
st->print("_ ");
1833-
} else if (NotANode(d)) {
1834-
st->print("NotANode "); // uninitialized, sentinel, garbage, etc.
1833+
} else if (not_a_node(d)) {
1834+
st->print("not_a_node "); // uninitialized, sentinel, garbage, etc.
18351835
} else {
18361836
st->print("%c%d ", Compile::current()->node_arena()->contains(d) ? ' ' : 'o', d->_idx);
18371837
}
@@ -1847,7 +1847,7 @@ void Node::dump_prec(outputStream *st) const {
18471847
Node* p = in(i);
18481848
if (p != NULL) {
18491849
if (!any_prec++) st->print(" |");
1850-
if (NotANode(p)) { st->print("NotANode "); continue; }
1850+
if (not_a_node(p)) { st->print("not_a_node "); continue; }
18511851
st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
18521852
}
18531853
}
@@ -1862,8 +1862,8 @@ void Node::dump_out(outputStream *st) const {
18621862
Node* u = _out[i];
18631863
if (u == NULL) {
18641864
st->print("_ ");
1865-
} else if (NotANode(u)) {
1866-
st->print("NotANode ");
1865+
} else if (not_a_node(u)) {
1866+
st->print("not_a_node ");
18671867
} else {
18681868
st->print("%c%d ", Compile::current()->node_arena()->contains(u) ? ' ' : 'o', u->_idx);
18691869
}
@@ -1900,7 +1900,7 @@ static void collect_nodes_i(GrowableArray<Node*>* queue, const Node* start, int
19001900
for(uint k = 0; k < limit; k++) {
19011901
Node* n = direction > 0 ? tp->in(k) : tp->raw_out(k);
19021902

1903-
if (NotANode(n)) continue;
1903+
if (not_a_node(n)) continue;
19041904
// do not recurse through top or the root (would reach unrelated stuff)
19051905
if (n->is_Root() || n->is_top()) continue;
19061906
if (only_ctrl && !n->is_CFG()) continue;
@@ -1921,7 +1921,7 @@ static void collect_nodes_i(GrowableArray<Node*>* queue, const Node* start, int
19211921

19221922
//------------------------------dump_nodes-------------------------------------
19231923
static void dump_nodes(const Node* start, int d, bool only_ctrl) {
1924-
if (NotANode(start)) return;
1924+
if (not_a_node(start)) return;
19251925

19261926
GrowableArray <Node *> queue(Compile::current()->live_nodes());
19271927
collect_nodes_i(&queue, start, d, (uint) ABS(d), true, only_ctrl, false);
@@ -2089,7 +2089,7 @@ static void collect_nodes_in(Node* start, GrowableArray<Node*> *ns, bool primary
20892089
Node* current = nodes.at(n_idx++);
20902090
for (uint i = 0; i < current->len(); i++) {
20912091
Node* n = current->in(i);
2092-
if (NotANode(n)) {
2092+
if (not_a_node(n)) {
20932093
continue;
20942094
}
20952095
if ((primary_is_data && n->is_CFG()) || (!primary_is_data && !n->is_CFG())) {
@@ -2151,7 +2151,7 @@ void Node::collect_nodes_out_all_ctrl_boundary(GrowableArray<Node*> *ns) const {
21512151
nodes.push((Node*) this);
21522152
while (nodes.length() > 0) {
21532153
Node* current = nodes.pop();
2154-
if (NotANode(current)) {
2154+
if (not_a_node(current)) {
21552155
continue;
21562156
}
21572157
ns->append_if_missing(current);

‎src/hotspot/share/opto/node.hpp

+1-8
Original file line numberDiff line numberDiff line change
@@ -1250,20 +1250,13 @@ class Node {
12501250
}
12511251
};
12521252

1253-
1254-
#ifndef PRODUCT
1255-
1256-
// Used in debugging code to avoid walking across dead or uninitialized edges.
1257-
inline bool NotANode(const Node* n) {
1253+
inline bool not_a_node(const Node* n) {
12581254
if (n == NULL) return true;
12591255
if (((intptr_t)n & 1) != 0) return true; // uninitialized, etc.
12601256
if (*(address*)n == badAddress) return true; // kill by Node::destruct
12611257
return false;
12621258
}
12631259

1264-
#endif
1265-
1266-
12671260
//-----------------------------------------------------------------------------
12681261
// Iterators over DU info, and associated Node functions.
12691262

‎src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/opto/Node.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public ArrayList<Node> collect(int d, boolean onlyCtrl) {
152152
for(int k = 0; k < limit; k++) {
153153
Node n = d > 0 ? tp.in(k) : tp.rawOut(k);
154154

155-
// if (NotANode(n)) continue;
155+
// if (not_a_node(n)) continue;
156156
if (n == null) continue;
157157
// do not recurse through top or the root (would reach unrelated stuff)
158158
// if (n.isRoot() || n.isTop()) continue;
@@ -254,8 +254,8 @@ void dumpOut(PrintStream out) {
254254
Node u = rawOut(i);
255255
if (u == null) {
256256
out.print("_ ");
257-
// } else if (NotANode(u)) {
258-
// out.print("NotANode ");
257+
// } else if (not_a_node(u)) {
258+
// out.print("not_a_node ");
259259
} else {
260260
// out.print("%c%d ", Compile::current()->nodeArena()->contains(u) ? ' ' : 'o', u->_idx);
261261
out.print(' ');

0 commit comments

Comments
 (0)
Please sign in to comment.