src/share/vm/opto/gcm.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/opto/gcm.cpp

src/share/vm/opto/gcm.cpp

Print this page
rev 8016 : 8069191: moving predicate out of loops may cause array accesses to bypass null check
Summary: Remove CastPP nodes only during final graph reshape
Reviewed-by:

*** 98,107 **** --- 98,110 ---- } n->set_req(0, pb->_succs[j]->head()); } } + static bool is_dominator(Block* d, Block* n) { + return d->dom_lca(n) == d; + } //------------------------------schedule_pinned_nodes-------------------------- // Set the basic block for Nodes pinned into blocks void PhaseCFG::schedule_pinned_nodes(VectorSet &visited) { // Allocate node stack of size C->unique()+8 to avoid frequent realloc
*** 120,129 **** --- 123,162 ---- } Block* block = get_block_for_node(input); // Basic block of controlling input schedule_node_into_block(node, block); } + // If the node has precedence edges (added when CastPP nodes are + // removed in final_graph_reshaping), fix the control of the + // node to cover the precedence edges and remove the + // dependencies. + Node* n = NULL; + for (uint i = node->len()-1; i >= node->req(); i--) { + Node* m = node->in(i); + if (m == NULL) continue; + // See Compile::final_graph_reshaping_impl(): we expect a test + // or a Region here. + if (m->is_block_proj() || m->is_block_start()) { + node->rm_prec(i); + if (n == NULL) { + n = m; + } else { + Block* bn = get_block_for_node(n); + Block* bm = get_block_for_node(m); + n = is_dominator(bn, bm) ? m : n; + } + } + } + if (n != NULL) { + assert(node->in(0), "control should have been set"); + Block* bn = get_block_for_node(n); + Block* bnode = get_block_for_node(node->in(0)); + if (!is_dominator(bn, bnode)) { + node->set_req(0, n); + } + } + // process all inputs that are non NULL for (int i = node->req() - 1; i >= 0; --i) { if (node->in(i) != NULL) { spstack.push(node->in(i)); }
src/share/vm/opto/gcm.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File