6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")

Fri, 06 Feb 2009 13:31:03 -0800

author
kvn
date
Fri, 06 Feb 2009 13:31:03 -0800
changeset 1001
91263420e1c6
parent 1000
7fe62bb75bf4
child 1002
bbef4344adb2

6791852: assert(b->_nodes[insidx] == n,"got insidx set incorrectly")
Summary: Move the CreateEx up before each round of IFG construction
Reviewed-by: never, phh

src/share/vm/opto/block.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/chaitin.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/chaitin.hpp file | annotate | diff | comparison | revisions
src/share/vm/opto/ifg.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/live.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/reg_split.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/opto/block.cpp	Thu Feb 05 14:43:58 2009 -0800
     1.2 +++ b/src/share/vm/opto/block.cpp	Fri Feb 06 13:31:03 2009 -0800
     1.3 @@ -880,6 +880,7 @@
     1.4  }
     1.5  
     1.6  void PhaseCFG::verify( ) const {
     1.7 +#ifdef ASSERT
     1.8    // Verify sane CFG
     1.9    for( uint i = 0; i < _num_blocks; i++ ) {
    1.10      Block *b = _blocks[i];
    1.11 @@ -894,10 +895,20 @@
    1.12                  "CreateEx must be first instruction in block" );
    1.13        }
    1.14        for( uint k = 0; k < n->req(); k++ ) {
    1.15 -        Node *use = n->in(k);
    1.16 -        if( use && use != n ) {
    1.17 -          assert( _bbs[use->_idx] || use->is_Con(),
    1.18 +        Node *def = n->in(k);
    1.19 +        if( def && def != n ) {
    1.20 +          assert( _bbs[def->_idx] || def->is_Con(),
    1.21                    "must have block; constants for debug info ok" );
    1.22 +          // Verify that instructions in the block is in correct order.
    1.23 +          // Uses must follow their definition if they are at the same block.
    1.24 +          // Mostly done to check that MachSpillCopy nodes are placed correctly
    1.25 +          // when CreateEx node is moved in build_ifg_physical().
    1.26 +          if( _bbs[def->_idx] == b &&
    1.27 +              !(b->head()->is_Loop() && n->is_Phi()) &&
    1.28 +              // See (+++) comment in reg_split.cpp
    1.29 +              !(n->jvms() != NULL && n->jvms()->is_monitor_use(k)) ) {
    1.30 +            assert( b->find_node(def) < j, "uses must follow definitions" );
    1.31 +          }
    1.32          }
    1.33        }
    1.34      }
    1.35 @@ -914,6 +925,7 @@
    1.36        assert( b->_num_succs == 2, "Conditional branch must have two targets");
    1.37      }
    1.38    }
    1.39 +#endif
    1.40  }
    1.41  #endif
    1.42  
     2.1 --- a/src/share/vm/opto/chaitin.cpp	Thu Feb 05 14:43:58 2009 -0800
     2.2 +++ b/src/share/vm/opto/chaitin.cpp	Fri Feb 06 13:31:03 2009 -0800
     2.3 @@ -228,6 +228,11 @@
     2.4    // them for real.
     2.5    de_ssa();
     2.6  
     2.7 +#ifdef ASSERT
     2.8 +  // Veify the graph before RA.
     2.9 +  verify(&live_arena);
    2.10 +#endif
    2.11 +
    2.12    {
    2.13      NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
    2.14      _live = NULL;                 // Mark live as being not available
    2.15 @@ -306,12 +311,6 @@
    2.16      C->check_node_count(2*NodeLimitFudgeFactor, "out of nodes after physical split");
    2.17      if (C->failing())  return;
    2.18  
    2.19 -#ifdef ASSERT
    2.20 -    if( VerifyOpto || VerifyRegisterAllocator ) {
    2.21 -      _cfg.verify();
    2.22 -      verify_base_ptrs(&live_arena);
    2.23 -    }
    2.24 -#endif
    2.25      NOT_PRODUCT( C->verify_graph_edges(); )
    2.26  
    2.27      compact();                  // Compact LRGs; return new lower max lrg
    2.28 @@ -340,7 +339,7 @@
    2.29      compress_uf_map_for_nodes();
    2.30  
    2.31  #ifdef ASSERT
    2.32 -    if( VerifyOpto || VerifyRegisterAllocator ) _ifg->verify(this);
    2.33 +    verify(&live_arena, true);
    2.34  #endif
    2.35    } else {
    2.36      ifg.SquareUp();
    2.37 @@ -376,12 +375,6 @@
    2.38      // Bail out if unique gets too large (ie - unique > MaxNodeLimit - 2*NodeLimitFudgeFactor)
    2.39      C->check_node_count(2*NodeLimitFudgeFactor, "out of nodes after split");
    2.40      if (C->failing())  return;
    2.41 -#ifdef ASSERT
    2.42 -    if( VerifyOpto || VerifyRegisterAllocator ) {
    2.43 -      _cfg.verify();
    2.44 -      verify_base_ptrs(&live_arena);
    2.45 -    }
    2.46 -#endif
    2.47  
    2.48      compact();                  // Compact LRGs; return new lower max lrg
    2.49  
    2.50 @@ -412,7 +405,7 @@
    2.51      }
    2.52      compress_uf_map_for_nodes();
    2.53  #ifdef ASSERT
    2.54 -    if( VerifyOpto || VerifyRegisterAllocator ) _ifg->verify(this);
    2.55 +    verify(&live_arena, true);
    2.56  #endif
    2.57      cache_lrg_info();           // Count degree of LRGs
    2.58  
    2.59 @@ -432,6 +425,11 @@
    2.60    // Peephole remove copies
    2.61    post_allocate_copy_removal();
    2.62  
    2.63 +#ifdef ASSERT
    2.64 +  // Veify the graph after RA.
    2.65 +  verify(&live_arena);
    2.66 +#endif
    2.67 +
    2.68    // max_reg is past the largest *register* used.
    2.69    // Convert that to a frame_slot number.
    2.70    if( _max_reg <= _matcher._new_SP )
     3.1 --- a/src/share/vm/opto/chaitin.hpp	Thu Feb 05 14:43:58 2009 -0800
     3.2 +++ b/src/share/vm/opto/chaitin.hpp	Fri Feb 06 13:31:03 2009 -0800
     3.3 @@ -491,6 +491,8 @@
     3.4    // Verify that base pointers and derived pointers are still sane
     3.5    void verify_base_ptrs( ResourceArea *a ) const;
     3.6  
     3.7 +  void verify( ResourceArea *a, bool verify_ifg = false ) const;
     3.8 +
     3.9    void dump_for_spill_split_recycle() const;
    3.10  
    3.11  public:
     4.1 --- a/src/share/vm/opto/ifg.cpp	Thu Feb 05 14:43:58 2009 -0800
     4.2 +++ b/src/share/vm/opto/ifg.cpp	Fri Feb 06 13:31:03 2009 -0800
     4.3 @@ -471,12 +471,28 @@
     4.4      // for the "collect_gc_info" phase later.
     4.5      IndexSet liveout(_live->live(b));
     4.6      uint last_inst = b->end_idx();
     4.7 -    // Compute last phi index
     4.8 -    uint last_phi;
     4.9 -    for( last_phi = 1; last_phi < last_inst; last_phi++ )
    4.10 -      if( !b->_nodes[last_phi]->is_Phi() )
    4.11 +    // Compute first nonphi node index
    4.12 +    uint first_inst;
    4.13 +    for( first_inst = 1; first_inst < last_inst; first_inst++ )
    4.14 +      if( !b->_nodes[first_inst]->is_Phi() )
    4.15          break;
    4.16  
    4.17 +    // Spills could be inserted before CreateEx node which should be
    4.18 +    // first instruction in block after Phis. Move CreateEx up.
    4.19 +    for( uint insidx = first_inst; insidx < last_inst; insidx++ ) {
    4.20 +      Node *ex = b->_nodes[insidx];
    4.21 +      if( ex->is_SpillCopy() ) continue;
    4.22 +      if( insidx > first_inst && ex->is_Mach() &&
    4.23 +          ex->as_Mach()->ideal_Opcode() == Op_CreateEx ) {
    4.24 +        // If the CreateEx isn't above all the MachSpillCopies
    4.25 +        // then move it to the top.
    4.26 +        b->_nodes.remove(insidx);
    4.27 +        b->_nodes.insert(first_inst, ex);
    4.28 +      }
    4.29 +      // Stop once a CreateEx or any other node is found
    4.30 +      break;
    4.31 +    }
    4.32 +
    4.33      // Reset block's register pressure values for each ifg construction
    4.34      uint pressure[2], hrp_index[2];
    4.35      pressure[0] = pressure[1] = 0;
    4.36 @@ -485,7 +501,7 @@
    4.37      // Liveout things are presumed live for the whole block.  We accumulate
    4.38      // 'area' accordingly.  If they get killed in the block, we'll subtract
    4.39      // the unused part of the block from the area.
    4.40 -    int inst_count = last_inst - last_phi;
    4.41 +    int inst_count = last_inst - first_inst;
    4.42      double cost = (inst_count <= 0) ? 0.0 : b->_freq * double(inst_count);
    4.43      assert(!(cost < 0.0), "negative spill cost" );
    4.44      IndexSetIterator elements(&liveout);
     5.1 --- a/src/share/vm/opto/live.cpp	Thu Feb 05 14:43:58 2009 -0800
     5.2 +++ b/src/share/vm/opto/live.cpp	Fri Feb 06 13:31:03 2009 -0800
     5.3 @@ -329,8 +329,12 @@
     5.4                        UseCompressedOops && check->as_Mach()->ideal_Opcode() == Op_DecodeN ||
     5.5  #endif
     5.6                        check->as_Mach()->ideal_Opcode() == Op_LoadP ||
     5.7 -                      check->as_Mach()->ideal_Opcode() == Op_LoadKlass))
     5.8 +                      check->as_Mach()->ideal_Opcode() == Op_LoadKlass)) {
     5.9 +                    // Valid nodes
    5.10 +                  } else {
    5.11 +                    check->dump();
    5.12                      assert(false,"Bad base or derived pointer");
    5.13 +                  }
    5.14                  } else {
    5.15                    assert(is_derived,"Bad base pointer");
    5.16                    assert(check->is_Mach() && check->as_Mach()->ideal_Opcode() == Op_AddP,"Bad derived pointer");
    5.17 @@ -346,4 +350,18 @@
    5.18    } // End of forall blocks
    5.19  #endif
    5.20  }
    5.21 +
    5.22 +//------------------------------verify-------------------------------------
    5.23 +// Verify that graphs and base pointers are still sane.
    5.24 +void PhaseChaitin::verify( ResourceArea *a, bool verify_ifg ) const {
    5.25 +#ifdef ASSERT
    5.26 +  if( VerifyOpto || VerifyRegisterAllocator ) {
    5.27 +    _cfg.verify();
    5.28 +    verify_base_ptrs(a);
    5.29 +    if(verify_ifg)
    5.30 +      _ifg->verify(this);
    5.31 +  }
    5.32  #endif
    5.33 +}
    5.34 +
    5.35 +#endif
     6.1 --- a/src/share/vm/opto/reg_split.cpp	Thu Feb 05 14:43:58 2009 -0800
     6.2 +++ b/src/share/vm/opto/reg_split.cpp	Fri Feb 06 13:31:03 2009 -0800
     6.3 @@ -96,9 +96,7 @@
     6.4    // its definer.
     6.5    while( i < b->_nodes.size() &&
     6.6           (b->_nodes[i]->is_Proj() ||
     6.7 -          b->_nodes[i]->is_Phi()  ||
     6.8 -          (b->_nodes[i]->is_Mach() &&
     6.9 -           b->_nodes[i]->as_Mach()->ideal_Opcode() == Op_CreateEx)) )
    6.10 +          b->_nodes[i]->is_Phi() ) )
    6.11      i++;
    6.12  
    6.13    // Do not insert between a call and his Catch

mercurial