< prev index next > src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Print this page
ShenandoahAffiliation target_gen) {
assert(target_gen == YOUNG_GENERATION, "Only expect evacuations to young in this mode");
assert(from_region->is_young(), "Only expect evacuations from young in this mode");
bool alloc_from_lab = true;
HeapWord* copy = nullptr;
- size_t size = ShenandoahForwarding::size(p);
+
+ markWord mark = p->mark();
+ if (ShenandoahForwarding::is_forwarded(mark)) {
+ return ShenandoahForwarding::get_forwardee(p);
+ }
+ size_t old_size = ShenandoahForwarding::size(p);
+ size_t size = p->copy_size(old_size, mark);
#ifdef ASSERT
if (ShenandoahOOMDuringEvacALot &&
(os::random() & 1) == 0) { // Simulate OOM every ~2nd slow-path call
copy = nullptr;
return ShenandoahBarrierSet::resolve_forwarded(p);
}
// Copy the object:
- Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(p), copy, size);
+ Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(p), copy, old_size);
// Try to install the new forwarding pointer.
oop copy_val = cast_to_oop(copy);
oop result = ShenandoahForwarding::try_update_forwardee(p, copy_val);
if (result == copy_val) {
// Successfully evacuated. Our copy is now the public one!
+ copy_val->initialize_hash_if_necessary(p);
ContinuationGCSupport::relativize_stack_chunk(copy_val);
shenandoah_assert_correct(nullptr, copy_val);
return copy_val;
} else {
// Failed to evacuate. We need to deal with the object that is left behind. Since this
< prev index next >