< prev index next > src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp
Print this page
{
// The rest of code performs region moves, where region status is undefined
// until all phases run together.
ShenandoahHeapLocker lock(heap->lock());
+ FullGCForwarding::begin();
+
phase2_calculate_target_addresses(worker_slices);
OrderAccess::fence();
phase3_update_references();
phase4_compact_objects(worker_slices);
phase5_epilog();
+
+ FullGCForwarding::end();
}
// Resize metaspace
MetaspaceGC::compute_new_size();
void do_object(oop p) {
assert(_from_region != nullptr, "must set before work");
assert(_heap->complete_marking_context()->is_marked(p), "must be marked");
assert(!_heap->complete_marking_context()->allocated_after_mark_start(p), "must be truly marked");
- size_t obj_size = p->size();
+ size_t old_size = p->size();
+ size_t new_size = p->copy_size(old_size, p->mark());
+ size_t obj_size = _compact_point == cast_from_oop<HeapWord*>(p) ? old_size : new_size;
if (_compact_point + obj_size > _to_region->end()) {
finish();
// Object doesn't fit. Pick next empty region and start compacting there.
ShenandoahHeapRegion* new_to_region;
assert(new_to_region != _to_region, "must not reuse same to-region");
assert(new_to_region != nullptr, "must not be null");
_to_region = new_to_region;
_compact_point = _to_region->bottom();
+ obj_size = _compact_point == cast_from_oop<HeapWord*>(p) ? old_size : new_size;
}
// Object fits into current region, record new location, if object does not move:
assert(_compact_point + obj_size <= _to_region->end(), "must fit");
shenandoah_assert_not_forwarded(nullptr, p);
Copy::aligned_conjoint_words(compact_from, compact_to, size);
oop new_obj = cast_to_oop(compact_to);
ContinuationGCSupport::relativize_stack_chunk(new_obj);
new_obj->init_mark();
+ new_obj->initialize_hash_if_necessary(p);
}
}
};
class ShenandoahCompactObjectsTask : public WorkerTask {
< prev index next >