hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp
changeset 31592 43f48e165466
parent 31331 a7c714b6cfb3
child 31632 d041b34dd3e7
equal deleted inserted replaced
31401:1514c0a798d2 31592:43f48e165466
    80 // Return the region with the given index. It assumes the index is valid.
    80 // Return the region with the given index. It assumes the index is valid.
    81 inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrm.at(index); }
    81 inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrm.at(index); }
    82 
    82 
    83 inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
    83 inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
    84   assert(is_in_reserved(addr),
    84   assert(is_in_reserved(addr),
    85          err_msg("Cannot calculate region index for address "PTR_FORMAT" that is outside of the heap ["PTR_FORMAT", "PTR_FORMAT")",
    85          err_msg("Cannot calculate region index for address " PTR_FORMAT " that is outside of the heap [" PTR_FORMAT ", " PTR_FORMAT ")",
    86                  p2i(addr), p2i(reserved_region().start()), p2i(reserved_region().end())));
    86                  p2i(addr), p2i(reserved_region().start()), p2i(reserved_region().end())));
    87   return (uint)(pointer_delta(addr, reserved_region().start(), sizeof(uint8_t)) >> HeapRegion::LogOfHRGrainBytes);
    87   return (uint)(pointer_delta(addr, reserved_region().start(), sizeof(uint8_t)) >> HeapRegion::LogOfHRGrainBytes);
    88 }
    88 }
    89 
    89 
    90 inline HeapWord* G1CollectedHeap::bottom_addr_for_region(uint index) const {
    90 inline HeapWord* G1CollectedHeap::bottom_addr_for_region(uint index) const {
    93 
    93 
    94 template <class T>
    94 template <class T>
    95 inline HeapRegion* G1CollectedHeap::heap_region_containing_raw(const T addr) const {
    95 inline HeapRegion* G1CollectedHeap::heap_region_containing_raw(const T addr) const {
    96   assert(addr != NULL, "invariant");
    96   assert(addr != NULL, "invariant");
    97   assert(is_in_g1_reserved((const void*) addr),
    97   assert(is_in_g1_reserved((const void*) addr),
    98       err_msg("Address "PTR_FORMAT" is outside of the heap ranging from ["PTR_FORMAT" to "PTR_FORMAT")",
    98       err_msg("Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")",
    99           p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end())));
    99           p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end())));
   100   return _hrm.addr_to_region((HeapWord*) addr);
   100   return _hrm.addr_to_region((HeapWord*) addr);
   101 }
   101 }
   102 
   102 
   103 template <class T>
   103 template <class T>