src/share/vm/gc_implementation/g1/heapRegion.inline.hpp

changeset 6992
2c6ef90f030a
parent 6990
1526a938e670
child 6996
f3aeae1f9fc5
equal deleted inserted replaced
6991:882004b9e7e1 6992:2c6ef90f030a
91 return _offsets.block_start_const(p); 91 return _offsets.block_start_const(p);
92 } 92 }
93 93
94 inline bool 94 inline bool
95 HeapRegion::block_is_obj(const HeapWord* p) const { 95 HeapRegion::block_is_obj(const HeapWord* p) const {
96 return p < top(); 96 G1CollectedHeap* g1h = G1CollectedHeap::heap();
97 return !g1h->is_obj_dead(oop(p), this);
97 } 98 }
98 99
99 inline size_t 100 inline size_t
100 HeapRegion::block_size(const HeapWord *addr) const { 101 HeapRegion::block_size(const HeapWord *addr) const {
101 const HeapWord* current_top = top(); 102 // Old regions' dead objects may have dead classes
102 if (addr < current_top) { 103 // We need to find the next live object in some other
103 return oop(addr)->size(); 104 // manner than getting the oop size
104 } else { 105 G1CollectedHeap* g1h = G1CollectedHeap::heap();
105 assert(addr == current_top, "just checking"); 106 if (g1h->is_obj_dead(oop(addr), this)) {
107 HeapWord* next = g1h->concurrent_mark()->prevMarkBitMap()->
108 getNextMarkedWordAddress(addr, prev_top_at_mark_start());
109
110 assert(next > addr, "must get the next live object");
111
112 return pointer_delta(next, addr);
113 } else if (addr == top()) {
106 return pointer_delta(end(), addr); 114 return pointer_delta(end(), addr);
107 } 115 }
116 return oop(addr)->size();
108 } 117 }
109 118
110 inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t word_size) { 119 inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t word_size) {
111 assert(is_young(), "we can only skip BOT updates on young regions"); 120 assert(is_young(), "we can only skip BOT updates on young regions");
112 return par_allocate_impl(word_size, end()); 121 return par_allocate_impl(word_size, end());

mercurial