This repository was archived by the owner on Oct 9, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/hotspot/share/gc/shenandoah Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -359,11 +359,13 @@ class ShenandoahPrepareForCompactionObjectClosure : public ObjectClosure {
359359 _compact_point = _to_region->bottom ();
360360 }
361361
362- // Object fits into current region, record new location:
362+ // Object fits into current region, record new location, if object does not move :
363363 assert (_compact_point + obj_size <= _to_region->end (), " must fit" );
364364 shenandoah_assert_not_forwarded (nullptr , p);
365- _preserved_marks->push_if_necessary (p, p->mark ());
366- p->forward_to (cast_to_oop (_compact_point));
365+ if (_compact_point != cast_from_oop<HeapWord*>(p)) {
366+ _preserved_marks->push_if_necessary (p, p->mark ());
367+ p->forward_to (cast_to_oop (_compact_point));
368+ }
367369 _compact_point += obj_size;
368370 }
369371};
@@ -845,6 +847,7 @@ class ShenandoahCompactObjectsClosure : public ObjectClosure {
845847 if (p->is_forwarded ()) {
846848 HeapWord* compact_from = cast_from_oop<HeapWord*>(p);
847849 HeapWord* compact_to = cast_from_oop<HeapWord*>(p->forwardee ());
850+ assert (compact_from != compact_to, " Forwarded object should move" );
848851 Copy::aligned_conjoint_words (compact_from, compact_to, size);
849852 oop new_obj = cast_to_oop (compact_to);
850853
You can’t perform that action at this time.
0 commit comments