src/share/vm/opto/loopTransform.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8058148 Cdiff src/share/vm/opto/loopTransform.cpp

src/share/vm/opto/loopTransform.cpp

Print this page

        

*** 267,280 **** // Return TRUE or FALSE if the loop should be peeled or not. Peel if we can // make some loop-invariant test (usually a null-check) happen before the loop. bool IdealLoopTree::policy_peeling( PhaseIdealLoop *phase ) const { Node *test = ((IdealLoopTree*)this)->tail(); int body_size = ((IdealLoopTree*)this)->_body.size(); - 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 + live_node_count > MaxNodeLimit) ) { return false; // too large to safely clone } while( test != _head ) { // Scan till run off top of loop if( test->is_If() ) { // Test? Node *ctrl = phase->get_ctrl(test->in(1)); --- 267,279 ---- // Return TRUE or FALSE if the loop should be peeled or not. Peel if we can // make some loop-invariant test (usually a null-check) happen before the loop. bool IdealLoopTree::policy_peeling( PhaseIdealLoop *phase ) const { Node *test = ((IdealLoopTree*)this)->tail(); int body_size = ((IdealLoopTree*)this)->_body.size(); // 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 + phase->C->live_nodes()) > phase->C->max_node_limit() ) { return false; // too large to safely clone } while( test != _head ) { // Scan till run off top of loop if( test->is_If() ) { // Test? Node *ctrl = phase->get_ctrl(test->in(1));
*** 599,609 **** uint tst_body_size = (new_body_size - EMPTY_LOOP_SIZE) / trip_count + EMPTY_LOOP_SIZE; if (body_size != tst_body_size) // Check for int overflow return false; if (new_body_size > unroll_limit || // Unrolling can result in a large amount of node construction ! new_body_size >= MaxNodeLimit - (uint) phase->C->live_nodes()) { return false; } // Do not unroll a loop with String intrinsics code. // String intrinsics are large and have loops. --- 598,608 ---- uint tst_body_size = (new_body_size - EMPTY_LOOP_SIZE) / trip_count + EMPTY_LOOP_SIZE; if (body_size != tst_body_size) // Check for int overflow return false; if (new_body_size > unroll_limit || // Unrolling can result in a large amount of node construction ! new_body_size >= phase->C->max_node_limit() - phase->C->live_nodes()) { return false; } // Do not unroll a loop with String intrinsics code. // String intrinsics are large and have loops.
*** 2285,2296 **** } } // Skip next optimizations if running low on nodes. Note that // policy_unswitching and policy_maximally_unroll have this check. ! uint nodes_left = MaxNodeLimit - (uint) phase->C->live_nodes(); ! if ((2 * _body.size()) > nodes_left) { return true; } // Counted loops may be peeled, may need some iterations run up // front for RCE, and may want to align loop refs to a cache --- 2284,2295 ---- } } // Skip next optimizations if running low on nodes. Note that // policy_unswitching and policy_maximally_unroll have this check. ! int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes(); ! if ((int)(2 * _body.size()) > nodes_left) { return true; } // Counted loops may be peeled, may need some iterations run up // front for RCE, and may want to align loop refs to a cache
src/share/vm/opto/loopTransform.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File