< prev index next >

src/hotspot/share/gc/parallel/mutableSpace.cpp

Print this page

223   // and end here, unlike in cas_allocate.
224   return pointer_delta(end(), top()) < word_size;
225 }
226 
227 void MutableSpace::oop_iterate(OopIterateClosure* cl) {
228   HeapWord* obj_addr = bottom();
229   HeapWord* t = top();
230   // Could call objects iterate, but this is easier.
231   while (obj_addr < t) {
232     obj_addr += cast_to_oop(obj_addr)->oop_iterate_size(cl);
233   }
234 }
235 
236 void MutableSpace::object_iterate(ObjectClosure* cl) {
237   HeapWord* p = bottom();
238   while (p < top()) {
239     oop obj = cast_to_oop(p);
240     // When promotion-failure occurs during Young GC, eden/from space is not cleared,
241     // so we can encounter objects with "forwarded" markword.
242     // They are essentially dead, so skipping them
243     if (!obj->is_forwarded()) {
244       cl->do_object(obj);
245     }
246 #ifdef ASSERT
247     else {
248       assert(obj->forwardee() != obj, "must not be self-forwarded");







249     }
250 #endif
251     p += cast_to_oop(p)->size();
252   }
253 }
254 
255 void MutableSpace::print_short() const { print_short_on(tty); }
256 void MutableSpace::print_short_on( outputStream* st) const {
257   st->print(" space " SIZE_FORMAT "K, %d%% used", capacity_in_bytes() / K,
258             (int) ((double) used_in_bytes() * 100 / capacity_in_bytes()));
259 }
260 
261 void MutableSpace::print() const { print_on(tty); }
262 void MutableSpace::print_on(outputStream* st) const {
263   MutableSpace::print_short_on(st);
264   st->print_cr(" [" PTR_FORMAT "," PTR_FORMAT "," PTR_FORMAT ")",
265                  p2i(bottom()), p2i(top()), p2i(end()));
266 }
267 
268 void MutableSpace::verify() {
269   HeapWord* p = bottom();
270   HeapWord* t = top();
271   HeapWord* prev_p = nullptr;

223   // and end here, unlike in cas_allocate.
224   return pointer_delta(end(), top()) < word_size;
225 }
226 
227 void MutableSpace::oop_iterate(OopIterateClosure* cl) {
228   HeapWord* obj_addr = bottom();
229   HeapWord* t = top();
230   // Could call objects iterate, but this is easier.
231   while (obj_addr < t) {
232     obj_addr += cast_to_oop(obj_addr)->oop_iterate_size(cl);
233   }
234 }
235 
236 void MutableSpace::object_iterate(ObjectClosure* cl) {
237   HeapWord* p = bottom();
238   while (p < top()) {
239     oop obj = cast_to_oop(p);
240     // When promotion-failure occurs during Young GC, eden/from space is not cleared,
241     // so we can encounter objects with "forwarded" markword.
242     // They are essentially dead, so skipping them
243     if (obj->is_forwarded()) {




244       assert(obj->forwardee() != obj, "must not be self-forwarded");
245       // It is safe to use the forwardee here. Parallel GC only uses
246       // header-based forwarding during promotion. Full GC doesn't
247       // use the object header for forwarding at all.
248       p += obj->forwardee()->size();
249     } else {
250       cl->do_object(obj);
251       p += obj->size();
252     }


253   }
254 }
255 
256 void MutableSpace::print_short() const { print_short_on(tty); }
257 void MutableSpace::print_short_on( outputStream* st) const {
258   st->print(" space " SIZE_FORMAT "K, %d%% used", capacity_in_bytes() / K,
259             (int) ((double) used_in_bytes() * 100 / capacity_in_bytes()));
260 }
261 
262 void MutableSpace::print() const { print_on(tty); }
263 void MutableSpace::print_on(outputStream* st) const {
264   MutableSpace::print_short_on(st);
265   st->print_cr(" [" PTR_FORMAT "," PTR_FORMAT "," PTR_FORMAT ")",
266                  p2i(bottom()), p2i(top()), p2i(end()));
267 }
268 
269 void MutableSpace::verify() {
270   HeapWord* p = bottom();
271   HeapWord* t = top();
272   HeapWord* prev_p = nullptr;
< prev index next >