< 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();
}
heap->start_idle_span();
// Resize metaspace
MetaspaceGC::compute_new_size();
assert(_from_region != nullptr, "must set before work");
assert(_heap->global_generation()->is_mark_complete(), "marking must be finished");
assert(_heap->marking_context()->is_marked(p), "must be marked");
assert(!_heap->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);
assert(compact_from != compact_to, "Forwarded object should move");
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->reinit_mark();
+ new_obj->initialize_hash_if_necessary(p);
}
}
};
class ShenandoahCompactObjectsTask : public WorkerTask {
log_debug(gc)("Full GC compaction moves humongous object from region %zu to region %zu", old_start, new_start);
Copy::aligned_conjoint_words(r->bottom(), heap->get_region(new_start)->bottom(), words_size);
ContinuationGCSupport::relativize_stack_chunk(cast_to_oop<HeapWord*>(r->bottom()));
oop new_obj = cast_to_oop(heap->get_region(new_start)->bottom());
- new_obj->init_mark();
+ new_obj->reinit_mark();
{
ShenandoahAffiliation original_affiliation = r->affiliation();
for (size_t c = old_start; c <= old_end; c++) {
ShenandoahHeapRegion* r = heap->get_region(c);
< prev index next >