< prev index next > src/hotspot/share/gc/shared/space.inline.hpp
Print this page
}
}
};
- template <class SpaceType>
+ template <bool ALT_FWD, class SpaceType>
inline void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp) {
// Compute the new addresses for the live objects and store it in the mark
// Used by universe::mark_sweep_phase2()
// We're sure to be here before any objects are compacted into this
while (cur_obj < scan_limit) {
if (space->scanned_block_is_obj(cur_obj) && cast_to_oop(cur_obj)->is_gc_marked()) {
// prefetch beyond cur_obj
Prefetch::write(cur_obj, interval);
size_t size = space->scanned_block_size(cur_obj);
- compact_top = cp->space->forward(cast_to_oop(cur_obj), size, cp, compact_top);
+ compact_top = cp->space->forward<ALT_FWD>(cast_to_oop(cur_obj), size, cp, compact_top);
cur_obj += size;
end_of_live = cur_obj;
} else {
// run over all the contiguous dead objects
HeapWord* end = cur_obj;
// see if we might want to pretend this object is alive so that
// we don't have to compact quite as often.
if (cur_obj == compact_top && dead_spacer.insert_deadspace(cur_obj, end)) {
oop obj = cast_to_oop(cur_obj);
- compact_top = cp->space->forward(obj, obj->size(), cp, compact_top);
+ compact_top = cp->space->forward<ALT_FWD>(obj, obj->size(), cp, compact_top);
end_of_live = end;
} else {
// otherwise, it really is a free region.
// cur_obj is a pointer to a dead object. Use this dead memory to store a pointer to the next live object.
// save the compaction_top of the compaction space.
cp->space->set_compaction_top(compact_top);
}
- template <class SpaceType>
+ template <bool ALT_FWD, class SpaceType>
inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) {
// adjust all the interior pointers to point at the new locations of objects
// Used by MarkSweep::mark_sweep_phase3()
HeapWord* cur_obj = space->bottom();
while (cur_obj < end_of_live) {
Prefetch::write(cur_obj, interval);
if (cur_obj < first_dead || cast_to_oop(cur_obj)->is_gc_marked()) {
// cur_obj is alive
// point all the oops to the new location
- size_t size = MarkSweep::adjust_pointers(cast_to_oop(cur_obj));
+ size_t size = MarkSweep::adjust_pointers<ALT_FWD>(cast_to_oop(cur_obj));
size = space->adjust_obj_size(size);
debug_only(prev_obj = cur_obj);
cur_obj += size;
} else {
debug_only(prev_obj = cur_obj);
} else {
if (ZapUnusedHeapArea) space->mangle_unused_area();
}
}
- template <class SpaceType>
+ template <bool ALT_FWD, class SpaceType>
inline void CompactibleSpace::scan_and_compact(SpaceType* space) {
// Copy all live objects to their new location
// Used by MarkSweep::mark_sweep_phase4()
verify_up_to_first_dead(space);
// prefetch beyond q
Prefetch::read(cur_obj, scan_interval);
// size and destination
size_t size = space->obj_size(cur_obj);
- HeapWord* compaction_top = cast_from_oop<HeapWord*>(cast_to_oop(cur_obj)->forwardee());
+ HeapWord* compaction_top = cast_from_oop<HeapWord*>(SlidingForwarding::forwardee<ALT_FWD>(cast_to_oop(cur_obj)));
// prefetch beyond compaction_top
Prefetch::write(compaction_top, copy_interval);
// copy object and reinit its mark
< prev index next >