160 "All blocks should be objects if class unloading isn't used, so this method should not be called. "
161 "HR: [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ") "
162 "addr: " PTR_FORMAT,
163 p2i(bottom()), p2i(top()), p2i(end()), p2i(addr));
164
165 // Old regions' dead objects may have dead classes
166 // We need to find the next live object using the bitmap
167 HeapWord* next = prev_bitmap->get_next_marked_addr(addr, prev_top_at_mark_start());
168
169 assert(next > addr, "must get the next live object");
170 return pointer_delta(next, addr);
171 }
172
173 inline bool HeapRegion::is_obj_dead(const oop obj, const G1CMBitMap* const prev_bitmap) const {
174 assert(is_in_reserved(obj), "Object " PTR_FORMAT " must be in region", p2i(obj));
175 return !obj_allocated_since_prev_marking(obj) &&
176 !prev_bitmap->is_marked(obj) &&
177 !is_closed_archive();
178 }
179
180 inline size_t HeapRegion::block_size(const HeapWord *addr) const {
181 if (addr == top()) {
182 return pointer_delta(end(), addr);
183 }
184
185 if (block_is_obj(addr)) {
186 return cast_to_oop(addr)->size();
187 }
188
189 return block_size_using_bitmap(addr, G1CollectedHeap::heap()->concurrent_mark()->prev_mark_bitmap());
190 }
191
192 inline void HeapRegion::reset_compaction_top_after_compaction() {
193 set_top(compaction_top());
194 _compaction_top = bottom();
195 }
196
197 inline void HeapRegion::reset_compacted_after_full_gc() {
198 assert(!is_pinned(), "must be");
199
200 reset_compaction_top_after_compaction();
201 // After a compaction the mark bitmap in a non-pinned regions is invalid.
202 // We treat all objects as being above PTAMS.
203 zero_marked_bytes();
204 init_top_at_mark_start();
205
206 reset_after_full_gc_common();
|
160 "All blocks should be objects if class unloading isn't used, so this method should not be called. "
161 "HR: [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ") "
162 "addr: " PTR_FORMAT,
163 p2i(bottom()), p2i(top()), p2i(end()), p2i(addr));
164
165 // Old regions' dead objects may have dead classes
166 // We need to find the next live object using the bitmap
167 HeapWord* next = prev_bitmap->get_next_marked_addr(addr, prev_top_at_mark_start());
168
169 assert(next > addr, "must get the next live object");
170 return pointer_delta(next, addr);
171 }
172
173 inline bool HeapRegion::is_obj_dead(const oop obj, const G1CMBitMap* const prev_bitmap) const {
174 assert(is_in_reserved(obj), "Object " PTR_FORMAT " must be in region", p2i(obj));
175 return !obj_allocated_since_prev_marking(obj) &&
176 !prev_bitmap->is_marked(obj) &&
177 !is_closed_archive();
178 }
179
180 template <bool RESOLVE>
181 inline size_t HeapRegion::block_size(const HeapWord *addr) const {
182 if (addr == top()) {
183 return pointer_delta(end(), addr);
184 }
185
186 if (block_is_obj(addr)) {
187 oop obj = cast_to_oop(addr);
188 #ifdef _LP64
189 #ifdef ASSERT
190 if (RESOLVE) {
191 assert(UseCompactObjectHeaders && !G1CollectedHeap::heap()->collector_state()->in_full_gc(), "Illegal/excessive resolve during full-GC");
192 } else {
193 assert(!UseCompactObjectHeaders || G1CollectedHeap::heap()->collector_state()->in_full_gc() || !obj->is_forwarded(), "Missing resolve when forwarded during normal GC");
194 }
195 #endif
196 if (RESOLVE && obj->is_forwarded()) {
197 obj = obj->forwardee();
198 }
199 #endif
200 return obj->size();
201 }
202
203 return block_size_using_bitmap(addr, G1CollectedHeap::heap()->concurrent_mark()->prev_mark_bitmap());
204 }
205
206 inline void HeapRegion::reset_compaction_top_after_compaction() {
207 set_top(compaction_top());
208 _compaction_top = bottom();
209 }
210
211 inline void HeapRegion::reset_compacted_after_full_gc() {
212 assert(!is_pinned(), "must be");
213
214 reset_compaction_top_after_compaction();
215 // After a compaction the mark bitmap in a non-pinned regions is invalid.
216 // We treat all objects as being above PTAMS.
217 zero_marked_bytes();
218 init_top_at_mark_start();
219
220 reset_after_full_gc_common();
|