src/share/vm/memory/space.cpp
Print this page
rev 6796 : [mq]: templateOopIterate
*** 94,104 ****
// we'd need an interface change (it seems) to have the space
// "adjust the object size" (for instance pad it up to its
// block alignment or minimum block size restrictions. XXX
if (_sp->block_is_obj(bottom) &&
!_sp->obj_allocated_since_save_marks(oop(bottom))) {
! oop(bottom)->oop_iterate(_cl, mr);
}
}
}
// We get called with "mr" representing the dirty region
--- 94,104 ----
// we'd need an interface change (it seems) to have the space
// "adjust the object size" (for instance pad it up to its
// block alignment or minimum block size restrictions. XXX
if (_sp->block_is_obj(bottom) &&
!_sp->obj_allocated_since_save_marks(oop(bottom))) {
! oop(bottom)->oop_iterate<false>(_cl, mr);
}
}
}
// We get called with "mr" representing the dirty region
*** 232,266 ****
}
// We must replicate this so that the static type of "FilteringClosure"
// (see above) is apparent at the oop_iterate calls.
! #define ContiguousSpaceDCTOC__walk_mem_region_with_cl_DEFN(ClosureType) \
void ContiguousSpaceDCTOC::walk_mem_region_with_cl(MemRegion mr, \
HeapWord* bottom, \
HeapWord* top, \
ClosureType* cl) { \
! bottom += oop(bottom)->oop_iterate(cl, mr); \
if (bottom < top) { \
HeapWord* next_obj = bottom + oop(bottom)->size(); \
while (next_obj < top) { \
/* Bottom lies entirely below top, so we can call the */ \
/* non-memRegion version of oop_iterate below. */ \
! oop(bottom)->oop_iterate(cl); \
bottom = next_obj; \
next_obj = bottom + oop(bottom)->size(); \
} \
/* Last object. */ \
! oop(bottom)->oop_iterate(cl, mr); \
} \
}
// (There are only two of these, rather than N, because the split is due
// only to the introduction of the FilteringClosure, a local part of the
// impl of this abstraction.)
! ContiguousSpaceDCTOC__walk_mem_region_with_cl_DEFN(ExtendedOopClosure)
! ContiguousSpaceDCTOC__walk_mem_region_with_cl_DEFN(FilteringClosure)
DirtyCardToOopClosure*
ContiguousSpace::new_dcto_cl(ExtendedOopClosure* cl,
CardTableModRefBS::PrecisionStyle precision,
HeapWord* boundary) {
--- 232,266 ----
}
// We must replicate this so that the static type of "FilteringClosure"
// (see above) is apparent at the oop_iterate calls.
! #define ContiguousSpaceDCTOC__walk_mem_region_with_cl_DEFN(ClosureType, nv) \
void ContiguousSpaceDCTOC::walk_mem_region_with_cl(MemRegion mr, \
HeapWord* bottom, \
HeapWord* top, \
ClosureType* cl) { \
! bottom += oop(bottom)->oop_iterate<nv>(cl, mr); \
if (bottom < top) { \
HeapWord* next_obj = bottom + oop(bottom)->size(); \
while (next_obj < top) { \
/* Bottom lies entirely below top, so we can call the */ \
/* non-memRegion version of oop_iterate below. */ \
! oop(bottom)->oop_iterate<nv>(cl); \
bottom = next_obj; \
next_obj = bottom + oop(bottom)->size(); \
} \
/* Last object. */ \
! oop(bottom)->oop_iterate<nv>(cl, mr); \
} \
}
// (There are only two of these, rather than N, because the split is due
// only to the introduction of the FilteringClosure, a local part of the
// impl of this abstraction.)
! ContiguousSpaceDCTOC__walk_mem_region_with_cl_DEFN(ExtendedOopClosure, false)
! ContiguousSpaceDCTOC__walk_mem_region_with_cl_DEFN(FilteringClosure, true)
DirtyCardToOopClosure*
ContiguousSpace::new_dcto_cl(ExtendedOopClosure* cl,
CardTableModRefBS::PrecisionStyle precision,
HeapWord* boundary) {
*** 552,585 ****
bool Space::obj_is_alive(const HeapWord* p) const {
assert (block_is_obj(p), "The address should point to an object");
return true;
}
- #if INCLUDE_ALL_GCS
- #define ContigSpace_PAR_OOP_ITERATE_DEFN(OopClosureType, nv_suffix) \
- \
- void ContiguousSpace::par_oop_iterate(MemRegion mr, OopClosureType* blk) {\
- HeapWord* obj_addr = mr.start(); \
- HeapWord* t = mr.end(); \
- while (obj_addr < t) { \
- assert(oop(obj_addr)->is_oop(), "Should be an oop"); \
- obj_addr += oop(obj_addr)->oop_iterate(blk); \
- } \
- }
-
- ALL_PAR_OOP_ITERATE_CLOSURES(ContigSpace_PAR_OOP_ITERATE_DEFN)
-
- #undef ContigSpace_PAR_OOP_ITERATE_DEFN
- #endif // INCLUDE_ALL_GCS
-
void ContiguousSpace::oop_iterate(ExtendedOopClosure* blk) {
if (is_empty()) return;
HeapWord* obj_addr = bottom();
HeapWord* t = top();
// Could call objects iterate, but this is easier.
while (obj_addr < t) {
! obj_addr += oop(obj_addr)->oop_iterate(blk);
}
}
void ContiguousSpace::object_iterate(ObjectClosure* blk) {
if (is_empty()) return;
--- 552,568 ----
bool Space::obj_is_alive(const HeapWord* p) const {
assert (block_is_obj(p), "The address should point to an object");
return true;
}
void ContiguousSpace::oop_iterate(ExtendedOopClosure* blk) {
if (is_empty()) return;
HeapWord* obj_addr = bottom();
HeapWord* t = top();
// Could call objects iterate, but this is easier.
while (obj_addr < t) {
! obj_addr += oop(obj_addr)->oop_iterate<false>(blk);
}
}
void ContiguousSpace::object_iterate(ObjectClosure* blk) {
if (is_empty()) return;
*** 615,649 ****
}
}
return NULL; // all done
}
! #define ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN(OopClosureType, nv_suffix) \
! \
! void ContiguousSpace:: \
! oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) { \
! HeapWord* t; \
! HeapWord* p = saved_mark_word(); \
! assert(p != NULL, "expected saved mark"); \
! \
! const intx interval = PrefetchScanIntervalInBytes; \
! do { \
! t = top(); \
! while (p < t) { \
! Prefetch::write(p, interval); \
! debug_only(HeapWord* prev = p); \
! oop m = oop(p); \
! p += m->oop_iterate(blk); \
! } \
! } while (t < top()); \
! \
! set_saved_mark_word(p); \
! }
!
! ALL_SINCE_SAVE_MARKS_CLOSURES(ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN)
! #undef ContigSpace_OOP_SINCE_SAVE_MARKS_DEFN
// Very general, slow implementation.
HeapWord* ContiguousSpace::block_start_const(const void* p) const {
assert(MemRegion(bottom(), end()).contains(p),
err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
--- 598,627 ----
}
}
return NULL; // all done
}
! template <bool nv, typename OopClosureType>
! void ContiguousSpace::
! cspace_oop_since_save_marks_iterate(OopClosureType* blk) {
! HeapWord* t;
! HeapWord* p = saved_mark_word();
! assert(p != NULL, "expected saved mark");
!
! const intx interval = PrefetchScanIntervalInBytes;
! do {
! t = top();
! while (p < t) {
! Prefetch::write(p, interval);
! debug_only(HeapWord* prev = p);
! oop m = oop(p);
! p += m->oop_iterate<nv>(blk);
! }
! } while (t < top());
! set_saved_mark_word(p);
! }
// Very general, slow implementation.
HeapWord* ContiguousSpace::block_start_const(const void* p) const {
assert(MemRegion(bottom(), end()).contains(p),
err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",