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

changeset 6996
f3aeae1f9fc5
parent 6992
2c6ef90f030a
child 7535
7ae4e26cb1e0
child 9327
f96fcd9e1e1b
equal deleted inserted replaced
6995:684a5dec6072 6996:f3aeae1f9fc5
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 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 96 G1CollectedHeap* g1h = G1CollectedHeap::heap();
97 return !g1h->is_obj_dead(oop(p), this); 97 if (ClassUnloadingWithConcurrentMark) {
98 return !g1h->is_obj_dead(oop(p), this);
99 }
100 return p < top();
98 } 101 }
99 102
100 inline size_t 103 inline size_t
101 HeapRegion::block_size(const HeapWord *addr) const { 104 HeapRegion::block_size(const HeapWord *addr) const {
105 if (addr == top()) {
106 return pointer_delta(end(), addr);
107 }
108
109 if (block_is_obj(addr)) {
110 return oop(addr)->size();
111 }
112
113 assert(ClassUnloadingWithConcurrentMark,
114 err_msg("All blocks should be objects if G1 Class Unloading isn't used. "
115 "HR: ["PTR_FORMAT", "PTR_FORMAT", "PTR_FORMAT") "
116 "addr: " PTR_FORMAT,
117 p2i(bottom()), p2i(top()), p2i(end()), p2i(addr)));
118
102 // Old regions' dead objects may have dead classes 119 // Old regions' dead objects may have dead classes
103 // We need to find the next live object in some other 120 // We need to find the next live object in some other
104 // manner than getting the oop size 121 // manner than getting the oop size
105 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 122 G1CollectedHeap* g1h = G1CollectedHeap::heap();
106 if (g1h->is_obj_dead(oop(addr), this)) { 123 HeapWord* next = g1h->concurrent_mark()->prevMarkBitMap()->
107 HeapWord* next = g1h->concurrent_mark()->prevMarkBitMap()-> 124 getNextMarkedWordAddress(addr, prev_top_at_mark_start());
108 getNextMarkedWordAddress(addr, prev_top_at_mark_start());
109 125
110 assert(next > addr, "must get the next live object"); 126 assert(next > addr, "must get the next live object");
111 127 return pointer_delta(next, addr);
112 return pointer_delta(next, addr);
113 } else if (addr == top()) {
114 return pointer_delta(end(), addr);
115 }
116 return oop(addr)->size();
117 } 128 }
118 129
119 inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t word_size) { 130 inline HeapWord* HeapRegion::par_allocate_no_bot_updates(size_t word_size) {
120 assert(is_young(), "we can only skip BOT updates on young regions"); 131 assert(is_young(), "we can only skip BOT updates on young regions");
121 return par_allocate_impl(word_size, end()); 132 return par_allocate_impl(word_size, end());

mercurial