< prev index next >

src/share/vm/memory/cardGeneration.hpp

Print this page
rev 7474 : imported patch separateCardGeneration
rev 7477 : imported patch move_stuff_up


  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  *
  23  */
  24 
  25 #ifndef SHARE_VM_MEMORY_CARDGENERATION_HPP
  26 #define SHARE_VM_MEMORY_CARDGENERATION_HPP
  27 
  28 // Class CardGeneration is a generation that is covered by a card table,
  29 // and uses a card-size block-offset array to implement block_start.
  30 
  31 #include "memory/generation.hpp"
  32 
  33 class BlockOffsetSharedArray;

  34 
  35 class CardGeneration: public Generation {
  36   friend class VMStructs;
  37  protected:
  38   // This is shared with other generations.
  39   GenRemSet* _rs;
  40   // This is local to this generation.
  41   BlockOffsetSharedArray* _bts;
  42 
  43   // current shrinking effect: this damps shrinking when the heap gets empty.
  44   size_t _shrink_factor;
  45 
  46   size_t _min_heap_delta_bytes;   // Minimum amount to expand.
  47 
  48   // Some statistics from before gc started.
  49   // These are gathered in the gc_prologue (and should_collect)
  50   // to control growing/shrinking policy in spite of promotions.
  51   size_t _capacity_at_prologue;
  52   size_t _used_at_prologue;
  53 
  54   CardGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
  55                  GenRemSet* remset);
  56 




  57  public:
  58 
  59   // Attempt to expand the generation by "bytes".  Expand by at a
  60   // minimum "expand_bytes".  Return true if some amount (not
  61   // necessarily the full "bytes") was done.
  62   virtual bool expand(size_t bytes, size_t expand_bytes);
  63 
  64   // Shrink generation with specified size
  65   virtual void shrink(size_t bytes) = 0;
  66 
  67   virtual void compute_new_size();
  68 
  69   virtual void clear_remembered_set();
  70 
  71   virtual void invalidate_remembered_set();
  72 
  73   virtual void prepare_for_verify();
  74 
  75   // Grow generation with specified size (returns false if unable to grow)
  76   virtual bool grow_by(size_t bytes) = 0;
  77   // Grow generation to reserved size.
  78   virtual bool grow_to_reserved() = 0;













  79 };
  80 
  81 #endif // SHARE_VM_MEMORY_CARDGENERATION_HPP


  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  *
  23  */
  24 
  25 #ifndef SHARE_VM_MEMORY_CARDGENERATION_HPP
  26 #define SHARE_VM_MEMORY_CARDGENERATION_HPP
  27 
  28 // Class CardGeneration is a generation that is covered by a card table,
  29 // and uses a card-size block-offset array to implement block_start.
  30 
  31 #include "memory/generation.hpp"
  32 
  33 class BlockOffsetSharedArray;
  34 class CompactibleSpace;
  35 
  36 class CardGeneration: public Generation {
  37   friend class VMStructs;
  38  protected:
  39   // This is shared with other generations.
  40   GenRemSet* _rs;
  41   // This is local to this generation.
  42   BlockOffsetSharedArray* _bts;
  43 
  44   // current shrinking effect: this damps shrinking when the heap gets empty.
  45   size_t _shrink_factor;
  46 
  47   size_t _min_heap_delta_bytes;   // Minimum amount to expand.
  48 
  49   // Some statistics from before gc started.
  50   // These are gathered in the gc_prologue (and should_collect)
  51   // to control growing/shrinking policy in spite of promotions.
  52   size_t _capacity_at_prologue;
  53   size_t _used_at_prologue;
  54 
  55   CardGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
  56                  GenRemSet* remset);
  57 
  58   virtual void assert_correct_size_change_locking() = 0;
  59 
  60   virtual CompactibleSpace* space() const = 0;
  61 
  62  public:
  63 
  64   // Attempt to expand the generation by "bytes".  Expand by at a
  65   // minimum "expand_bytes".  Return true if some amount (not
  66   // necessarily the full "bytes") was done.
  67   virtual bool expand(size_t bytes, size_t expand_bytes);
  68 
  69   // Shrink generation with specified size
  70   virtual void shrink(size_t bytes);
  71 
  72   virtual void compute_new_size();
  73 
  74   virtual void clear_remembered_set();
  75 
  76   virtual void invalidate_remembered_set();
  77 
  78   virtual void prepare_for_verify();
  79 
  80   // Grow generation with specified size (returns false if unable to grow)
  81   bool grow_by(size_t bytes);
  82   // Grow generation to reserved size.
  83   bool grow_to_reserved();
  84 
  85   size_t capacity() const;
  86   size_t used() const;
  87   size_t free() const;
  88   MemRegion used_region() const;
  89 
  90   void space_iterate(SpaceClosure* blk, bool usedOnly = false);
  91 
  92   void younger_refs_iterate(OopsInGenClosure* blk);
  93 
  94   bool is_in(const void* p) const;
  95 
  96   CompactibleSpace* first_compaction_space() const;
  97 };
  98 
  99 #endif // SHARE_VM_MEMORY_CARDGENERATION_HPP
< prev index next >