src/hotspot/share/opto/loopnode.cpp
changeset 58962 2dcfc28a314d
parent 58516 d376d86b0a01
equal deleted inserted replaced
58961:5d462d4b7a8b 58962:2dcfc28a314d
  2119 // Allpaths backwards scan from loop tail, terminating each path at first safepoint
  2119 // Allpaths backwards scan from loop tail, terminating each path at first safepoint
  2120 // encountered.  Helper for check_safepts.
  2120 // encountered.  Helper for check_safepts.
  2121 void IdealLoopTree::allpaths_check_safepts(VectorSet &visited, Node_List &stack) {
  2121 void IdealLoopTree::allpaths_check_safepts(VectorSet &visited, Node_List &stack) {
  2122   assert(stack.size() == 0, "empty stack");
  2122   assert(stack.size() == 0, "empty stack");
  2123   stack.push(_tail);
  2123   stack.push(_tail);
  2124   visited.Clear();
  2124   visited.clear();
  2125   visited.set(_tail->_idx);
  2125   visited.set(_tail->_idx);
  2126   while (stack.size() > 0) {
  2126   while (stack.size() > 0) {
  2127     Node* n = stack.pop();
  2127     Node* n = stack.pop();
  2128     if (n->is_Call() && n->as_Call()->guaranteed_safepoint()) {
  2128     if (n->is_Call() && n->as_Call()->guaranteed_safepoint()) {
  2129       // Terminate this path
  2129       // Terminate this path
  2928 
  2928 
  2929   // Allocate stack with enough space to avoid frequent realloc
  2929   // Allocate stack with enough space to avoid frequent realloc
  2930   int stack_size = (C->live_nodes() >> 1) + 16; // (live_nodes>>1)+16 from Java2D stats
  2930   int stack_size = (C->live_nodes() >> 1) + 16; // (live_nodes>>1)+16 from Java2D stats
  2931   Node_Stack nstack( a, stack_size );
  2931   Node_Stack nstack( a, stack_size );
  2932 
  2932 
  2933   visited.Clear();
  2933   visited.clear();
  2934   Node_List worklist(a);
  2934   Node_List worklist(a);
  2935   // Don't need C->root() on worklist since
  2935   // Don't need C->root() on worklist since
  2936   // it will be processed among C->top() inputs
  2936   // it will be processed among C->top() inputs
  2937   worklist.push( C->top() );
  2937   worklist.push(C->top());
  2938   visited.set( C->top()->_idx ); // Set C->top() as visited now
  2938   visited.set(C->top()->_idx); // Set C->top() as visited now
  2939   build_loop_early( visited, worklist, nstack );
  2939   build_loop_early( visited, worklist, nstack );
  2940 
  2940 
  2941   // Given early legal placement, try finding counted loops.  This placement
  2941   // Given early legal placement, try finding counted loops.  This placement
  2942   // is good enough to discover most loop invariants.
  2942   // is good enough to discover most loop invariants.
  2943   if (!_verify_me && !_verify_only && !strip_mined_loops_expanded) {
  2943   if (!_verify_me && !_verify_only && !strip_mined_loops_expanded) {
  2944     _ltree_root->counted_loop( this );
  2944     _ltree_root->counted_loop( this );
  2945   }
  2945   }
  2946 
  2946 
  2947   // Find latest loop placement.  Find ideal loop placement.
  2947   // Find latest loop placement.  Find ideal loop placement.
  2948   visited.Clear();
  2948   visited.clear();
  2949   init_dom_lca_tags();
  2949   init_dom_lca_tags();
  2950   // Need C->root() on worklist when processing outs
  2950   // Need C->root() on worklist when processing outs
  2951   worklist.push( C->root() );
  2951   worklist.push(C->root());
  2952   NOT_PRODUCT( C->verify_graph_edges(); )
  2952   NOT_PRODUCT( C->verify_graph_edges(); )
  2953   worklist.push( C->top() );
  2953   worklist.push(C->top());
  2954   build_loop_late( visited, worklist, nstack );
  2954   build_loop_late( visited, worklist, nstack );
  2955 
  2955 
  2956   if (_verify_only) {
  2956   if (_verify_only) {
  2957     C->restore_major_progress(old_progress);
  2957     C->restore_major_progress(old_progress);
  2958     assert(C->unique() == unique, "verification mode made Nodes? ? ?");
  2958     assert(C->unique() == unique, "verification mode made Nodes? ? ?");
  3044   }
  3044   }
  3045 
  3045 
  3046   // Check for aggressive application of split-if and other transforms
  3046   // Check for aggressive application of split-if and other transforms
  3047   // that require basic-block info (like cloning through Phi's)
  3047   // that require basic-block info (like cloning through Phi's)
  3048   if( SplitIfBlocks && do_split_ifs ) {
  3048   if( SplitIfBlocks && do_split_ifs ) {
  3049     visited.Clear();
  3049     visited.clear();
  3050     split_if_with_blocks( visited, nstack);
  3050     split_if_with_blocks( visited, nstack);
  3051     NOT_PRODUCT( if( VerifyLoopOptimizations ) verify(); );
  3051     NOT_PRODUCT( if( VerifyLoopOptimizations ) verify(); );
  3052   }
  3052   }
  3053 
  3053 
  3054   if (!C->major_progress() && do_expensive_nodes && process_expensive_nodes()) {
  3054   if (!C->major_progress() && do_expensive_nodes && process_expensive_nodes()) {