< prev index next >

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

Print this page




 565                                                                           \
 566   set_saved_mark_word(p);                                                 \
 567 }
 568 
 569 ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN)
 570 
 571 #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN
 572 
 573 // Very general, slow implementation.
 574 HeapWord* ContiguousSpace::block_start_const(const void* p) const {
 575   assert(MemRegion(bottom(), end()).contains(p),
 576          "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
 577          p2i(p), p2i(bottom()), p2i(end()));
 578   if (p >= top()) {
 579     return top();
 580   } else {
 581     HeapWord* last = bottom();
 582     HeapWord* cur = last;
 583     while (cur <= p) {
 584       last = cur;



 585       cur += oop(cur)->size();
 586     }
 587     assert(oopDesc::is_oop(oop(last)), PTR_FORMAT " should be an object start", p2i(last));
 588     return last;
 589   }
 590 }
 591 
 592 size_t ContiguousSpace::block_size(const HeapWord* p) const {
 593   assert(MemRegion(bottom(), end()).contains(p),
 594          "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
 595          p2i(p), p2i(bottom()), p2i(end()));
 596   HeapWord* current_top = top();
 597   assert(p <= current_top,
 598          "p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
 599          p2i(p), p2i(current_top));
 600   assert(p == current_top || oopDesc::is_oop(oop(p)),
 601          "p (" PTR_FORMAT ") is not a block start - "
 602          "current_top: " PTR_FORMAT ", is_oop: %s",
 603          p2i(p), p2i(current_top), BOOL_TO_STR(oopDesc::is_oop(oop(p))));
 604   if (p < current_top) {




 565                                                                           \
 566   set_saved_mark_word(p);                                                 \
 567 }
 568 
 569 ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN)
 570 
 571 #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN
 572 
 573 // Very general, slow implementation.
 574 HeapWord* ContiguousSpace::block_start_const(const void* p) const {
 575   assert(MemRegion(bottom(), end()).contains(p),
 576          "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
 577          p2i(p), p2i(bottom()), p2i(end()));
 578   if (p >= top()) {
 579     return top();
 580   } else {
 581     HeapWord* last = bottom();
 582     HeapWord* cur = last;
 583     while (cur <= p) {
 584       last = cur;
 585       // if (*((juint*)cur) == badHeapWordVal || *((juint*)cur) == badMetaWordVal) { // zapped; unparseable
 586       //   return NULL;
 587       // }
 588       cur += oop(cur)->size();
 589     }
 590     assert(oopDesc::is_oop(oop(last)), PTR_FORMAT " should be an object start", p2i(last));
 591     return last;
 592   }
 593 }
 594 
 595 size_t ContiguousSpace::block_size(const HeapWord* p) const {
 596   assert(MemRegion(bottom(), end()).contains(p),
 597          "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
 598          p2i(p), p2i(bottom()), p2i(end()));
 599   HeapWord* current_top = top();
 600   assert(p <= current_top,
 601          "p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
 602          p2i(p), p2i(current_top));
 603   assert(p == current_top || oopDesc::is_oop(oop(p)),
 604          "p (" PTR_FORMAT ") is not a block start - "
 605          "current_top: " PTR_FORMAT ", is_oop: %s",
 606          p2i(p), p2i(current_top), BOOL_TO_STR(oopDesc::is_oop(oop(p))));
 607   if (p < current_top) {


< prev index next >