src/share/vm/opto/reg_split.cpp

changeset 4019
a1c7f6472621
parent 3882
8c92982cbbc4
child 4037
da91efe96a93
     1.1 --- a/src/share/vm/opto/reg_split.cpp	Fri Aug 24 16:23:59 2012 -0700
     1.2 +++ b/src/share/vm/opto/reg_split.cpp	Mon Aug 27 09:46:38 2012 -0700
     1.3 @@ -449,9 +449,12 @@
     1.4  // USES: If USE is in HRP, split at use to leave main LRG on stack.
     1.5  //       Else, hoist LRG back up to register only (ie - split is also DEF)
     1.6  // We will compute a new maxlrg as we go
     1.7 -uint PhaseChaitin::Split( uint maxlrg ) {
     1.8 +uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
     1.9    NOT_PRODUCT( Compile::TracePhase t3("regAllocSplit", &_t_regAllocSplit, TimeCompiler); )
    1.10  
    1.11 +  // Free thread local resources used by this method on exit.
    1.12 +  ResourceMark rm(split_arena);
    1.13 +
    1.14    uint                 bidx, pidx, slidx, insidx, inpidx, twoidx;
    1.15    uint                 non_phi = 1, spill_cnt = 0;
    1.16    Node               **Reachblock;
    1.17 @@ -461,14 +464,17 @@
    1.18    bool                 u1, u2, u3;
    1.19    Block               *b, *pred;
    1.20    PhiNode             *phi;
    1.21 -  GrowableArray<uint>  lidxs;
    1.22 +  GrowableArray<uint>  lidxs(split_arena, _maxlrg, 0, 0);
    1.23  
    1.24    // Array of counters to count splits per live range
    1.25 -  GrowableArray<uint>  splits;
    1.26 +  GrowableArray<uint>  splits(split_arena, _maxlrg, 0, 0);
    1.27 +
    1.28 +#define NEW_SPLIT_ARRAY(type, size)\
    1.29 +  (type*) split_arena->allocate_bytes((size) * sizeof(type))
    1.30  
    1.31    //----------Setup Code----------
    1.32    // Create a convenient mapping from lrg numbers to reaches/leaves indices
    1.33 -  uint *lrg2reach = NEW_RESOURCE_ARRAY( uint, _maxlrg );
    1.34 +  uint *lrg2reach = NEW_SPLIT_ARRAY( uint, _maxlrg );
    1.35    // Keep track of DEFS & Phis for later passes
    1.36    defs = new Node_List();
    1.37    phis = new Node_List();
    1.38 @@ -500,15 +506,15 @@
    1.39    // a Def is UP or DOWN.  UP means that it should get a register (ie -
    1.40    // it is always in LRP regions), and DOWN means that it is probably
    1.41    // on the stack (ie - it crosses HRP regions).
    1.42 -  Node ***Reaches     = NEW_RESOURCE_ARRAY( Node**, _cfg._num_blocks+1 );
    1.43 -  bool  **UP          = NEW_RESOURCE_ARRAY( bool*, _cfg._num_blocks+1 );
    1.44 -  Node  **debug_defs  = NEW_RESOURCE_ARRAY( Node*, spill_cnt );
    1.45 -  VectorSet **UP_entry= NEW_RESOURCE_ARRAY( VectorSet*, spill_cnt );
    1.46 +  Node ***Reaches     = NEW_SPLIT_ARRAY( Node**, _cfg._num_blocks+1 );
    1.47 +  bool  **UP          = NEW_SPLIT_ARRAY( bool*, _cfg._num_blocks+1 );
    1.48 +  Node  **debug_defs  = NEW_SPLIT_ARRAY( Node*, spill_cnt );
    1.49 +  VectorSet **UP_entry= NEW_SPLIT_ARRAY( VectorSet*, spill_cnt );
    1.50  
    1.51    // Initialize Reaches & UP
    1.52    for( bidx = 0; bidx < _cfg._num_blocks+1; bidx++ ) {
    1.53 -    Reaches[bidx]     = NEW_RESOURCE_ARRAY( Node*, spill_cnt );
    1.54 -    UP[bidx]          = NEW_RESOURCE_ARRAY( bool, spill_cnt );
    1.55 +    Reaches[bidx]     = NEW_SPLIT_ARRAY( Node*, spill_cnt );
    1.56 +    UP[bidx]          = NEW_SPLIT_ARRAY( bool, spill_cnt );
    1.57      Node **Reachblock = Reaches[bidx];
    1.58      bool *UPblock     = UP[bidx];
    1.59      for( slidx = 0; slidx < spill_cnt; slidx++ ) {
    1.60 @@ -517,9 +523,11 @@
    1.61      }
    1.62    }
    1.63  
    1.64 +#undef NEW_SPLIT_ARRAY
    1.65 +
    1.66    // Initialize to array of empty vectorsets
    1.67    for( slidx = 0; slidx < spill_cnt; slidx++ )
    1.68 -    UP_entry[slidx] = new VectorSet(Thread::current()->resource_area());
    1.69 +    UP_entry[slidx] = new VectorSet(split_arena);
    1.70  
    1.71    //----------PASS 1----------
    1.72    //----------Propagation & Node Insertion Code----------

mercurial