提交 97ee62fb 编写于 作者: K kvn

6681577: PIT: some VM tests fails with -XX:+AggressiveOpts in 6u5p b01

Summary: C2 spends > 60% in escape analysis code during test nsk/regression/b4675027.
Reviewed-by: never
上级 0847f212
...@@ -256,23 +256,35 @@ void ConnectionGraph::PointsTo(VectorSet &ptset, Node * n, PhaseTransform *phase ...@@ -256,23 +256,35 @@ void ConnectionGraph::PointsTo(VectorSet &ptset, Node * n, PhaseTransform *phase
} }
} }
void ConnectionGraph::remove_deferred(uint ni) { void ConnectionGraph::remove_deferred(uint ni, GrowableArray<uint>* deferred_edges, VectorSet* visited) {
VectorSet visited(Thread::current()->resource_area()); // This method is most expensive during ConnectionGraph construction.
// Reuse vectorSet and an additional growable array for deferred edges.
deferred_edges->clear();
visited->Clear();
uint i = 0; uint i = 0;
PointsToNode *ptn = ptnode_adr(ni); PointsToNode *ptn = ptnode_adr(ni);
while(i < ptn->edge_count()) { // Mark current edges as visited and move deferred edges to separate array.
for (; i < ptn->edge_count(); i++) {
uint t = ptn->edge_target(i); uint t = ptn->edge_target(i);
PointsToNode *ptt = ptnode_adr(t); #ifdef ASSERT
if (ptn->edge_type(i) != PointsToNode::DeferredEdge) { assert(!visited->test_set(t), "expecting no duplications");
i++; #else
} else { visited->set(t);
#endif
if (ptn->edge_type(i) == PointsToNode::DeferredEdge) {
ptn->remove_edge(t, PointsToNode::DeferredEdge); ptn->remove_edge(t, PointsToNode::DeferredEdge);
if(!visited.test_set(t)) { deferred_edges->append(t);
}
}
for (int next = 0; next < deferred_edges->length(); ++next) {
uint t = deferred_edges->at(next);
PointsToNode *ptt = ptnode_adr(t);
for (uint j = 0; j < ptt->edge_count(); j++) { for (uint j = 0; j < ptt->edge_count(); j++) {
uint n1 = ptt->edge_target(j); uint n1 = ptt->edge_target(j);
PointsToNode *pt1 = ptnode_adr(n1); if (visited->test_set(n1))
continue;
switch(ptt->edge_type(j)) { switch(ptt->edge_type(j)) {
case PointsToNode::PointsToEdge: case PointsToNode::PointsToEdge:
add_pointsto_edge(ni, n1); add_pointsto_edge(ni, n1);
...@@ -282,7 +294,7 @@ void ConnectionGraph::remove_deferred(uint ni) { ...@@ -282,7 +294,7 @@ void ConnectionGraph::remove_deferred(uint ni) {
} }
break; break;
case PointsToNode::DeferredEdge: case PointsToNode::DeferredEdge:
add_deferred_edge(ni, n1); deferred_edges->append(n1);
break; break;
case PointsToNode::FieldEdge: case PointsToNode::FieldEdge:
assert(false, "invalid connection graph"); assert(false, "invalid connection graph");
...@@ -290,8 +302,6 @@ void ConnectionGraph::remove_deferred(uint ni) { ...@@ -290,8 +302,6 @@ void ConnectionGraph::remove_deferred(uint ni) {
} }
} }
} }
}
}
} }
...@@ -1238,6 +1248,8 @@ void ConnectionGraph::compute_escape() { ...@@ -1238,6 +1248,8 @@ void ConnectionGraph::compute_escape() {
VectorSet ptset(Thread::current()->resource_area()); VectorSet ptset(Thread::current()->resource_area());
GrowableArray<Node*> alloc_worklist; GrowableArray<Node*> alloc_worklist;
GrowableArray<int> worklist; GrowableArray<int> worklist;
GrowableArray<uint> deferred_edges;
VectorSet visited(Thread::current()->resource_area());
// remove deferred edges from the graph and collect // remove deferred edges from the graph and collect
// information we will need for type splitting // information we will need for type splitting
...@@ -1247,7 +1259,7 @@ void ConnectionGraph::compute_escape() { ...@@ -1247,7 +1259,7 @@ void ConnectionGraph::compute_escape() {
PointsToNode::NodeType nt = ptn->node_type(); PointsToNode::NodeType nt = ptn->node_type();
Node *n = ptn->_node; Node *n = ptn->_node;
if (nt == PointsToNode::LocalVar || nt == PointsToNode::Field) { if (nt == PointsToNode::LocalVar || nt == PointsToNode::Field) {
remove_deferred(ni); remove_deferred(ni, &deferred_edges, &visited);
if (n->is_AddP()) { if (n->is_AddP()) {
// If this AddP computes an address which may point to more that one // If this AddP computes an address which may point to more that one
// object, nothing the address points to can be scalar replaceable. // object, nothing the address points to can be scalar replaceable.
......
...@@ -269,7 +269,7 @@ private: ...@@ -269,7 +269,7 @@ private:
// Remove outgoing deferred edges from the node referenced by "ni". // Remove outgoing deferred edges from the node referenced by "ni".
// Any outgoing edges from the target of the deferred edge are copied // Any outgoing edges from the target of the deferred edge are copied
// to "ni". // to "ni".
void remove_deferred(uint ni); void remove_deferred(uint ni, GrowableArray<uint>* deferred_edges, VectorSet* visited);
Node_Array _node_map; // used for bookeeping during type splitting Node_Array _node_map; // used for bookeeping during type splitting
// Used for the following purposes: // Used for the following purposes:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册