< prev index next >

src/hotspot/share/gc/shared/space.cpp

Print this page




 481 bool Space::obj_is_alive(const HeapWord* p) const {
 482   assert (block_is_obj(p), "The address should point to an object");
 483   return true;
 484 }
 485 
 486 void ContiguousSpace::oop_iterate(OopIterateClosure* blk) {
 487   if (is_empty()) return;
 488   HeapWord* obj_addr = bottom();
 489   HeapWord* t = top();
 490   // Could call objects iterate, but this is easier.
 491   while (obj_addr < t) {
 492     obj_addr += oop(obj_addr)->oop_iterate_size(blk);
 493   }
 494 }
 495 
 496 void ContiguousSpace::object_iterate(ObjectClosure* blk) {
 497   if (is_empty()) return;
 498   object_iterate_from(bottom(), blk);
 499 }
 500 
 501 // For a ContiguousSpace object_iterate() and safe_object_iterate()
 502 // are the same.
 503 void ContiguousSpace::safe_object_iterate(ObjectClosure* blk) {
 504   object_iterate(blk);
 505 }
 506 
 507 void ContiguousSpace::object_iterate_from(HeapWord* mark, ObjectClosure* blk) {
 508   while (mark < top()) {
 509     blk->do_object(oop(mark));
 510     mark += oop(mark)->size();
 511   }
 512 }
 513 
 514 HeapWord*
 515 ContiguousSpace::object_iterate_careful(ObjectClosureCareful* blk) {
 516   HeapWord * limit = concurrent_iteration_safe_limit();
 517   assert(limit <= top(), "sanity check");
 518   for (HeapWord* p = bottom(); p < limit;) {
 519     size_t size = blk->do_object_careful(oop(p));
 520     if (size == 0) {
 521       return p;  // failed at p
 522     } else {
 523       p += size;
 524     }
 525   }
 526   return NULL; // all done




 481 bool Space::obj_is_alive(const HeapWord* p) const {
 482   assert (block_is_obj(p), "The address should point to an object");
 483   return true;
 484 }
 485 
 486 void ContiguousSpace::oop_iterate(OopIterateClosure* blk) {
 487   if (is_empty()) return;
 488   HeapWord* obj_addr = bottom();
 489   HeapWord* t = top();
 490   // Could call objects iterate, but this is easier.
 491   while (obj_addr < t) {
 492     obj_addr += oop(obj_addr)->oop_iterate_size(blk);
 493   }
 494 }
 495 
 496 void ContiguousSpace::object_iterate(ObjectClosure* blk) {
 497   if (is_empty()) return;
 498   object_iterate_from(bottom(), blk);
 499 }
 500 






 501 void ContiguousSpace::object_iterate_from(HeapWord* mark, ObjectClosure* blk) {
 502   while (mark < top()) {
 503     blk->do_object(oop(mark));
 504     mark += oop(mark)->size();
 505   }
 506 }
 507 
 508 HeapWord*
 509 ContiguousSpace::object_iterate_careful(ObjectClosureCareful* blk) {
 510   HeapWord * limit = concurrent_iteration_safe_limit();
 511   assert(limit <= top(), "sanity check");
 512   for (HeapWord* p = bottom(); p < limit;) {
 513     size_t size = blk->do_object_careful(oop(p));
 514     if (size == 0) {
 515       return p;  // failed at p
 516     } else {
 517       p += size;
 518     }
 519   }
 520   return NULL; // all done


< prev index next >