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:


  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
  69 
  70   uint _next;                   // Index of next LRG in linked list
  71   uint _prev;                   // Index of prev LRG in linked list
  72 private:
  73   uint _reg;                    // Chosen register; undefined if mask is plural
  74 public:
  75   // Return chosen register for this LRG.  Error if the LRG is not bound to
  76   // a single register.
  77   OptoReg::Name reg() const { return OptoReg::Name(_reg); }
  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;)}




  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   static const uint AllStack_size = 0xFFFFF; // This mask size is used to tell that the mask of this LRG supports stack positions
  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
  70 
  71   uint _next;                   // Index of next LRG in linked list
  72   uint _prev;                   // Index of prev LRG in linked list
  73 private:
  74   uint _reg;                    // Chosen register; undefined if mask is plural
  75 public:
  76   // Return chosen register for this LRG.  Error if the LRG is not bound to
  77   // a single register.
  78   OptoReg::Name reg() const { return OptoReg::Name(_reg); }
  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 ) {
  88     _eff_degree = degree;
  89     assert(!_mask.is_AllStack() || (_mask.is_AllStack() && lo_degree()), "_eff_degree can't be bigger than LRG_All_STACK_SIZE - _num_regs if the mask supports stack registers");
  90     debug_only(_degree_valid = 1;)
  91   }
  92   // Made a change that hammered degree
  93   void invalid_degree() { debug_only(_degree_valid=0;) }
  94   // Incrementally modify degree.  If it was correct, it should remain correct
  95   void inc_degree( uint mod ) {
  96     _eff_degree += mod;
  97     assert(!_mask.is_AllStack() || (_mask.is_AllStack() && lo_degree()), "_eff_degree can't be bigger than LRG_All_STACK_SIZE - _num_regs if the mask supports stack registers");
  98   }
  99   // Compute the degree between 2 live ranges
 100   int compute_degree( LRG &l ) const;
 101 
 102 private:
 103   RegMask _mask;                // Allowed registers for this LRG
 104   uint _mask_size;              // cache of _mask.Size();
 105 public:
 106   int compute_mask_size() const { return _mask.is_AllStack() ? AllStack_size : _mask.Size(); }
 107   void set_mask_size( int size ) {
 108     assert((size == (int)AllStack_size) || (size == (int)_mask.Size()), "");
 109     _mask_size = size;
 110 #ifdef ASSERT
 111     _msize_valid=1;
 112     if (_is_vector) {
 113       assert(!_fat_proj, "sanity");
 114       _mask.verify_sets(_num_regs);
 115     } else if (_num_regs == 2 && !_fat_proj) {
 116       _mask.verify_pairs();
 117     }
 118 #endif
 119   }
 120   void compute_set_mask_size() { set_mask_size(compute_mask_size()); }
 121   int mask_size() const { assert( _msize_valid, "mask size not valid" );
 122                           return _mask_size; }
 123   // Get the last mask size computed, even if it does not match the
 124   // count of bits in the current mask.
 125   int get_invalid_mask_size() const { return _mask_size; }
 126   const RegMask &mask() const { return _mask; }
 127   void set_mask( const RegMask &rm ) { _mask = rm; debug_only(_msize_valid=0;)}
 128   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