src/share/vm/gc_implementation/g1/heapRegionSeq.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-g1-assert Sdiff src/share/vm/gc_implementation/g1

src/share/vm/gc_implementation/g1/heapRegionSeq.hpp

Print this page




  75   uint _region_shift;
  76 
  77   // A hint for which index to start searching from for humongous
  78   // allocations.
  79   uint _next_search_index;
  80 
  81   // The number of regions for which we have allocated HeapRegions for.
  82   uint _allocated_length;
  83 
  84   // The maximum number of regions in the heap.
  85   uint _max_length;
  86 
  87   // Find a contiguous set of empty regions of length num, starting
  88   // from the given index.
  89   uint find_contiguous_from(uint from, uint num);
  90 
  91   // Map a heap address to a biased region index. Assume that the
  92   // address is valid.
  93   inline uintx addr_to_index_biased(HeapWord* addr) const;
  94 
  95   void increment_length(uint* length) {
  96     assert(*length < _max_length, "pre-condition");
  97     *length += 1;
  98   }
  99 
 100   void decrement_length(uint* length) {
 101     assert(*length > 0, "pre-condition");
 102     *length -= 1;





 103   }
 104 
 105  public:
 106   // Empty contructor, we'll initialize it with the initialize() method.
 107   HeapRegionSeq() { }
 108 
 109   void initialize(HeapWord* bottom, HeapWord* end, uint max_length);
 110 
 111   // Return the HeapRegion at the given index. Assume that the index
 112   // is valid.
 113   inline HeapRegion* at(uint index) const;
 114 
 115   // If addr is within the committed space return its corresponding
 116   // HeapRegion, otherwise return NULL.
 117   inline HeapRegion* addr_to_region(HeapWord* addr) const;
 118 
 119   // Return the HeapRegion that corresponds to the given
 120   // address. Assume the address is valid.
 121   inline HeapRegion* addr_to_region_unsafe(HeapWord* addr) const;
 122 


 136                       FreeRegionList* list);
 137 
 138   // Return the number of contiguous regions at the end of the sequence
 139   // that are available for allocation.
 140   uint free_suffix();
 141 
 142   // Find a contiguous set of empty regions of length num and return
 143   // the index of the first region or G1_NULL_HRS_INDEX if the
 144   // search was unsuccessful.
 145   uint find_contiguous(uint num);
 146 
 147   // Apply blk->doHeapRegion() on all committed regions in address order,
 148   // terminating the iteration early if doHeapRegion() returns true.
 149   void iterate(HeapRegionClosure* blk) const;
 150 
 151   // As above, but start the iteration from hr and loop around. If hr
 152   // is NULL, we start from the first region in the heap.
 153   void iterate_from(HeapRegion* hr, HeapRegionClosure* blk) const;
 154 
 155   // Tag as uncommitted as many regions that are completely free as
 156   // possible, up to shrink_bytes, from the suffix of the committed
 157   // sequence. Return a MemRegion that corresponds to the address
 158   // range of the uncommitted regions. Assume shrink_bytes is page and
 159   // heap region aligned.
 160   MemRegion shrink_by(size_t shrink_bytes, uint* num_regions_deleted);
 161 
 162   // Do some sanity checking.
 163   void verify_optional() PRODUCT_RETURN;
 164 };
 165 
 166 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP


  75   uint _region_shift;
  76 
  77   // A hint for which index to start searching from for humongous
  78   // allocations.
  79   uint _next_search_index;
  80 
  81   // The number of regions for which we have allocated HeapRegions for.
  82   uint _allocated_length;
  83 
  84   // The maximum number of regions in the heap.
  85   uint _max_length;
  86 
  87   // Find a contiguous set of empty regions of length num, starting
  88   // from the given index.
  89   uint find_contiguous_from(uint from, uint num);
  90 
  91   // Map a heap address to a biased region index. Assume that the
  92   // address is valid.
  93   inline uintx addr_to_index_biased(HeapWord* addr) const;
  94 
  95   void increment_allocated_length() {
  96     assert(_allocated_length < _max_length, "pre-condition");
  97     _allocated_length++;
  98   }
  99 
 100   void increment_length() {
 101     assert(_length < _max_length, "pre-condition");
 102     _length++;
 103   }
 104 
 105   void decrement_length() {
 106     assert(_length > 0, "pre-condition");
 107     _length--;
 108   }
 109 
 110  public:
 111   // Empty contructor, we'll initialize it with the initialize() method.
 112   HeapRegionSeq() { }
 113 
 114   void initialize(HeapWord* bottom, HeapWord* end, uint max_length);
 115 
 116   // Return the HeapRegion at the given index. Assume that the index
 117   // is valid.
 118   inline HeapRegion* at(uint index) const;
 119 
 120   // If addr is within the committed space return its corresponding
 121   // HeapRegion, otherwise return NULL.
 122   inline HeapRegion* addr_to_region(HeapWord* addr) const;
 123 
 124   // Return the HeapRegion that corresponds to the given
 125   // address. Assume the address is valid.
 126   inline HeapRegion* addr_to_region_unsafe(HeapWord* addr) const;
 127 


 141                       FreeRegionList* list);
 142 
 143   // Return the number of contiguous regions at the end of the sequence
 144   // that are available for allocation.
 145   uint free_suffix();
 146 
 147   // Find a contiguous set of empty regions of length num and return
 148   // the index of the first region or G1_NULL_HRS_INDEX if the
 149   // search was unsuccessful.
 150   uint find_contiguous(uint num);
 151 
 152   // Apply blk->doHeapRegion() on all committed regions in address order,
 153   // terminating the iteration early if doHeapRegion() returns true.
 154   void iterate(HeapRegionClosure* blk) const;
 155 
 156   // As above, but start the iteration from hr and loop around. If hr
 157   // is NULL, we start from the first region in the heap.
 158   void iterate_from(HeapRegion* hr, HeapRegionClosure* blk) const;
 159 
 160   // Tag as uncommitted as many regions that are completely free as
 161   // possible, up to num_regions_to_remove, from the suffix of the committed
 162   // sequence. Return the actual number of removed regions.
 163   uint shrink_by(uint num_regions_to_remove);


 164 
 165   // Do some sanity checking.
 166   void verify_optional() PRODUCT_RETURN;
 167 };
 168 
 169 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_HPP
src/share/vm/gc_implementation/g1/heapRegionSeq.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File