< prev index next >
src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp
Print this page
rev 51979 : imported patch 8071913-almost-done
rev 51980 : [mq]: 8071913-alternate
@@ -58,10 +58,12 @@
// Inline functions for G1CollectedHeap
// Return the region with the given index. It assumes the index is valid.
inline HeapRegion* G1CollectedHeap::region_at(uint index) const { return _hrm.at(index); }
+inline HeapRegion* G1CollectedHeap::region_at_or_null(uint index) const { return _hrm.at_or_null(index); }
+
inline HeapRegion* G1CollectedHeap::next_region_in_humongous(HeapRegion* hr) const {
return _hrm.next_region_in_humongous(hr);
}
inline uint G1CollectedHeap::addr_to_region(HeapWord* addr) const {
@@ -82,10 +84,20 @@
"Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")",
p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end()));
return _hrm.addr_to_region((HeapWord*) addr);
}
+template <class T>
+inline HeapRegion* G1CollectedHeap::heap_region_containing_or_null(const T addr) const {
+ assert(addr != NULL, "invariant");
+ assert(is_in_g1_reserved((const void*) addr),
+ "Address " PTR_FORMAT " is outside of the heap ranging from [" PTR_FORMAT " to " PTR_FORMAT ")",
+ p2i((void*)addr), p2i(g1_reserved().start()), p2i(g1_reserved().end()));
+ uint const region_idx = addr_to_region(addr);
+ return _hrm.is_available(region_idx) ? region_at(region_idx) : NULL;
+}
+
inline void G1CollectedHeap::old_set_add(HeapRegion* hr) {
_old_set.add(hr);
}
inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
< prev index next >