mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-16 17:14:41 +02:00
7092905: C2: Keep track of the number of dead nodes
Keep an (almost) accurate running count of the reachable (live) flow graph nodes. Reviewed-by: kvn, twisti, jrose, vlivanov
This commit is contained in:
parent
96562be9e5
commit
2d2532e740
28 changed files with 306 additions and 120 deletions
|
@ -269,10 +269,10 @@ void IdealLoopTree::reassociate_invariants(PhaseIdealLoop *phase) {
|
|||
bool IdealLoopTree::policy_peeling( PhaseIdealLoop *phase ) const {
|
||||
Node *test = ((IdealLoopTree*)this)->tail();
|
||||
int body_size = ((IdealLoopTree*)this)->_body.size();
|
||||
int uniq = phase->C->unique();
|
||||
int live_node_count = phase->C->live_nodes();
|
||||
// Peeling does loop cloning which can result in O(N^2) node construction
|
||||
if( body_size > 255 /* Prevent overflow for large body_size */
|
||||
|| (body_size * body_size + uniq > MaxNodeLimit) ) {
|
||||
|| (body_size * body_size + live_node_count > MaxNodeLimit) ) {
|
||||
return false; // too large to safely clone
|
||||
}
|
||||
while( test != _head ) { // Scan till run off top of loop
|
||||
|
@ -601,7 +601,7 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const {
|
|||
return false;
|
||||
if (new_body_size > unroll_limit ||
|
||||
// Unrolling can result in a large amount of node construction
|
||||
new_body_size >= MaxNodeLimit - phase->C->unique()) {
|
||||
new_body_size >= MaxNodeLimit - (uint) phase->C->live_nodes()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2268,7 +2268,7 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_
|
|||
|
||||
// Skip next optimizations if running low on nodes. Note that
|
||||
// policy_unswitching and policy_maximally_unroll have this check.
|
||||
uint nodes_left = MaxNodeLimit - phase->C->unique();
|
||||
uint nodes_left = MaxNodeLimit - (uint) phase->C->live_nodes();
|
||||
if ((2 * _body.size()) > nodes_left) {
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue