src/share/vm/gc_implementation/parallelScavenge/psYoungGen.hpp

Print this page




  32  protected:
  33   MemRegion       _reserved;
  34   PSVirtualSpace* _virtual_space;
  35 
  36   // Spaces
  37   MutableSpace* _eden_space;
  38   MutableSpace* _from_space;
  39   MutableSpace* _to_space;
  40 
  41 
  42   // MarkSweep Decorators
  43   PSMarkSweepDecorator* _eden_mark_sweep;
  44   PSMarkSweepDecorator* _from_mark_sweep;
  45   PSMarkSweepDecorator* _to_mark_sweep;
  46 
  47   // Sizing information, in bytes, set in constructor
  48   const size_t _init_gen_size;
  49   const size_t _min_gen_size;
  50   const size_t _max_gen_size;
  51 



  52   // Performance counters
  53   PSGenerationCounters*     _gen_counters;
  54   SpaceCounters*            _eden_counters;
  55   SpaceCounters*            _from_counters;
  56   SpaceCounters*            _to_counters;
  57 
  58   // Initialize the space boundaries
  59   void compute_initial_space_boundaries();
  60 
  61   // Space boundary helper
  62   void set_space_boundaries(size_t eden_size, size_t survivor_size);
  63 
  64   virtual bool resize_generation(size_t eden_size, size_t survivor_size);
  65   virtual void resize_spaces(size_t eden_size, size_t survivor_size);
  66 
  67   // Adjust the spaces to be consistent with the virtual space.
  68   void post_resize();
  69 
  70   // Return number of bytes that the generation can change.
  71   // These should not be used by PSYoungGen


  74 
  75   // Given a desired shrinkage in the size of the young generation,
  76   // return the actual size available for shrinkage.
  77   virtual size_t limit_gen_shrink(size_t desired_change);
  78   // returns the number of bytes available from the current size
  79   // down to the minimum generation size.
  80   size_t available_to_min_gen();
  81   // Return the number of bytes available for shrinkage considering
  82   // the location the live data in the generation.
  83   virtual size_t available_to_live();
  84 
  85  public:
  86   // Initialize the generation.
  87   PSYoungGen(size_t        initial_byte_size,
  88              size_t        minimum_byte_size,
  89              size_t        maximum_byte_size);
  90   void initialize_work();
  91   virtual void initialize(ReservedSpace rs, size_t alignment);
  92   virtual void initialize_virtual_space(ReservedSpace rs, size_t alignment);
  93 


  94   MemRegion reserved() const            { return _reserved; }
  95 
  96   bool is_in(const void* p) const   {
  97       return _virtual_space->contains((void *)p);
  98   }
  99 
 100   bool is_in_reserved(const void* p) const   {
 101       return reserved().contains((void *)p);
 102   }
 103 
 104   MutableSpace*   eden_space() const    { return _eden_space; }
 105   MutableSpace*   from_space() const    { return _from_space; }
 106   MutableSpace*   to_space() const      { return _to_space; }
 107   PSVirtualSpace* virtual_space() const { return _virtual_space; }
 108 
 109   // For Adaptive size policy
 110   size_t min_gen_size() { return _min_gen_size; }
 111 
 112   // MarkSweep support
 113   PSMarkSweepDecorator* eden_mark_sweep() const    { return _eden_mark_sweep; }


 170   void update_counters();
 171 
 172   // Debugging - do not use for time critical operations
 173   void print() const;
 174   void print_on(outputStream* st) const;
 175   void print_used_change(size_t prev_used) const;
 176   virtual const char* name() const { return "PSYoungGen"; }
 177 
 178   void verify(bool allow_dirty);
 179 
 180   // Space boundary invariant checker
 181   void space_invariants() PRODUCT_RETURN;
 182 
 183   // Helper for mangling survivor spaces.
 184   void mangle_survivors(MutableSpace* s1,
 185                         MemRegion s1MR,
 186                         MutableSpace* s2,
 187                         MemRegion s2MR) PRODUCT_RETURN;
 188 
 189   void record_spaces_top() PRODUCT_RETURN;


 190 };


  32  protected:
  33   MemRegion       _reserved;
  34   PSVirtualSpace* _virtual_space;
  35 
  36   // Spaces
  37   MutableSpace* _eden_space;
  38   MutableSpace* _from_space;
  39   MutableSpace* _to_space;
  40 
  41 
  42   // MarkSweep Decorators
  43   PSMarkSweepDecorator* _eden_mark_sweep;
  44   PSMarkSweepDecorator* _from_mark_sweep;
  45   PSMarkSweepDecorator* _to_mark_sweep;
  46 
  47   // Sizing information, in bytes, set in constructor
  48   const size_t _init_gen_size;
  49   const size_t _min_gen_size;
  50   const size_t _max_gen_size;
  51 
  52   size_t _init_survivor_size;
  53   size_t _init_eden_size;
  54 
  55   // Performance counters
  56   PSGenerationCounters*     _gen_counters;
  57   SpaceCounters*            _eden_counters;
  58   SpaceCounters*            _from_counters;
  59   SpaceCounters*            _to_counters;
  60 
  61   // Initialize the space boundaries
  62   void compute_initial_space_boundaries();
  63 
  64   // Space boundary helper
  65   void set_space_boundaries(size_t eden_size, size_t survivor_size);
  66 
  67   virtual bool resize_generation(size_t eden_size, size_t survivor_size);
  68   virtual void resize_spaces(size_t eden_size, size_t survivor_size);
  69 
  70   // Adjust the spaces to be consistent with the virtual space.
  71   void post_resize();
  72 
  73   // Return number of bytes that the generation can change.
  74   // These should not be used by PSYoungGen


  77 
  78   // Given a desired shrinkage in the size of the young generation,
  79   // return the actual size available for shrinkage.
  80   virtual size_t limit_gen_shrink(size_t desired_change);
  81   // returns the number of bytes available from the current size
  82   // down to the minimum generation size.
  83   size_t available_to_min_gen();
  84   // Return the number of bytes available for shrinkage considering
  85   // the location the live data in the generation.
  86   virtual size_t available_to_live();
  87 
  88  public:
  89   // Initialize the generation.
  90   PSYoungGen(size_t        initial_byte_size,
  91              size_t        minimum_byte_size,
  92              size_t        maximum_byte_size);
  93   void initialize_work();
  94   virtual void initialize(ReservedSpace rs, size_t alignment);
  95   virtual void initialize_virtual_space(ReservedSpace rs, size_t alignment);
  96 
  97   size_t init_gen_size()                    { return _init_gen_size; }
  98 
  99   MemRegion reserved() const            { return _reserved; }
 100 
 101   bool is_in(const void* p) const   {
 102       return _virtual_space->contains((void *)p);
 103   }
 104 
 105   bool is_in_reserved(const void* p) const   {
 106       return reserved().contains((void *)p);
 107   }
 108 
 109   MutableSpace*   eden_space() const    { return _eden_space; }
 110   MutableSpace*   from_space() const    { return _from_space; }
 111   MutableSpace*   to_space() const      { return _to_space; }
 112   PSVirtualSpace* virtual_space() const { return _virtual_space; }
 113 
 114   // For Adaptive size policy
 115   size_t min_gen_size() { return _min_gen_size; }
 116 
 117   // MarkSweep support
 118   PSMarkSweepDecorator* eden_mark_sweep() const    { return _eden_mark_sweep; }


 175   void update_counters();
 176 
 177   // Debugging - do not use for time critical operations
 178   void print() const;
 179   void print_on(outputStream* st) const;
 180   void print_used_change(size_t prev_used) const;
 181   virtual const char* name() const { return "PSYoungGen"; }
 182 
 183   void verify(bool allow_dirty);
 184 
 185   // Space boundary invariant checker
 186   void space_invariants() PRODUCT_RETURN;
 187 
 188   // Helper for mangling survivor spaces.
 189   void mangle_survivors(MutableSpace* s1,
 190                         MemRegion s1MR,
 191                         MutableSpace* s2,
 192                         MemRegion s2MR) PRODUCT_RETURN;
 193 
 194   void record_spaces_top() PRODUCT_RETURN;
 195 
 196   void try_to_shrink_by(size_t shrink_bytes);
 197 };