< prev index next >

src/hotspot/share/gc/parallel/adjoiningGenerationsForHeteroHeap.hpp

Print this page
rev 52004 : webrev.02
rev 52005 : Comments from Sangheon


  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_PARALLEL_ADJOININGGENERATIONSFORHETEROHEAP_HPP
  26 #define SHARE_VM_GC_PARALLEL_ADJOININGGENERATIONSFORHETEROHEAP_HPP
  27 
  28 #include "gc/parallel/adjoiningGenerations.hpp"
  29 
  30 class AdjoiningGenerationsForHeteroHeap : public AdjoiningGenerations {
  31   friend class VMStructs;
  32 private:
  33   // Maximum total size of the generations. This is equal to the heap size specified by user.
  34   // When adjusting young and old generation sizes, we need ensure that sum of the generation sizes does not exceed this.
  35   size_t _total_size_limit;
  36 
  37   size_t total_size_limit() const {
  38     return _total_size_limit;
  39   }
  40 
  41   // HeteroVirtualSpaces creates non-overlapping virtual spaces.
  42   // low() manages memory in nv-dimm and is meant for old generation.
  43   // high() manages memory in dram and is meant for young generation.
  44   class HeteroVirtualSpaces : public AdjoiningVirtualSpaces {
  45     PSVirtualSpace*    _young_vs;
  46     PSVirtualSpace*    _old_vs;
  47 
  48     size_t _min_old_byte_size;
  49     size_t _min_young_byte_size;
  50     size_t _max_old_byte_size;
  51     size_t _max_young_byte_size;
  52     size_t _max_total_size;
  53 






  54   public:
  55     HeteroVirtualSpaces(ReservedSpace rs,
  56                         size_t min_old_byte_size,
  57                         size_t min_young_byte_size, size_t max_total_size,
  58                         size_t alignment);
  59 
  60     PSVirtualSpace* high() { return _young_vs; }
  61     PSVirtualSpace* low() { return _old_vs; }
  62     // Increase old generation size and decrease young generation size by same amount
  63     bool adjust_boundary_up(size_t size_in_bytes);
  64     // Increase young generation size and decrease old generation size by same amount
  65     bool adjust_boundary_down(size_t size_in_bytes);
  66 
  67     size_t max_young_size() const { return _max_young_byte_size; }
  68     size_t max_old_size() const { return _max_old_byte_size; }
  69 
  70     void initialize(size_t initial_old_reserved_size, size_t init_low_byte_size,
  71                     size_t init_high_byte_size);
  72   };
  73 
  74 public:
  75   AdjoiningGenerationsForHeteroHeap(ReservedSpace rs, size_t total_size_limit, GenerationSizer* policy, size_t alignment);
  76 
  77   // Given the size policy, calculate the total amount of memory that needs to be reserved.
  78   // We need to reserve more memory than Xmx, since we use non-overlapping virtual spaces for the young and old generations.
  79   static size_t required_reserved_memory(GenerationSizer* policy);
  80 
  81   // Return the total byte size of the reserved space


  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_PARALLEL_ADJOININGGENERATIONSFORHETEROHEAP_HPP
  26 #define SHARE_VM_GC_PARALLEL_ADJOININGGENERATIONSFORHETEROHEAP_HPP
  27 
  28 #include "gc/parallel/adjoiningGenerations.hpp"
  29 
  30 class AdjoiningGenerationsForHeteroHeap : public AdjoiningGenerations {
  31   friend class VMStructs;
  32 private:
  33   // Maximum total size of the generations. This is equal to the heap size specified by user.
  34   // When adjusting young and old generation sizes, we need ensure that sum of the generation sizes does not exceed this.
  35   size_t _total_size_limit;
  36 
  37   size_t total_size_limit() const {
  38     return _total_size_limit;
  39   }
  40 
  41   // HeteroVirtualSpaces creates non-overlapping virtual spaces. Here _low and _high do not share a reserved space, i.e. there is no boundary
  42   // separating the two virtual spaces.

  43   class HeteroVirtualSpaces : public AdjoiningVirtualSpaces {



  44     size_t _min_old_byte_size;
  45     size_t _min_young_byte_size;
  46     size_t _max_old_byte_size;
  47     size_t _max_young_byte_size;
  48     size_t _max_total_size;
  49 
  50     // Internally we access the virtual spaces using these methods. It increases readability, since we were not really 
  51     // dealing with adjoining virtual spaces separated by a boundary as is the case in base class.
  52     // Externally they are accessed using low() and high() methods of base class.
  53     PSVirtualSpace* young_vs() { return high(); }
  54     PSVirtualSpace* old_vs() { return low(); }
  55 
  56   public:
  57     HeteroVirtualSpaces(ReservedSpace rs,
  58                         size_t min_old_byte_size,
  59                         size_t min_young_byte_size, size_t max_total_size,
  60                         size_t alignment);
  61 


  62     // Increase old generation size and decrease young generation size by same amount
  63     bool adjust_boundary_up(size_t size_in_bytes);
  64     // Increase young generation size and decrease old generation size by same amount
  65     bool adjust_boundary_down(size_t size_in_bytes);
  66 
  67     size_t max_young_size() const { return _max_young_byte_size; }
  68     size_t max_old_size() const { return _max_old_byte_size; }
  69 
  70     void initialize(size_t initial_old_reserved_size, size_t init_low_byte_size,
  71                     size_t init_high_byte_size);
  72   };
  73 
  74 public:
  75   AdjoiningGenerationsForHeteroHeap(ReservedSpace rs, size_t total_size_limit, GenerationSizer* policy, size_t alignment);
  76 
  77   // Given the size policy, calculate the total amount of memory that needs to be reserved.
  78   // We need to reserve more memory than Xmx, since we use non-overlapping virtual spaces for the young and old generations.
  79   static size_t required_reserved_memory(GenerationSizer* policy);
  80 
  81   // Return the total byte size of the reserved space
< prev index next >