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

src/share/vm/opto/chaitin.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  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     debug_only(_msize_valid=1;)
 103     debug_only( if( _num_regs == 2 && !_fat_proj ) _mask.VerifyPairs(); )





 104   }


 105   void compute_set_mask_size() { set_mask_size(compute_mask_size()); }
 106   int mask_size() const { assert( _msize_valid, "mask size not valid" );
 107                           return _mask_size; }
 108   // Get the last mask size computed, even if it does not match the
 109   // count of bits in the current mask.
 110   int get_invalid_mask_size() const { return _mask_size; }
 111   const RegMask &mask() const { return _mask; }
 112   void set_mask( const RegMask &rm ) { _mask = rm; debug_only(_msize_valid=0;)}
 113   void AND( const RegMask &rm ) { _mask.AND(rm); debug_only(_msize_valid=0;)}
 114   void SUBTRACT( const RegMask &rm ) { _mask.SUBTRACT(rm); debug_only(_msize_valid=0;)}
 115   void Clear()   { _mask.Clear()  ; debug_only(_msize_valid=1); _mask_size = 0; }
 116   void Set_All() { _mask.Set_All(); debug_only(_msize_valid=1); _mask_size = RegMask::CHUNK_SIZE; }
 117   void Insert( OptoReg::Name reg ) { _mask.Insert(reg);  debug_only(_msize_valid=0;) }
 118   void Remove( OptoReg::Name reg ) { _mask.Remove(reg);  debug_only(_msize_valid=0;) }
 119   void ClearToPairs() { _mask.ClearToPairs(); debug_only(_msize_valid=0;) }

 120 
 121   // Number of registers this live range uses when it colors
 122 private:
 123   uint8 _num_regs;              // 2 for Longs and Doubles, 1 for all else
 124                                 // except _num_regs is kill count for fat_proj
 125 public:
 126   int num_regs() const { return _num_regs; }
 127   void set_num_regs( int reg ) { assert( _num_regs == reg || !_num_regs, "" ); _num_regs = reg; }
 128 
 129 private:
 130   // Number of physical registers this live range uses when it colors
 131   // Architecture and register-set dependent
 132   uint8 _reg_pressure;
 133 public:
 134   void set_reg_pressure(int i)  { _reg_pressure = i; }
 135   int      reg_pressure() const { return _reg_pressure; }
 136 
 137   // How much 'wiggle room' does this live range have?
 138   // How many color choices can it make (scaled by _num_regs)?
 139   int degrees_of_freedom() const { return mask_size() - _num_regs; }
 140   // Bound LRGs have ZERO degrees of freedom.  We also count
 141   // must_spill as bound.
 142   bool is_bound  () const { return _is_bound; }
 143   // Negative degrees-of-freedom; even with no neighbors this
 144   // live range must spill.
 145   bool not_free() const { return degrees_of_freedom() <  0; }
 146   // Is this live range of "low-degree"?  Trivially colorable?
 147   bool lo_degree () const { return degree() <= degrees_of_freedom(); }
 148   // Is this live range just barely "low-degree"?  Trivially colorable?
 149   bool just_lo_degree () const { return degree() == degrees_of_freedom(); }
 150 
 151   uint   _is_oop:1,             // Live-range holds an oop
 152          _is_float:1,           // True if in float registers

 153          _was_spilled1:1,       // True if prior spilling on def
 154          _was_spilled2:1,       // True if twice prior spilling on def
 155          _is_bound:1,           // live range starts life with no
 156                                 // degrees of freedom.
 157          _direct_conflict:1,    // True if def and use registers in conflict
 158          _must_spill:1,         // live range has lost all degrees of freedom
 159     // If _fat_proj is set, live range does NOT require aligned, adjacent
 160     // registers and has NO interferences.
 161     // If _fat_proj is clear, live range requires num_regs() to be a power of
 162     // 2, and it requires registers to form an aligned, adjacent set.
 163          _fat_proj:1,           //
 164          _was_lo:1,             // Was lo-degree prior to coalesce
 165          _msize_valid:1,        // _mask_size cache valid
 166          _degree_valid:1,       // _degree cache valid
 167          _has_copy:1,           // Adjacent to some copy instruction
 168          _at_risk:1;            // Simplify says this guy is at risk to spill
 169 
 170 
 171   // Alive if non-zero, dead if zero
 172   bool alive() const { return _def != NULL; }


   1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  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;)}
 121   void SUBTRACT( const RegMask &rm ) { _mask.SUBTRACT(rm); debug_only(_msize_valid=0;)}
 122   void Clear()   { _mask.Clear()  ; debug_only(_msize_valid=1); _mask_size = 0; }
 123   void Set_All() { _mask.Set_All(); debug_only(_msize_valid=1); _mask_size = RegMask::CHUNK_SIZE; }
 124   void Insert( OptoReg::Name reg ) { _mask.Insert(reg);  debug_only(_msize_valid=0;) }
 125   void Remove( OptoReg::Name reg ) { _mask.Remove(reg);  debug_only(_msize_valid=0;) }
 126   void clear_to_pairs() { _mask.clear_to_pairs(); debug_only(_msize_valid=0;) }
 127   void clear_to_sets()  { _mask.clear_to_sets(_num_regs); debug_only(_msize_valid=0;) }
 128 
 129   // Number of registers this live range uses when it colors
 130 private:
 131   uint8 _num_regs;              // 2 for Longs and Doubles, 1 for all else
 132                                 // except _num_regs is kill count for fat_proj
 133 public:
 134   int num_regs() const { return _num_regs; }
 135   void set_num_regs( int reg ) { assert( _num_regs == reg || !_num_regs, "" ); _num_regs = reg; }
 136 
 137 private:
 138   // Number of physical registers this live range uses when it colors
 139   // Architecture and register-set dependent
 140   uint8 _reg_pressure;
 141 public:
 142   void set_reg_pressure(int i)  { _reg_pressure = i; }
 143   int      reg_pressure() const { return _reg_pressure; }
 144 
 145   // How much 'wiggle room' does this live range have?
 146   // How many color choices can it make (scaled by _num_regs)?
 147   int degrees_of_freedom() const { return mask_size() - _num_regs; }
 148   // Bound LRGs have ZERO degrees of freedom.  We also count
 149   // must_spill as bound.
 150   bool is_bound  () const { return _is_bound; }
 151   // Negative degrees-of-freedom; even with no neighbors this
 152   // live range must spill.
 153   bool not_free() const { return degrees_of_freedom() <  0; }
 154   // Is this live range of "low-degree"?  Trivially colorable?
 155   bool lo_degree () const { return degree() <= degrees_of_freedom(); }
 156   // Is this live range just barely "low-degree"?  Trivially colorable?
 157   bool just_lo_degree () const { return degree() == degrees_of_freedom(); }
 158 
 159   uint   _is_oop:1,             // Live-range holds an oop
 160          _is_float:1,           // True if in float registers
 161          _is_vector:1,          // True if in vector registers
 162          _was_spilled1:1,       // True if prior spilling on def
 163          _was_spilled2:1,       // True if twice prior spilling on def
 164          _is_bound:1,           // live range starts life with no
 165                                 // degrees of freedom.
 166          _direct_conflict:1,    // True if def and use registers in conflict
 167          _must_spill:1,         // live range has lost all degrees of freedom
 168     // If _fat_proj is set, live range does NOT require aligned, adjacent
 169     // registers and has NO interferences.
 170     // If _fat_proj is clear, live range requires num_regs() to be a power of
 171     // 2, and it requires registers to form an aligned, adjacent set.
 172          _fat_proj:1,           //
 173          _was_lo:1,             // Was lo-degree prior to coalesce
 174          _msize_valid:1,        // _mask_size cache valid
 175          _degree_valid:1,       // _degree cache valid
 176          _has_copy:1,           // Adjacent to some copy instruction
 177          _at_risk:1;            // Simplify says this guy is at risk to spill
 178 
 179 
 180   // Alive if non-zero, dead if zero
 181   bool alive() const { return _def != NULL; }


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