src/share/vm/opto/chaitin.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File JDK-8011415 Sdiff src/share/vm/opto

src/share/vm/opto/chaitin.hpp

Print this page
rev 5403 : 8011415: CTW on Sparc: assert(lrg.lo_degree()) failed:
Summary: Increased the LRG AllStack mask size since the previous size was not big enough when compiling huge methods (60k+ nodes)
Reviewed-by:


  29 #include "libadt/port.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "opto/connode.hpp"
  32 #include "opto/live.hpp"
  33 #include "opto/matcher.hpp"
  34 #include "opto/phase.hpp"
  35 #include "opto/regalloc.hpp"
  36 #include "opto/regmask.hpp"
  37 
  38 class LoopTree;
  39 class MachCallNode;
  40 class MachSafePointNode;
  41 class Matcher;
  42 class PhaseCFG;
  43 class PhaseLive;
  44 class PhaseRegAlloc;
  45 class   PhaseChaitin;
  46 
  47 #define OPTO_DEBUG_SPLIT_FREQ  BLOCK_FREQUENCY(0.001)
  48 #define OPTO_LRG_HIGH_FREQ     BLOCK_FREQUENCY(0.25)

  49 
  50 //------------------------------LRG--------------------------------------------
  51 // Live-RanGe structure.
  52 class LRG : public ResourceObj {
  53   friend class VMStructs;
  54 public:
  55   enum { SPILL_REG=29999 };     // Register number of a spilled LRG
  56 
  57   double _cost;                 // 2 for loads/1 for stores times block freq
  58   double _area;                 // Sum of all simultaneously live values
  59   double score() const;         // Compute score from cost and area
  60   double _maxfreq;              // Maximum frequency of any def or use
  61 
  62   Node *_def;                   // Check for multi-def live ranges
  63 #ifndef PRODUCT
  64   GrowableArray<Node*>* _defs;
  65 #endif
  66 
  67   uint _risk_bias;              // Index of LRG which we want to avoid color
  68   uint _copy_bias;              // Index of LRG which we want to share color


  78   void set_reg( OptoReg::Name r ) { _reg = r; }
  79 
  80 private:
  81   uint _eff_degree;             // Effective degree: Sum of neighbors _num_regs
  82 public:
  83   int degree() const { assert( _degree_valid, "" ); return _eff_degree; }
  84   // Degree starts not valid and any change to the IFG neighbor
  85   // set makes it not valid.
  86   void set_degree( uint degree ) { _eff_degree = degree; debug_only(_degree_valid = 1;) }
  87   // Made a change that hammered degree
  88   void invalid_degree() { debug_only(_degree_valid=0;) }
  89   // Incrementally modify degree.  If it was correct, it should remain correct
  90   void inc_degree( uint mod ) { _eff_degree += mod; }
  91   // Compute the degree between 2 live ranges
  92   int compute_degree( LRG &l ) const;
  93 
  94 private:
  95   RegMask _mask;                // Allowed registers for this LRG
  96   uint _mask_size;              // cache of _mask.Size();
  97 public:
  98   int compute_mask_size() const { return _mask.is_AllStack() ? 65535 : _mask.Size(); }
  99   void set_mask_size( int size ) {
 100     assert((size == 65535) || (size == (int)_mask.Size()), "");
 101     _mask_size = size;
 102 #ifdef ASSERT
 103     _msize_valid=1;
 104     if (_is_vector) {
 105       assert(!_fat_proj, "sanity");
 106       _mask.verify_sets(_num_regs);
 107     } else if (_num_regs == 2 && !_fat_proj) {
 108       _mask.verify_pairs();
 109     }
 110 #endif
 111   }
 112   void compute_set_mask_size() { set_mask_size(compute_mask_size()); }
 113   int mask_size() const { assert( _msize_valid, "mask size not valid" );
 114                           return _mask_size; }
 115   // Get the last mask size computed, even if it does not match the
 116   // count of bits in the current mask.
 117   int get_invalid_mask_size() const { return _mask_size; }
 118   const RegMask &mask() const { return _mask; }
 119   void set_mask( const RegMask &rm ) { _mask = rm; debug_only(_msize_valid=0;)}
 120   void AND( const RegMask &rm ) { _mask.AND(rm); debug_only(_msize_valid=0;)}




  29 #include "libadt/port.hpp"
  30 #include "memory/resourceArea.hpp"
  31 #include "opto/connode.hpp"
  32 #include "opto/live.hpp"
  33 #include "opto/matcher.hpp"
  34 #include "opto/phase.hpp"
  35 #include "opto/regalloc.hpp"
  36 #include "opto/regmask.hpp"
  37 
  38 class LoopTree;
  39 class MachCallNode;
  40 class MachSafePointNode;
  41 class Matcher;
  42 class PhaseCFG;
  43 class PhaseLive;
  44 class PhaseRegAlloc;
  45 class   PhaseChaitin;
  46 
  47 #define OPTO_DEBUG_SPLIT_FREQ  BLOCK_FREQUENCY(0.001)
  48 #define OPTO_LRG_HIGH_FREQ     BLOCK_FREQUENCY(0.25)
  49 #define LRG_All_STACK_SIZE     1048575
  50 
  51 //------------------------------LRG--------------------------------------------
  52 // Live-RanGe structure.
  53 class LRG : public ResourceObj {
  54   friend class VMStructs;
  55 public:
  56   enum { SPILL_REG=29999 };     // Register number of a spilled LRG
  57 
  58   double _cost;                 // 2 for loads/1 for stores times block freq
  59   double _area;                 // Sum of all simultaneously live values
  60   double score() const;         // Compute score from cost and area
  61   double _maxfreq;              // Maximum frequency of any def or use
  62 
  63   Node *_def;                   // Check for multi-def live ranges
  64 #ifndef PRODUCT
  65   GrowableArray<Node*>* _defs;
  66 #endif
  67 
  68   uint _risk_bias;              // Index of LRG which we want to avoid color
  69   uint _copy_bias;              // Index of LRG which we want to share color


  79   void set_reg( OptoReg::Name r ) { _reg = r; }
  80 
  81 private:
  82   uint _eff_degree;             // Effective degree: Sum of neighbors _num_regs
  83 public:
  84   int degree() const { assert( _degree_valid, "" ); return _eff_degree; }
  85   // Degree starts not valid and any change to the IFG neighbor
  86   // set makes it not valid.
  87   void set_degree( uint degree ) { _eff_degree = degree; debug_only(_degree_valid = 1;) }
  88   // Made a change that hammered degree
  89   void invalid_degree() { debug_only(_degree_valid=0;) }
  90   // Incrementally modify degree.  If it was correct, it should remain correct
  91   void inc_degree( uint mod ) { _eff_degree += mod; }
  92   // Compute the degree between 2 live ranges
  93   int compute_degree( LRG &l ) const;
  94 
  95 private:
  96   RegMask _mask;                // Allowed registers for this LRG
  97   uint _mask_size;              // cache of _mask.Size();
  98 public:
  99   int compute_mask_size() const { return _mask.is_AllStack() ? LRG_All_STACK_SIZE : _mask.Size(); }
 100   void set_mask_size( int size ) {
 101     assert((size == LRG_All_STACK_SIZE) || (size == (int)_mask.Size()), "");
 102     _mask_size = size;
 103 #ifdef ASSERT
 104     _msize_valid=1;
 105     if (_is_vector) {
 106       assert(!_fat_proj, "sanity");
 107       _mask.verify_sets(_num_regs);
 108     } else if (_num_regs == 2 && !_fat_proj) {
 109       _mask.verify_pairs();
 110     }
 111 #endif
 112   }
 113   void compute_set_mask_size() { set_mask_size(compute_mask_size()); }
 114   int mask_size() const { assert( _msize_valid, "mask size not valid" );
 115                           return _mask_size; }
 116   // Get the last mask size computed, even if it does not match the
 117   // count of bits in the current mask.
 118   int get_invalid_mask_size() const { return _mask_size; }
 119   const RegMask &mask() const { return _mask; }
 120   void set_mask( const RegMask &rm ) { _mask = rm; debug_only(_msize_valid=0;)}
 121   void AND( const RegMask &rm ) { _mask.AND(rm); debug_only(_msize_valid=0;)}


src/share/vm/opto/chaitin.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File