hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp
changeset 9989 305a76435cf1
parent 8928 e5c53268bef5
child 10243 d00a21009f1f
equal deleted inserted replaced
9988:01f84e2c3fc0 9989:305a76435cf1
    32 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
    32 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
    33 #include "utilities/taskqueue.hpp"
    33 #include "utilities/taskqueue.hpp"
    34 
    34 
    35 // Inline functions for G1CollectedHeap
    35 // Inline functions for G1CollectedHeap
    36 
    36 
       
    37 template <class T>
    37 inline HeapRegion*
    38 inline HeapRegion*
    38 G1CollectedHeap::heap_region_containing(const void* addr) const {
    39 G1CollectedHeap::heap_region_containing(const T addr) const {
    39   HeapRegion* hr = _hrs->addr_to_region(addr);
    40   HeapRegion* hr = _hrs.addr_to_region((HeapWord*) addr);
    40   // hr can be null if addr in perm_gen
    41   // hr can be null if addr in perm_gen
    41   if (hr != NULL && hr->continuesHumongous()) {
    42   if (hr != NULL && hr->continuesHumongous()) {
    42     hr = hr->humongous_start_region();
    43     hr = hr->humongous_start_region();
    43   }
    44   }
    44   return hr;
    45   return hr;
    45 }
    46 }
    46 
    47 
       
    48 template <class T>
    47 inline HeapRegion*
    49 inline HeapRegion*
    48 G1CollectedHeap::heap_region_containing_raw(const void* addr) const {
    50 G1CollectedHeap::heap_region_containing_raw(const T addr) const {
    49   assert(_g1_reserved.contains(addr), "invariant");
    51   assert(_g1_reserved.contains((const void*) addr), "invariant");
    50   size_t index = pointer_delta(addr, _g1_reserved.start(), 1)
    52   HeapRegion* res = _hrs.addr_to_region_unsafe((HeapWord*) addr);
    51                                         >> HeapRegion::LogOfHRGrainBytes;
       
    52 
       
    53   HeapRegion* res = _hrs->at(index);
       
    54   assert(res == _hrs->addr_to_region(addr), "sanity");
       
    55   return res;
    53   return res;
    56 }
    54 }
    57 
    55 
    58 inline bool G1CollectedHeap::obj_in_cs(oop obj) {
    56 inline bool G1CollectedHeap::obj_in_cs(oop obj) {
    59   HeapRegion* r = _hrs->addr_to_region(obj);
    57   HeapRegion* r = _hrs.addr_to_region((HeapWord*) obj);
    60   return r != NULL && r->in_collection_set();
    58   return r != NULL && r->in_collection_set();
    61 }
    59 }
    62 
    60 
    63 inline HeapWord*
    61 inline HeapWord*
    64 G1CollectedHeap::attempt_allocation(size_t word_size,
    62 G1CollectedHeap::attempt_allocation(size_t word_size,