473 p += oop(p)->size(); 474 } 475 guarantee(p == top(), "end of last object must match end of space"); 476 if (top() != end()) { 477 guarantee(top() == block_start_const(end()-1) && 478 top() == block_start_const(top()), 479 "top should be start of unallocated block, if it exists"); 480 } 481 } 482 483 void Space::oop_iterate(ExtendedOopClosure* blk) { 484 ObjectToOopClosure blk2(blk); 485 object_iterate(&blk2); 486 } 487 488 bool Space::obj_is_alive(const HeapWord* p) const { 489 assert (block_is_obj(p), "The address should point to an object"); 490 return true; 491 } 492 493 #if INCLUDE_CMSGC 494 #define ContigSpace_PAR_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \ 495 \ 496 void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {\ 497 HeapWord* obj_addr = mr.start(); \ 498 HeapWord* t = mr.end(); \ 499 while (obj_addr < t) { \ 500 assert(oopDesc::is_oop(oop(obj_addr)), "Should be an oop"); \ 501 obj_addr += oop(obj_addr)->oop_iterate_size(blk); \ 502 } \ 503 } 504 505 ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DEFN) 506 507 #undef ContigSpace_PAR_OOP_ITERATE_DEFN 508 #endif // INCLUDE_CMSGC 509 510 void ContiguousSpace::oop_iterate(ExtendedOopClosure* blk) { 511 if (is_empty()) return; 512 HeapWord* obj_addr = bottom(); 513 HeapWord* t = top(); 514 // Could call objects iterate, but this is easier. 515 while (obj_addr < t) { 516 obj_addr += oop(obj_addr)->oop_iterate_size(blk); 517 } 518 } 519 520 void ContiguousSpace::object_iterate(ObjectClosure* blk) { 521 if (is_empty()) return; 522 object_iterate_from(bottom(), blk); 523 } 524 525 // For a ContiguousSpace object_iterate() and safe_object_iterate() 526 // are the same. 527 void ContiguousSpace::safe_object_iterate(ObjectClosure* blk) { 528 object_iterate(blk); 529 } | 473 p += oop(p)->size(); 474 } 475 guarantee(p == top(), "end of last object must match end of space"); 476 if (top() != end()) { 477 guarantee(top() == block_start_const(end()-1) && 478 top() == block_start_const(top()), 479 "top should be start of unallocated block, if it exists"); 480 } 481 } 482 483 void Space::oop_iterate(ExtendedOopClosure* blk) { 484 ObjectToOopClosure blk2(blk); 485 object_iterate(&blk2); 486 } 487 488 bool Space::obj_is_alive(const HeapWord* p) const { 489 assert (block_is_obj(p), "The address should point to an object"); 490 return true; 491 } 492 493 void ContiguousSpace::oop_iterate(ExtendedOopClosure* blk) { 494 if (is_empty()) return; 495 HeapWord* obj_addr = bottom(); 496 HeapWord* t = top(); 497 // Could call objects iterate, but this is easier. 498 while (obj_addr < t) { 499 obj_addr += oop(obj_addr)->oop_iterate_size(blk); 500 } 501 } 502 503 void ContiguousSpace::object_iterate(ObjectClosure* blk) { 504 if (is_empty()) return; 505 object_iterate_from(bottom(), blk); 506 } 507 508 // For a ContiguousSpace object_iterate() and safe_object_iterate() 509 // are the same. 510 void ContiguousSpace::safe_object_iterate(ObjectClosure* blk) { 511 object_iterate(blk); 512 } |