src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc_implementation/parallelScavenge

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

Print this page




 138   inline HeapWord* bit_to_addr(idx_t bit) const;
 139 
 140   // Return the bit index of the first marked object that begins (or ends,
 141   // respectively) in the range [beg, end).  If no object is found, return end.
 142   inline idx_t find_obj_beg(idx_t beg, idx_t end) const;
 143   inline idx_t find_obj_end(idx_t beg, idx_t end) const;
 144 
 145   inline HeapWord* find_obj_beg(HeapWord* beg, HeapWord* end) const;
 146   inline HeapWord* find_obj_end(HeapWord* beg, HeapWord* end) const;
 147 
 148   // Clear a range of bits or the entire bitmap (both begin and end bits are
 149   // cleared).
 150   inline void clear_range(idx_t beg, idx_t end);
 151 
 152   // Return the number of bits required to represent the specified number of
 153   // HeapWords, or the specified region.
 154   static inline idx_t bits_required(size_t words);
 155   static inline idx_t bits_required(MemRegion covered_region);
 156 
 157   void print_on_error(outputStream* st) const {
 158     st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this);
 159     _beg_bits.print_on_error(st, " Begin Bits: ");
 160     _end_bits.print_on_error(st, " End Bits:   ");
 161   }
 162 
 163 #ifdef  ASSERT
 164   void verify_clear() const;
 165   inline void verify_bit(idx_t bit) const;
 166   inline void verify_addr(HeapWord* addr) const;
 167 #endif  // #ifdef ASSERT
 168 
 169 private:
 170   // Each bit in the bitmap represents one unit of 'object granularity.' Objects
 171   // are double-word aligned in 32-bit VMs, but not in 64-bit VMs, so the 32-bit
 172   // granularity is 2, 64-bit is 1.
 173   static inline size_t obj_granularity() { return size_t(MinObjAlignment); }
 174   static inline int obj_granularity_shift() { return LogMinObjAlignment; }
 175 
 176   HeapWord*       _region_start;
 177   size_t          _region_size;
 178   BitMap          _beg_bits;


 373 
 374 inline HeapWord*
 375 ParMarkBitMap::find_obj_end(HeapWord* beg, HeapWord* end) const
 376 {
 377   const idx_t beg_bit = addr_to_bit(beg);
 378   const idx_t end_bit = addr_to_bit(end);
 379   const idx_t search_end = BitMap::word_align_up(end_bit);
 380   const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit);
 381   return bit_to_addr(res_bit);
 382 }
 383 
 384 #ifdef  ASSERT
 385 inline void ParMarkBitMap::verify_bit(idx_t bit) const {
 386   // Allow one past the last valid bit; useful for loop bounds.
 387   assert(bit <= _beg_bits.size(), "bit out of range");
 388 }
 389 
 390 inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
 391   // Allow one past the last valid address; useful for loop bounds.
 392   assert(addr >= region_start(),
 393       err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, addr, region_start()));
 394   assert(addr <= region_end(),
 395       err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, addr, region_end()));
 396 }
 397 #endif  // #ifdef ASSERT
 398 
 399 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP


 138   inline HeapWord* bit_to_addr(idx_t bit) const;
 139 
 140   // Return the bit index of the first marked object that begins (or ends,
 141   // respectively) in the range [beg, end).  If no object is found, return end.
 142   inline idx_t find_obj_beg(idx_t beg, idx_t end) const;
 143   inline idx_t find_obj_end(idx_t beg, idx_t end) const;
 144 
 145   inline HeapWord* find_obj_beg(HeapWord* beg, HeapWord* end) const;
 146   inline HeapWord* find_obj_end(HeapWord* beg, HeapWord* end) const;
 147 
 148   // Clear a range of bits or the entire bitmap (both begin and end bits are
 149   // cleared).
 150   inline void clear_range(idx_t beg, idx_t end);
 151 
 152   // Return the number of bits required to represent the specified number of
 153   // HeapWords, or the specified region.
 154   static inline idx_t bits_required(size_t words);
 155   static inline idx_t bits_required(MemRegion covered_region);
 156 
 157   void print_on_error(outputStream* st) const {
 158     st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, p2i(this));
 159     _beg_bits.print_on_error(st, " Begin Bits: ");
 160     _end_bits.print_on_error(st, " End Bits:   ");
 161   }
 162 
 163 #ifdef  ASSERT
 164   void verify_clear() const;
 165   inline void verify_bit(idx_t bit) const;
 166   inline void verify_addr(HeapWord* addr) const;
 167 #endif  // #ifdef ASSERT
 168 
 169 private:
 170   // Each bit in the bitmap represents one unit of 'object granularity.' Objects
 171   // are double-word aligned in 32-bit VMs, but not in 64-bit VMs, so the 32-bit
 172   // granularity is 2, 64-bit is 1.
 173   static inline size_t obj_granularity() { return size_t(MinObjAlignment); }
 174   static inline int obj_granularity_shift() { return LogMinObjAlignment; }
 175 
 176   HeapWord*       _region_start;
 177   size_t          _region_size;
 178   BitMap          _beg_bits;


 373 
 374 inline HeapWord*
 375 ParMarkBitMap::find_obj_end(HeapWord* beg, HeapWord* end) const
 376 {
 377   const idx_t beg_bit = addr_to_bit(beg);
 378   const idx_t end_bit = addr_to_bit(end);
 379   const idx_t search_end = BitMap::word_align_up(end_bit);
 380   const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit);
 381   return bit_to_addr(res_bit);
 382 }
 383 
 384 #ifdef  ASSERT
 385 inline void ParMarkBitMap::verify_bit(idx_t bit) const {
 386   // Allow one past the last valid bit; useful for loop bounds.
 387   assert(bit <= _beg_bits.size(), "bit out of range");
 388 }
 389 
 390 inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
 391   // Allow one past the last valid address; useful for loop bounds.
 392   assert(addr >= region_start(),
 393       err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start())));
 394   assert(addr <= region_end(),
 395       err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end())));
 396 }
 397 #endif  // #ifdef ASSERT
 398 
 399 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP
src/share/vm/gc_implementation/parallelScavenge/parMarkBitMap.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File