1.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp Tue Jul 01 09:03:55 2014 +0200 1.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.inline.hpp Mon Jul 07 10:12:40 2014 +0200 1.3 @@ -93,18 +93,27 @@ 1.4 1.5 inline bool 1.6 HeapRegion::block_is_obj(const HeapWord* p) const { 1.7 - return p < top(); 1.8 + G1CollectedHeap* g1h = G1CollectedHeap::heap(); 1.9 + return !g1h->is_obj_dead(oop(p), this); 1.10 } 1.11 1.12 inline size_t 1.13 HeapRegion::block_size(const HeapWord *addr) const { 1.14 - const HeapWord* current_top = top(); 1.15 - if (addr < current_top) { 1.16 - return oop(addr)->size(); 1.17 - } else { 1.18 - assert(addr == current_top, "just checking"); 1.19 + // Old regions' dead objects may have dead classes 1.20 + // We need to find the next live object in some other 1.21 + // manner than getting the oop size 1.22 + G1CollectedHeap* g1h = G1CollectedHeap::heap(); 1.23 + if (g1h->is_obj_dead(oop(addr), this)) { 1.24 + HeapWord* next = g1h->concurrent_mark()->prevMarkBitMap()-> 1.25 + getNextMarkedWordAddress(addr, prev_top_at_mark_start()); 1.26 + 1.27 + assert(next > addr, "must get the next live object"); 1.28 + 1.29 + return pointer_delta(next, addr); 1.30 + } else if (addr == top()) { 1.31 return pointer_delta(end(), addr); 1.32 } 1.33 + return oop(addr)->size(); 1.34 } 1.35 1.36 inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t word_size) {