src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp
Print this page
*** 26,65 ****
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_INLINE_HPP
#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];
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));
return addr_to_region_unsafe(addr);
}
return NULL;
}
inline HeapRegion* HeapRegionSeq::at(uint index) const {
assert(index < length(), "pre-condition");
! HeapRegion* hr = _regions[index];
assert(hr != NULL, "sanity");
assert(hr->hrs_index() == index, "sanity");
return hr;
}
--- 26,53 ----
#define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSEQ_INLINE_HPP
#include "gc_implementation/g1/heapRegion.hpp"
#include "gc_implementation/g1/heapRegionSeq.hpp"
inline HeapRegion* HeapRegionSeq::addr_to_region_unsafe(HeapWord* addr) const {
! HeapRegion* hr = _regions.get_mapped(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()));
return addr_to_region_unsafe(addr);
}
return NULL;
}
inline HeapRegion* HeapRegionSeq::at(uint index) const {
assert(index < length(), "pre-condition");
! HeapRegion* hr = _regions.get(index);
assert(hr != NULL, "sanity");
assert(hr->hrs_index() == index, "sanity");
return hr;
}