1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Tue Apr 01 07:46:51 2014 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp Tue Aug 19 12:39:06 2014 +0200 1.3 @@ -49,21 +49,22 @@ 1.4 1.5 template <class T> 1.6 inline HeapRegion* 1.7 -G1CollectedHeap::heap_region_containing(const T addr) const { 1.8 - HeapRegion* hr = _hrs.addr_to_region((HeapWord*) addr); 1.9 - // hr can be null if addr in perm_gen 1.10 - if (hr != NULL && hr->continuesHumongous()) { 1.11 - hr = hr->humongous_start_region(); 1.12 - } 1.13 - return hr; 1.14 +G1CollectedHeap::heap_region_containing_raw(const T addr) const { 1.15 + assert(addr != NULL, "invariant"); 1.16 + assert(_g1_reserved.contains((const void*) addr), 1.17 + err_msg("Address "PTR_FORMAT" is outside of the heap ranging from ["PTR_FORMAT" to "PTR_FORMAT")", 1.18 + p2i((void*)addr), p2i(_g1_reserved.start()), p2i(_g1_reserved.end()))); 1.19 + return _hrs.addr_to_region((HeapWord*) addr); 1.20 } 1.21 1.22 template <class T> 1.23 inline HeapRegion* 1.24 -G1CollectedHeap::heap_region_containing_raw(const T addr) const { 1.25 - assert(_g1_reserved.contains((const void*) addr), "invariant"); 1.26 - HeapRegion* res = _hrs.addr_to_region_unsafe((HeapWord*) addr); 1.27 - return res; 1.28 +G1CollectedHeap::heap_region_containing(const T addr) const { 1.29 + HeapRegion* hr = heap_region_containing_raw(addr); 1.30 + if (hr->continuesHumongous()) { 1.31 + return hr->humongous_start_region(); 1.32 + } 1.33 + return hr; 1.34 } 1.35 1.36 inline void G1CollectedHeap::reset_gc_time_stamp() { 1.37 @@ -154,8 +155,7 @@ 1.38 // have to keep calling heap_region_containing_raw() in the 1.39 // asserts below. 1.40 DEBUG_ONLY(HeapRegion* containing_hr = heap_region_containing_raw(start);) 1.41 - assert(containing_hr != NULL && start != NULL && word_size > 0, 1.42 - "pre-condition"); 1.43 + assert(word_size > 0, "pre-condition"); 1.44 assert(containing_hr->is_in(start), "it should contain start"); 1.45 assert(containing_hr->is_young(), "it should be young"); 1.46 assert(!containing_hr->isHumongous(), "it should not be humongous"); 1.47 @@ -277,8 +277,10 @@ 1.48 #endif // #ifndef PRODUCT 1.49 1.50 inline bool G1CollectedHeap::is_in_young(const oop obj) { 1.51 - HeapRegion* hr = heap_region_containing(obj); 1.52 - return hr != NULL && hr->is_young(); 1.53 + if (obj == NULL) { 1.54 + return false; 1.55 + } 1.56 + return heap_region_containing(obj)->is_young(); 1.57 } 1.58 1.59 // We don't need barriers for initializing stores to objects 1.60 @@ -291,21 +293,17 @@ 1.61 } 1.62 1.63 inline bool G1CollectedHeap::is_obj_dead(const oop obj) const { 1.64 - const HeapRegion* hr = heap_region_containing(obj); 1.65 - if (hr == NULL) { 1.66 - if (obj == NULL) return false; 1.67 - else return true; 1.68 + if (obj == NULL) { 1.69 + return false; 1.70 } 1.71 - else return is_obj_dead(obj, hr); 1.72 + return is_obj_dead(obj, heap_region_containing(obj)); 1.73 } 1.74 1.75 inline bool G1CollectedHeap::is_obj_ill(const oop obj) const { 1.76 - const HeapRegion* hr = heap_region_containing(obj); 1.77 - if (hr == NULL) { 1.78 - if (obj == NULL) return false; 1.79 - else return true; 1.80 + if (obj == NULL) { 1.81 + return false; 1.82 } 1.83 - else return is_obj_ill(obj, hr); 1.84 + return is_obj_ill(obj, heap_region_containing(obj)); 1.85 } 1.86 1.87 inline void G1CollectedHeap::set_humongous_is_live(oop obj) {