8201532: Update idom to get correct dom depth calculation

Assert due to dom depth calculation on old idom

Reviewed-by: roland
This commit is contained in:
Nils Eliasson 2018-05-14 14:10:50 +02:00
parent 7906014509
commit 86728689bf
2 changed files with 25 additions and 11 deletions
src/hotspot/share/opto

@ -3218,10 +3218,16 @@ void PhaseIdealLoop::set_idom(Node* d, Node* n, uint dom_depth) {
void PhaseIdealLoop::recompute_dom_depth() {
uint no_depth_marker = C->unique();
uint i;
// Initialize depth to "no depth yet"
// Initialize depth to "no depth yet" and realize all lazy updates
for (i = 0; i < _idom_size; i++) {
// Only indices with a _dom_depth has a Node* or NULL (otherwise uninitalized).
if (_dom_depth[i] > 0 && _idom[i] != NULL) {
_dom_depth[i] = no_depth_marker;
_dom_depth[i] = no_depth_marker;
// heal _idom if it has a fwd mapping in _nodes
if (_idom[i]->in(0) == NULL) {
idom(i);
}
}
}
if (_dom_stk == NULL) {

@ -852,27 +852,35 @@ private:
// Array of immediate dominance info for each CFG node indexed by node idx
private:
uint _idom_size;
Node **_idom; // Array of immediate dominators
uint *_dom_depth; // Used for fast LCA test
Node **_idom; // Array of immediate dominators
uint *_dom_depth; // Used for fast LCA test
GrowableArray<uint>* _dom_stk; // For recomputation of dom depth
Node* idom_no_update(Node* d) const {
assert(d->_idx < _idom_size, "oob");
Node* n = _idom[d->_idx];
return idom_no_update(d->_idx);
}
Node* idom_no_update(uint didx) const {
assert(didx < _idom_size, "oob");
Node* n = _idom[didx];
assert(n != NULL,"Bad immediate dominator info.");
while (n->in(0) == NULL) { // Skip dead CFG nodes
//n = n->in(1);
while (n->in(0) == NULL) { // Skip dead CFG nodes
n = (Node*)(((intptr_t)_nodes[n->_idx]) & ~1);
assert(n != NULL,"Bad immediate dominator info.");
}
return n;
}
Node *idom(Node* d) const {
uint didx = d->_idx;
Node *n = idom_no_update(d);
_idom[didx] = n; // Lazily remove dead CFG nodes from table.
return idom(d->_idx);
}
Node *idom(uint didx) const {
Node *n = idom_no_update(didx);
_idom[didx] = n; // Lazily remove dead CFG nodes from table.
return n;
}
uint dom_depth(Node* d) const {
guarantee(d != NULL, "Null dominator info.");
guarantee(d->_idx < _idom_size, "");