Skip to content

Commit 819c691

Browse files
author
Vladimir Kozlov
committed
8295867: TestVerifyGraphEdges.java fails with exit code -1073741571 when using AlwaysIncrementalInline
Reviewed-by: chagedorn, shade
1 parent ced88a2 commit 819c691

File tree

4 files changed

+60
-48
lines changed

4 files changed

+60
-48
lines changed

src/hotspot/share/opto/compile.cpp

+57-2
Original file line numberDiff line numberDiff line change
@@ -4232,14 +4232,69 @@ bool Compile::needs_clinit_barrier(ciInstanceKlass* holder, ciMethod* accessing_
42324232
}
42334233

42344234
#ifndef PRODUCT
4235+
//------------------------------verify_bidirectional_edges---------------------
4236+
// For each input edge to a node (ie - for each Use-Def edge), verify that
4237+
// there is a corresponding Def-Use edge.
4238+
void Compile::verify_bidirectional_edges(Unique_Node_List &visited) {
4239+
// Allocate stack of size C->live_nodes()/16 to avoid frequent realloc
4240+
uint stack_size = live_nodes() >> 4;
4241+
Node_List nstack(MAX2(stack_size, (uint)OptoNodeListSize));
4242+
nstack.push(_root);
4243+
4244+
while (nstack.size() > 0) {
4245+
Node* n = nstack.pop();
4246+
if (visited.member(n)) {
4247+
continue;
4248+
}
4249+
visited.push(n);
4250+
4251+
// Walk over all input edges, checking for correspondence
4252+
uint length = n->len();
4253+
for (uint i = 0; i < length; i++) {
4254+
Node* in = n->in(i);
4255+
if (in != NULL && !visited.member(in)) {
4256+
nstack.push(in); // Put it on stack
4257+
}
4258+
if (in != NULL && !in->is_top()) {
4259+
// Count instances of `next`
4260+
int cnt = 0;
4261+
for (uint idx = 0; idx < in->_outcnt; idx++) {
4262+
if (in->_out[idx] == n) {
4263+
cnt++;
4264+
}
4265+
}
4266+
assert(cnt > 0, "Failed to find Def-Use edge.");
4267+
// Check for duplicate edges
4268+
// walk the input array downcounting the input edges to n
4269+
for (uint j = 0; j < length; j++) {
4270+
if (n->in(j) == in) {
4271+
cnt--;
4272+
}
4273+
}
4274+
assert(cnt == 0, "Mismatched edge count.");
4275+
} else if (in == NULL) {
4276+
assert(i == 0 || i >= n->req() ||
4277+
n->is_Region() || n->is_Phi() || n->is_ArrayCopy() ||
4278+
(n->is_Unlock() && i == (n->req() - 1)) ||
4279+
(n->is_MemBar() && i == 5), // the precedence edge to a membar can be removed during macro node expansion
4280+
"only region, phi, arraycopy, unlock or membar nodes have null data edges");
4281+
} else {
4282+
assert(in->is_top(), "sanity");
4283+
// Nothing to check.
4284+
}
4285+
}
4286+
}
4287+
}
4288+
42354289
//------------------------------verify_graph_edges---------------------------
42364290
// Walk the Graph and verify that there is a one-to-one correspondence
42374291
// between Use-Def edges and Def-Use edges in the graph.
42384292
void Compile::verify_graph_edges(bool no_dead_code) {
42394293
if (VerifyGraphEdges) {
42404294
Unique_Node_List visited;
4241-
// Call recursive graph walk to check edges
4242-
_root->verify_edges(visited);
4295+
4296+
// Call graph walk to check edges
4297+
verify_bidirectional_edges(visited);
42434298
if (no_dead_code) {
42444299
// Now make sure that no visited node is used by an unvisited node.
42454300
bool dead_nodes = false;

src/hotspot/share/opto/compile.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,9 @@ class Compile : public Phase {
11661166
// graph is strongly connected from root in both directions.
11671167
void verify_graph_edges(bool no_dead_code = false) PRODUCT_RETURN;
11681168

1169+
// Verify bi-directional correspondence of edges
1170+
void verify_bidirectional_edges(Unique_Node_List &visited);
1171+
11691172
// End-of-run dumps.
11701173
static void print_statistics() PRODUCT_RETURN;
11711174

src/hotspot/share/opto/node.cpp

-45
Original file line numberDiff line numberDiff line change
@@ -2680,51 +2680,6 @@ void Node::dump_comp(const char* suffix, outputStream *st) const {
26802680
}
26812681

26822682
// VERIFICATION CODE
2683-
// For each input edge to a node (ie - for each Use-Def edge), verify that
2684-
// there is a corresponding Def-Use edge.
2685-
//------------------------------verify_edges-----------------------------------
2686-
void Node::verify_edges(Unique_Node_List &visited) {
2687-
uint i, j, idx;
2688-
int cnt;
2689-
Node *n;
2690-
2691-
// Recursive termination test
2692-
if (visited.member(this)) return;
2693-
visited.push(this);
2694-
2695-
// Walk over all input edges, checking for correspondence
2696-
for( i = 0; i < len(); i++ ) {
2697-
n = in(i);
2698-
if (n != NULL && !n->is_top()) {
2699-
// Count instances of (Node *)this
2700-
cnt = 0;
2701-
for (idx = 0; idx < n->_outcnt; idx++ ) {
2702-
if (n->_out[idx] == (Node *)this) cnt++;
2703-
}
2704-
assert( cnt > 0,"Failed to find Def-Use edge." );
2705-
// Check for duplicate edges
2706-
// walk the input array downcounting the input edges to n
2707-
for( j = 0; j < len(); j++ ) {
2708-
if( in(j) == n ) cnt--;
2709-
}
2710-
assert( cnt == 0,"Mismatched edge count.");
2711-
} else if (n == NULL) {
2712-
assert(i >= req() || i == 0 || is_Region() || is_Phi() || is_ArrayCopy() || (is_Unlock() && i == req()-1)
2713-
|| (is_MemBar() && i == 5), // the precedence edge to a membar can be removed during macro node expansion
2714-
"only region, phi, arraycopy, unlock or membar nodes have null data edges");
2715-
} else {
2716-
assert(n->is_top(), "sanity");
2717-
// Nothing to check.
2718-
}
2719-
}
2720-
// Recursive walk over all input edges
2721-
for( i = 0; i < len(); i++ ) {
2722-
n = in(i);
2723-
if( n != NULL )
2724-
in(i)->verify_edges(visited);
2725-
}
2726-
}
2727-
27282683
// Verify all nodes if verify_depth is negative
27292684
void Node::verify(int verify_depth, VectorSet& visited, Node_List& worklist) {
27302685
assert(verify_depth != 0, "depth should not be 0");

src/hotspot/share/opto/node.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,6 @@ class Node {
12171217
// Print compact per-node info
12181218
virtual void dump_compact_spec(outputStream *st) const { dump_spec(st); }
12191219

1220-
void verify_edges(Unique_Node_List &visited); // Verify bi-directional edges
12211220
static void verify(int verify_depth, VectorSet& visited, Node_List& worklist);
12221221

12231222
// This call defines a class-unique string used to identify class instances

0 commit comments

Comments
 (0)