8295867: TestVerifyGraphEdges.java fails with exit code -1073741571 when using AlwaysIncrementalInline

Reviewed-by: chagedorn, shade
This commit is contained in:
Vladimir Kozlov 2022-11-11 16:09:39 +00:00
parent ced88a2fd9
commit 819c6919ca
4 changed files with 60 additions and 48 deletions

View File

@ -4232,14 +4232,69 @@ bool Compile::needs_clinit_barrier(ciInstanceKlass* holder, ciMethod* accessing_
}
#ifndef PRODUCT
//------------------------------verify_bidirectional_edges---------------------
// For each input edge to a node (ie - for each Use-Def edge), verify that
// there is a corresponding Def-Use edge.
void Compile::verify_bidirectional_edges(Unique_Node_List &visited) {
// Allocate stack of size C->live_nodes()/16 to avoid frequent realloc
uint stack_size = live_nodes() >> 4;
Node_List nstack(MAX2(stack_size, (uint)OptoNodeListSize));
nstack.push(_root);
while (nstack.size() > 0) {
Node* n = nstack.pop();
if (visited.member(n)) {
continue;
}
visited.push(n);
// Walk over all input edges, checking for correspondence
uint length = n->len();
for (uint i = 0; i < length; i++) {
Node* in = n->in(i);
if (in != NULL && !visited.member(in)) {
nstack.push(in); // Put it on stack
}
if (in != NULL && !in->is_top()) {
// Count instances of `next`
int cnt = 0;
for (uint idx = 0; idx < in->_outcnt; idx++) {
if (in->_out[idx] == n) {
cnt++;
}
}
assert(cnt > 0, "Failed to find Def-Use edge.");
// Check for duplicate edges
// walk the input array downcounting the input edges to n
for (uint j = 0; j < length; j++) {
if (n->in(j) == in) {
cnt--;
}
}
assert(cnt == 0, "Mismatched edge count.");
} else if (in == NULL) {
assert(i == 0 || i >= n->req() ||
n->is_Region() || n->is_Phi() || n->is_ArrayCopy() ||
(n->is_Unlock() && i == (n->req() - 1)) ||
(n->is_MemBar() && i == 5), // the precedence edge to a membar can be removed during macro node expansion
"only region, phi, arraycopy, unlock or membar nodes have null data edges");
} else {
assert(in->is_top(), "sanity");
// Nothing to check.
}
}
}
}
//------------------------------verify_graph_edges---------------------------
// Walk the Graph and verify that there is a one-to-one correspondence
// between Use-Def edges and Def-Use edges in the graph.
void Compile::verify_graph_edges(bool no_dead_code) {
if (VerifyGraphEdges) {
Unique_Node_List visited;
// Call recursive graph walk to check edges
_root->verify_edges(visited);
// Call graph walk to check edges
verify_bidirectional_edges(visited);
if (no_dead_code) {
// Now make sure that no visited node is used by an unvisited node.
bool dead_nodes = false;

View File

@ -1166,6 +1166,9 @@ class Compile : public Phase {
// graph is strongly connected from root in both directions.
void verify_graph_edges(bool no_dead_code = false) PRODUCT_RETURN;
// Verify bi-directional correspondence of edges
void verify_bidirectional_edges(Unique_Node_List &visited);
// End-of-run dumps.
static void print_statistics() PRODUCT_RETURN;

View File

@ -2680,51 +2680,6 @@ void Node::dump_comp(const char* suffix, outputStream *st) const {
}
// VERIFICATION CODE
// For each input edge to a node (ie - for each Use-Def edge), verify that
// there is a corresponding Def-Use edge.
//------------------------------verify_edges-----------------------------------
void Node::verify_edges(Unique_Node_List &visited) {
uint i, j, idx;
int cnt;
Node *n;
// Recursive termination test
if (visited.member(this)) return;
visited.push(this);
// Walk over all input edges, checking for correspondence
for( i = 0; i < len(); i++ ) {
n = in(i);
if (n != NULL && !n->is_top()) {
// Count instances of (Node *)this
cnt = 0;
for (idx = 0; idx < n->_outcnt; idx++ ) {
if (n->_out[idx] == (Node *)this) cnt++;
}
assert( cnt > 0,"Failed to find Def-Use edge." );
// Check for duplicate edges
// walk the input array downcounting the input edges to n
for( j = 0; j < len(); j++ ) {
if( in(j) == n ) cnt--;
}
assert( cnt == 0,"Mismatched edge count.");
} else if (n == NULL) {
assert(i >= req() || i == 0 || is_Region() || is_Phi() || is_ArrayCopy() || (is_Unlock() && i == req()-1)
|| (is_MemBar() && i == 5), // the precedence edge to a membar can be removed during macro node expansion
"only region, phi, arraycopy, unlock or membar nodes have null data edges");
} else {
assert(n->is_top(), "sanity");
// Nothing to check.
}
}
// Recursive walk over all input edges
for( i = 0; i < len(); i++ ) {
n = in(i);
if( n != NULL )
in(i)->verify_edges(visited);
}
}
// Verify all nodes if verify_depth is negative
void Node::verify(int verify_depth, VectorSet& visited, Node_List& worklist) {
assert(verify_depth != 0, "depth should not be 0");

View File

@ -1217,7 +1217,6 @@ public:
// Print compact per-node info
virtual void dump_compact_spec(outputStream *st) const { dump_spec(st); }
void verify_edges(Unique_Node_List &visited); // Verify bi-directional edges
static void verify(int verify_depth, VectorSet& visited, Node_List& worklist);
// This call defines a class-unique string used to identify class instances