< prev index next >

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

Print this page

184   HeapWord* obj_addr = bottom();
185   HeapWord* t = top();
186   // Could call objects iterate, but this is easier.
187   while (obj_addr < t) {
188     obj_addr += cast_to_oop(obj_addr)->oop_iterate_size(cl);
189   }
190 }
191 
192 void MutableSpace::object_iterate(ObjectClosure* cl) {
193   HeapWord* p = bottom();
194   while (p < top()) {
195     oop obj = cast_to_oop(p);
196     // When promotion-failure occurs during Young GC, eden/from space is not cleared,
197     // so we can encounter objects with "forwarded" markword.
198     // They are essentially dead, so skipping them
199     if (obj->is_forwarded()) {
200       assert(!obj->is_self_forwarded(), "must not be self-forwarded");
201       // It is safe to use the forwardee here. Parallel GC only uses
202       // header-based forwarding during promotion. Full GC doesn't
203       // use the object header for forwarding at all.
204       p += obj->forwardee()->size();
205     } else {
206       cl->do_object(obj);
207       p += obj->size();
208     }
209   }
210 }
211 
212 void MutableSpace::print_short() const { print_short_on(tty); }
213 void MutableSpace::print_short_on( outputStream* st) const {
214   st->print("space %zuK, %d%% used", capacity_in_bytes() / K,
215             (int) ((double) used_in_bytes() * 100 / capacity_in_bytes()));
216 }
217 
218 void MutableSpace::print() const { print_on(tty, ""); }
219 void MutableSpace::print_on(outputStream* st, const char* prefix) const {
220   st->print("%s", prefix);
221   MutableSpace::print_short_on(st);
222   st->print_cr(" [" PTR_FORMAT "," PTR_FORMAT "," PTR_FORMAT ")",
223                  p2i(bottom()), p2i(top()), p2i(end()));
224 }

184   HeapWord* obj_addr = bottom();
185   HeapWord* t = top();
186   // Could call objects iterate, but this is easier.
187   while (obj_addr < t) {
188     obj_addr += cast_to_oop(obj_addr)->oop_iterate_size(cl);
189   }
190 }
191 
192 void MutableSpace::object_iterate(ObjectClosure* cl) {
193   HeapWord* p = bottom();
194   while (p < top()) {
195     oop obj = cast_to_oop(p);
196     // When promotion-failure occurs during Young GC, eden/from space is not cleared,
197     // so we can encounter objects with "forwarded" markword.
198     // They are essentially dead, so skipping them
199     if (obj->is_forwarded()) {
200       assert(!obj->is_self_forwarded(), "must not be self-forwarded");
201       // It is safe to use the forwardee here. Parallel GC only uses
202       // header-based forwarding during promotion. Full GC doesn't
203       // use the object header for forwarding at all.
204       p += obj->size_forwarded();
205     } else {
206       cl->do_object(obj);
207       p += obj->size();
208     }
209   }
210 }
211 
212 void MutableSpace::print_short() const { print_short_on(tty); }
213 void MutableSpace::print_short_on( outputStream* st) const {
214   st->print("space %zuK, %d%% used", capacity_in_bytes() / K,
215             (int) ((double) used_in_bytes() * 100 / capacity_in_bytes()));
216 }
217 
218 void MutableSpace::print() const { print_on(tty, ""); }
219 void MutableSpace::print_on(outputStream* st, const char* prefix) const {
220   st->print("%s", prefix);
221   MutableSpace::print_short_on(st);
222   st->print_cr(" [" PTR_FORMAT "," PTR_FORMAT "," PTR_FORMAT ")",
223                  p2i(bottom()), p2i(top()), p2i(end()));
224 }
< prev index next >