提交 68d68673 编写于 作者: K kvn

7147744: CTW: assert(false) failed: infinite EA connection graph build

Summary: rewrote Connection graph construction code in EA to reduce time spent there.
Reviewed-by: never
上级 a0bbe8a8
/* /*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -465,6 +465,9 @@ ...@@ -465,6 +465,9 @@
notproduct(bool, PrintOptimizePtrCompare, false, \ notproduct(bool, PrintOptimizePtrCompare, false, \
"Print information about optimized pointers compare") \ "Print information about optimized pointers compare") \
\ \
notproduct(bool, VerifyConnectionGraph , true, \
"Verify Connection Graph construction in Escape Analysis") \
\
product(bool, UseOptoBiasInlining, true, \ product(bool, UseOptoBiasInlining, true, \
"Generate biased locking code in C2 ideal graph") \ "Generate biased locking code in C2 ideal graph") \
\ \
......
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1538,10 +1538,7 @@ Node *LockNode::Ideal(PhaseGVN *phase, bool can_reshape) { ...@@ -1538,10 +1538,7 @@ Node *LockNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// If we are locking an unescaped object, the lock/unlock is unnecessary // If we are locking an unescaped object, the lock/unlock is unnecessary
// //
ConnectionGraph *cgr = phase->C->congraph(); ConnectionGraph *cgr = phase->C->congraph();
PointsToNode::EscapeState es = PointsToNode::GlobalEscape; if (cgr != NULL && cgr->not_global_escape(obj_node())) {
if (cgr != NULL)
es = cgr->escape_state(obj_node());
if (es != PointsToNode::UnknownEscape && es != PointsToNode::GlobalEscape) {
assert(!is_eliminated() || is_coarsened(), "sanity"); assert(!is_eliminated() || is_coarsened(), "sanity");
// The lock could be marked eliminated by lock coarsening // The lock could be marked eliminated by lock coarsening
// code during first IGVN before EA. Replace coarsened flag // code during first IGVN before EA. Replace coarsened flag
...@@ -1680,10 +1677,7 @@ Node *UnlockNode::Ideal(PhaseGVN *phase, bool can_reshape) { ...@@ -1680,10 +1677,7 @@ Node *UnlockNode::Ideal(PhaseGVN *phase, bool can_reshape) {
// If we are unlocking an unescaped object, the lock/unlock is unnecessary. // If we are unlocking an unescaped object, the lock/unlock is unnecessary.
// //
ConnectionGraph *cgr = phase->C->congraph(); ConnectionGraph *cgr = phase->C->congraph();
PointsToNode::EscapeState es = PointsToNode::GlobalEscape; if (cgr != NULL && cgr->not_global_escape(obj_node())) {
if (cgr != NULL)
es = cgr->escape_state(obj_node());
if (es != PointsToNode::UnknownEscape && es != PointsToNode::GlobalEscape) {
assert(!is_eliminated() || is_coarsened(), "sanity"); assert(!is_eliminated() || is_coarsened(), "sanity");
// The lock could be marked eliminated by lock coarsening // The lock could be marked eliminated by lock coarsening
// code during first IGVN before EA. Replace coarsened flag // code during first IGVN before EA. Replace coarsened flag
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -546,6 +546,12 @@ public: ...@@ -546,6 +546,12 @@ public:
// or result projection is there are several CheckCastPP // or result projection is there are several CheckCastPP
// or returns NULL if there is no one. // or returns NULL if there is no one.
Node *result_cast(); Node *result_cast();
// Does this node returns pointer?
bool returns_pointer() const {
const TypeTuple *r = tf()->range();
return (r->cnt() > TypeFunc::Parms &&
r->field_at(TypeFunc::Parms)->isa_ptr());
}
// Collect all the interesting edges from a call for use in // Collect all the interesting edges from a call for use in
// replacing the call by something else. Used by macro expansion // replacing the call by something else. Used by macro expansion
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1707,7 +1707,6 @@ void Compile::Optimize() { ...@@ -1707,7 +1707,6 @@ void Compile::Optimize() {
if (major_progress()) print_method("PhaseIdealLoop before EA", 2); if (major_progress()) print_method("PhaseIdealLoop before EA", 2);
if (failing()) return; if (failing()) return;
} }
TracePhase t2("escapeAnalysis", &_t_escapeAnalysis, true);
ConnectionGraph::do_analysis(this, &igvn); ConnectionGraph::do_analysis(this, &igvn);
if (failing()) return; if (failing()) return;
...@@ -1719,6 +1718,7 @@ void Compile::Optimize() { ...@@ -1719,6 +1718,7 @@ void Compile::Optimize() {
if (failing()) return; if (failing()) return;
if (congraph() != NULL && macro_count() > 0) { if (congraph() != NULL && macro_count() > 0) {
NOT_PRODUCT( TracePhase t2("macroEliminate", &_t_macroEliminate, TimeCompiler); )
PhaseMacroExpand mexp(igvn); PhaseMacroExpand mexp(igvn);
mexp.eliminate_macro_nodes(); mexp.eliminate_macro_nodes();
igvn.set_delay_transform(false); igvn.set_delay_transform(false);
......
此差异已折叠。
此差异已折叠。
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -39,8 +39,9 @@ elapsedTimer Phase::_t_stubCompilation; ...@@ -39,8 +39,9 @@ elapsedTimer Phase::_t_stubCompilation;
// The next timers used for LogCompilation // The next timers used for LogCompilation
elapsedTimer Phase::_t_parser; elapsedTimer Phase::_t_parser;
elapsedTimer Phase::_t_escapeAnalysis;
elapsedTimer Phase::_t_optimizer; elapsedTimer Phase::_t_optimizer;
elapsedTimer Phase::_t_escapeAnalysis;
elapsedTimer Phase::_t_connectionGraph;
elapsedTimer Phase::_t_idealLoop; elapsedTimer Phase::_t_idealLoop;
elapsedTimer Phase::_t_ccp; elapsedTimer Phase::_t_ccp;
elapsedTimer Phase::_t_matcher; elapsedTimer Phase::_t_matcher;
...@@ -51,6 +52,7 @@ elapsedTimer Phase::_t_output; ...@@ -51,6 +52,7 @@ elapsedTimer Phase::_t_output;
elapsedTimer Phase::_t_graphReshaping; elapsedTimer Phase::_t_graphReshaping;
elapsedTimer Phase::_t_scheduler; elapsedTimer Phase::_t_scheduler;
elapsedTimer Phase::_t_blockOrdering; elapsedTimer Phase::_t_blockOrdering;
elapsedTimer Phase::_t_macroEliminate;
elapsedTimer Phase::_t_macroExpand; elapsedTimer Phase::_t_macroExpand;
elapsedTimer Phase::_t_peephole; elapsedTimer Phase::_t_peephole;
elapsedTimer Phase::_t_codeGeneration; elapsedTimer Phase::_t_codeGeneration;
...@@ -104,6 +106,8 @@ void Phase::print_timers() { ...@@ -104,6 +106,8 @@ void Phase::print_timers() {
if (DoEscapeAnalysis) { if (DoEscapeAnalysis) {
// EA is part of Optimizer. // EA is part of Optimizer.
tty->print_cr (" escape analysis: %3.3f sec", Phase::_t_escapeAnalysis.seconds()); tty->print_cr (" escape analysis: %3.3f sec", Phase::_t_escapeAnalysis.seconds());
tty->print_cr (" connection graph: %3.3f sec", Phase::_t_connectionGraph.seconds());
tty->print_cr (" macroEliminate : %3.3f sec", Phase::_t_macroEliminate.seconds());
} }
tty->print_cr (" iterGVN : %3.3f sec", Phase::_t_iterGVN.seconds()); tty->print_cr (" iterGVN : %3.3f sec", Phase::_t_iterGVN.seconds());
tty->print_cr (" idealLoop : %3.3f sec", Phase::_t_idealLoop.seconds()); tty->print_cr (" idealLoop : %3.3f sec", Phase::_t_idealLoop.seconds());
...@@ -112,9 +116,10 @@ void Phase::print_timers() { ...@@ -112,9 +116,10 @@ void Phase::print_timers() {
tty->print_cr (" iterGVN2 : %3.3f sec", Phase::_t_iterGVN2.seconds()); tty->print_cr (" iterGVN2 : %3.3f sec", Phase::_t_iterGVN2.seconds());
tty->print_cr (" macroExpand : %3.3f sec", Phase::_t_macroExpand.seconds()); tty->print_cr (" macroExpand : %3.3f sec", Phase::_t_macroExpand.seconds());
tty->print_cr (" graphReshape : %3.3f sec", Phase::_t_graphReshaping.seconds()); tty->print_cr (" graphReshape : %3.3f sec", Phase::_t_graphReshaping.seconds());
double optimizer_subtotal = Phase::_t_iterGVN.seconds() + double optimizer_subtotal = Phase::_t_iterGVN.seconds() + Phase::_t_iterGVN2.seconds() +
Phase::_t_escapeAnalysis.seconds() + Phase::_t_macroEliminate.seconds() +
Phase::_t_idealLoop.seconds() + Phase::_t_ccp.seconds() + Phase::_t_idealLoop.seconds() + Phase::_t_ccp.seconds() +
Phase::_t_graphReshaping.seconds(); Phase::_t_macroExpand.seconds() + Phase::_t_graphReshaping.seconds();
double percent_of_optimizer = ((optimizer_subtotal == 0.0) ? 0.0 : (optimizer_subtotal / Phase::_t_optimizer.seconds() * 100.0)); double percent_of_optimizer = ((optimizer_subtotal == 0.0) ? 0.0 : (optimizer_subtotal / Phase::_t_optimizer.seconds() * 100.0));
tty->print_cr (" subtotal : %3.3f sec, %3.2f %%", optimizer_subtotal, percent_of_optimizer); tty->print_cr (" subtotal : %3.3f sec, %3.2f %%", optimizer_subtotal, percent_of_optimizer);
} }
......
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -72,8 +72,12 @@ protected: ...@@ -72,8 +72,12 @@ protected:
// The next timers used for LogCompilation // The next timers used for LogCompilation
static elapsedTimer _t_parser; static elapsedTimer _t_parser;
static elapsedTimer _t_escapeAnalysis;
static elapsedTimer _t_optimizer; static elapsedTimer _t_optimizer;
public:
// ConnectionGraph can't be Phase since it is used after EA done.
static elapsedTimer _t_escapeAnalysis;
static elapsedTimer _t_connectionGraph;
protected:
static elapsedTimer _t_idealLoop; static elapsedTimer _t_idealLoop;
static elapsedTimer _t_ccp; static elapsedTimer _t_ccp;
static elapsedTimer _t_matcher; static elapsedTimer _t_matcher;
...@@ -84,6 +88,7 @@ protected: ...@@ -84,6 +88,7 @@ protected:
static elapsedTimer _t_graphReshaping; static elapsedTimer _t_graphReshaping;
static elapsedTimer _t_scheduler; static elapsedTimer _t_scheduler;
static elapsedTimer _t_blockOrdering; static elapsedTimer _t_blockOrdering;
static elapsedTimer _t_macroEliminate;
static elapsedTimer _t_macroExpand; static elapsedTimer _t_macroExpand;
static elapsedTimer _t_peephole; static elapsedTimer _t_peephole;
static elapsedTimer _t_codeGeneration; static elapsedTimer _t_codeGeneration;
......
/* /*
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -198,8 +198,11 @@ template<class E> class GrowableArray : public GenericGrowableArray { ...@@ -198,8 +198,11 @@ template<class E> class GrowableArray : public GenericGrowableArray {
return idx; return idx;
} }
void append_if_missing(const E& elem) { bool append_if_missing(const E& elem) {
if (!contains(elem)) append(elem); // Returns TRUE if elem is added.
bool missed = !contains(elem);
if (missed) append(elem);
return missed;
} }
E at(int i) const { E at(int i) const {
...@@ -292,12 +295,22 @@ template<class E> class GrowableArray : public GenericGrowableArray { ...@@ -292,12 +295,22 @@ template<class E> class GrowableArray : public GenericGrowableArray {
ShouldNotReachHere(); ShouldNotReachHere();
} }
// The order is preserved.
void remove_at(int index) { void remove_at(int index) {
assert(0 <= index && index < _len, "illegal index"); assert(0 <= index && index < _len, "illegal index");
for (int j = index + 1; j < _len; j++) _data[j-1] = _data[j]; for (int j = index + 1; j < _len; j++) _data[j-1] = _data[j];
_len--; _len--;
} }
// The order is changed.
void delete_at(int index) {
assert(0 <= index && index < _len, "illegal index");
if (index < --_len) {
// Replace removed element with last one.
_data[index] = _data[_len];
}
}
// inserts the given element before the element at index i // inserts the given element before the element at index i
void insert_before(const int idx, const E& elem) { void insert_before(const int idx, const E& elem) {
check_nesting(); check_nesting();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册