586 }
587
588 ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN)
589
590 #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN
591
592 // Very general, slow implementation.
593 HeapWord* ContiguousSpace::block_start_const(const void* p) const {
594 assert(MemRegion(bottom(), end()).contains(p),
595 "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
596 p2i(p), p2i(bottom()), p2i(end()));
597 if (p >= top()) {
598 return top();
599 } else {
600 HeapWord* last = bottom();
601 HeapWord* cur = last;
602 while (cur <= p) {
603 last = cur;
604 cur += oop(cur)->size();
605 }
606 assert(oop(last)->is_oop(),PTR_FORMAT " should be an object start", p2i(last));
607 return last;
608 }
609 }
610
611 size_t ContiguousSpace::block_size(const HeapWord* p) const {
612 assert(MemRegion(bottom(), end()).contains(p),
613 "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
614 p2i(p), p2i(bottom()), p2i(end()));
615 HeapWord* current_top = top();
616 assert(p <= current_top,
617 "p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
618 p2i(p), p2i(current_top));
619 assert(p == current_top || oop(p)->is_oop(),
620 "p (" PTR_FORMAT ") is not a block start - "
621 "current_top: " PTR_FORMAT ", is_oop: %s",
622 p2i(p), p2i(current_top), BOOL_TO_STR(oop(p)->is_oop()));
623 if (p < current_top) {
624 return oop(p)->size();
625 } else {
626 assert(p == current_top, "just checking");
|
586 }
587
588 ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN)
589
590 #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN
591
592 // Very general, slow implementation.
593 HeapWord* ContiguousSpace::block_start_const(const void* p) const {
594 assert(MemRegion(bottom(), end()).contains(p),
595 "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
596 p2i(p), p2i(bottom()), p2i(end()));
597 if (p >= top()) {
598 return top();
599 } else {
600 HeapWord* last = bottom();
601 HeapWord* cur = last;
602 while (cur <= p) {
603 last = cur;
604 cur += oop(cur)->size();
605 }
606 assert(oop(last)->is_oop(), PTR_FORMAT " should be an object start", p2i(last));
607 return last;
608 }
609 }
610
611 size_t ContiguousSpace::block_size(const HeapWord* p) const {
612 assert(MemRegion(bottom(), end()).contains(p),
613 "p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
614 p2i(p), p2i(bottom()), p2i(end()));
615 HeapWord* current_top = top();
616 assert(p <= current_top,
617 "p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
618 p2i(p), p2i(current_top));
619 assert(p == current_top || oop(p)->is_oop(),
620 "p (" PTR_FORMAT ") is not a block start - "
621 "current_top: " PTR_FORMAT ", is_oop: %s",
622 p2i(p), p2i(current_top), BOOL_TO_STR(oop(p)->is_oop()));
623 if (p < current_top) {
624 return oop(p)->size();
625 } else {
626 assert(p == current_top, "just checking");
|