src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp

changeset 2963
c3f1170908be
parent 2715
abdfc822206f
child 3028
f44782f04dd4
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Wed Jun 08 21:48:38 2011 -0400
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Fri Jun 10 13:16:40 2011 -0400
     1.3 @@ -34,9 +34,10 @@
     1.4  
     1.5  // Inline functions for G1CollectedHeap
     1.6  
     1.7 +template <class T>
     1.8  inline HeapRegion*
     1.9 -G1CollectedHeap::heap_region_containing(const void* addr) const {
    1.10 -  HeapRegion* hr = _hrs->addr_to_region(addr);
    1.11 +G1CollectedHeap::heap_region_containing(const T addr) const {
    1.12 +  HeapRegion* hr = _hrs.addr_to_region((HeapWord*) addr);
    1.13    // hr can be null if addr in perm_gen
    1.14    if (hr != NULL && hr->continuesHumongous()) {
    1.15      hr = hr->humongous_start_region();
    1.16 @@ -44,19 +45,16 @@
    1.17    return hr;
    1.18  }
    1.19  
    1.20 +template <class T>
    1.21  inline HeapRegion*
    1.22 -G1CollectedHeap::heap_region_containing_raw(const void* addr) const {
    1.23 -  assert(_g1_reserved.contains(addr), "invariant");
    1.24 -  size_t index = pointer_delta(addr, _g1_reserved.start(), 1)
    1.25 -                                        >> HeapRegion::LogOfHRGrainBytes;
    1.26 -
    1.27 -  HeapRegion* res = _hrs->at(index);
    1.28 -  assert(res == _hrs->addr_to_region(addr), "sanity");
    1.29 +G1CollectedHeap::heap_region_containing_raw(const T addr) const {
    1.30 +  assert(_g1_reserved.contains((const void*) addr), "invariant");
    1.31 +  HeapRegion* res = _hrs.addr_to_region_unsafe((HeapWord*) addr);
    1.32    return res;
    1.33  }
    1.34  
    1.35  inline bool G1CollectedHeap::obj_in_cs(oop obj) {
    1.36 -  HeapRegion* r = _hrs->addr_to_region(obj);
    1.37 +  HeapRegion* r = _hrs.addr_to_region((HeapWord*) obj);
    1.38    return r != NULL && r->in_collection_set();
    1.39  }
    1.40  

mercurial