< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp

Print this page
rev 60592 : 8252034: G1: Remove *g1_reserved* methods
Reviewed-by:


  70 inline HeapRegion* G1CollectedHeap::region_at_or_null(uint index) const { return _hrm->at_or_null(index); }
  71 
  72 inline HeapRegion* G1CollectedHeap::next_region_in_humongous(HeapRegion* hr) const {
  73   return _hrm->next_region_in_humongous(hr);
  74 }
  75 
  76 inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
  77   assert(is_in_reserved(addr),
  78          "Cannot calculate region index for address " PTR_FORMAT " that is outside of the heap [" PTR_FORMAT ", " PTR_FORMAT ")",
  79          p2i(addr), p2i(reserved_region().start()), p2i(reserved_region().end()));
  80   return (uint)(pointer_delta(addr, reserved_region().start(), sizeof(uint8_t)) >> HeapRegion::LogOfHRGrainBytes);
  81 }
  82 
  83 inline HeapWord* G1CollectedHeap::bottom_addr_for_region(uint index) const {
  84   return _hrm->reserved().start() + index * HeapRegion::GrainWords;
  85 }
  86 
  87 template <class T>
  88 inline HeapRegion* G1CollectedHeap::heap_region_containing(const T addr) const {
  89   assert(addr != NULL, "invariant");
  90   assert(is_in_g1_reserved((const void*) addr),
  91          "Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")",
  92          p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end()));
  93   return _hrm->addr_to_region((HeapWord*)(void*) addr);
  94 }
  95 
  96 template <class T>
  97 inline HeapRegion* G1CollectedHeap::heap_region_containing_or_null(const T addr) const {
  98   assert(addr != NULL, "invariant");
  99   assert(is_in_g1_reserved((const void*) addr),
 100          "Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")",
 101          p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end()));
 102   uint const region_idx = addr_to_region(addr);
 103   return region_at_or_null(region_idx);
 104 }
 105 
 106 inline void G1CollectedHeap::old_set_add(HeapRegion* hr) {
 107   _old_set.add(hr);
 108 }
 109 
 110 inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
 111   _old_set.remove(hr);
 112 }
 113 
 114 inline void G1CollectedHeap::archive_set_add(HeapRegion* hr) {
 115   _archive_set.add(hr);
 116 }
 117 
 118 // It dirties the cards that cover the block so that the post
 119 // write barrier never queues anything when updating objects on this
 120 // block. It is assumed (and in fact we assert) that the block
 121 // belongs to a young region.




  70 inline HeapRegion* G1CollectedHeap::region_at_or_null(uint index) const { return _hrm->at_or_null(index); }
  71 
  72 inline HeapRegion* G1CollectedHeap::next_region_in_humongous(HeapRegion* hr) const {
  73   return _hrm->next_region_in_humongous(hr);
  74 }
  75 
  76 inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
  77   assert(is_in_reserved(addr),
  78          "Cannot calculate region index for address " PTR_FORMAT " that is outside of the heap [" PTR_FORMAT ", " PTR_FORMAT ")",
  79          p2i(addr), p2i(reserved_region().start()), p2i(reserved_region().end()));
  80   return (uint)(pointer_delta(addr, reserved_region().start(), sizeof(uint8_t)) >> HeapRegion::LogOfHRGrainBytes);
  81 }
  82 
  83 inline HeapWord* G1CollectedHeap::bottom_addr_for_region(uint index) const {
  84   return _hrm->reserved().start() + index * HeapRegion::GrainWords;
  85 }
  86 
  87 template <class T>
  88 inline HeapRegion* G1CollectedHeap::heap_region_containing(const T addr) const {
  89   assert(addr != NULL, "invariant");
  90   assert(is_in_reserved((const void*) addr),
  91          "Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")",
  92          p2i((void*)addr), p2i(reserved_region().start()), p2i(reserved_region().end()));
  93   return _hrm->addr_to_region((HeapWord*)(void*) addr);
  94 }
  95 
  96 template <class T>
  97 inline HeapRegion* G1CollectedHeap::heap_region_containing_or_null(const T addr) const {
  98   assert(addr != NULL, "invariant");
  99   assert(is_in_reserved((const void*) addr),
 100          "Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")",
 101          p2i((void*)addr), p2i(reserved_region().start()), p2i(reserved_region().end()));
 102   uint const region_idx = addr_to_region(addr);
 103   return region_at_or_null(region_idx);
 104 }
 105 
 106 inline void G1CollectedHeap::old_set_add(HeapRegion* hr) {
 107   _old_set.add(hr);
 108 }
 109 
 110 inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
 111   _old_set.remove(hr);
 112 }
 113 
 114 inline void G1CollectedHeap::archive_set_add(HeapRegion* hr) {
 115   _archive_set.add(hr);
 116 }
 117 
 118 // It dirties the cards that cover the block so that the post
 119 // write barrier never queues anything when updating objects on this
 120 // block. It is assumed (and in fact we assert) that the block
 121 // belongs to a young region.


< prev index next >