diff src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp @ 12305:a19bea467577

7163191: G1: introduce a "heap spanning table" abstraction Summary: Add G1BiasedArray<T> that is an array where each element represents a fixed-sized subdivision of the heap. Use this abstraction to refactor the HeapRegionSeq class. Reviewed-by: brutisso
author tschatzl
date Wed, 25 Sep 2013 13:25:24 +0200
parents 720b6a76dd9d
children de6a9e811145
line wrap: on
line diff
--- a/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Tue Sep 24 10:14:02 2013 +0200
+++ b/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Wed Sep 25 13:25:24 2013 +0200
@@ -28,28 +28,16 @@
 #include "gc_implementation/g1/heapRegion.hpp"
 #include "gc_implementation/g1/heapRegionSeq.hpp"
 
-inline uintx HeapRegionSeq::addr_to_index_biased(HeapWord* addr) const {
-  assert(_heap_bottom <= addr && addr < _heap_end,
-         err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT" end: "PTR_FORMAT,
-                 addr, _heap_bottom, _heap_end));
-  uintx index = (uintx) addr >> _region_shift;
-  return index;
-}
-
 inline HeapRegion* HeapRegionSeq::addr_to_region_unsafe(HeapWord* addr) const {
-  assert(_heap_bottom <= addr && addr < _heap_end,
-         err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT" end: "PTR_FORMAT,
-                 addr, _heap_bottom, _heap_end));
-  uintx index_biased = addr_to_index_biased(addr);
-  HeapRegion* hr = _regions_biased[index_biased];
+  HeapRegion* hr = _regions.get_by_address(addr);
   assert(hr != NULL, "invariant");
   return hr;
 }
 
 inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const {
-  if (addr != NULL && addr < _heap_end) {
-    assert(addr >= _heap_bottom,
-          err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, _heap_bottom));
+  if (addr != NULL && addr < heap_end()) {
+    assert(addr >= heap_bottom(),
+          err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, heap_bottom()));
     return addr_to_region_unsafe(addr);
   }
   return NULL;
@@ -57,7 +45,7 @@
 
 inline HeapRegion* HeapRegionSeq::at(uint index) const {
   assert(index < length(), "pre-condition");
-  HeapRegion* hr = _regions[index];
+  HeapRegion* hr = _regions.get_by_index(index);
   assert(hr != NULL, "sanity");
   assert(hr->hrs_index() == index, "sanity");
   return hr;