< prev index next >

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

Print this page

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

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