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 {
359
359
_compact_point = _to_region->bottom ();
360
360
}
361
361
362
- // Object fits into current region, record new location:
362
+ // Object fits into current region, record new location, if object does not move :
363
363
assert (_compact_point + obj_size <= _to_region->end (), " must fit" );
364
364
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
+ }
367
369
_compact_point += obj_size;
368
370
}
369
371
};
@@ -845,6 +847,7 @@ class ShenandoahCompactObjectsClosure : public ObjectClosure {
845
847
if (p->is_forwarded ()) {
846
848
HeapWord* compact_from = cast_from_oop<HeapWord*>(p);
847
849
HeapWord* compact_to = cast_from_oop<HeapWord*>(p->forwardee ());
850
+ assert (compact_from != compact_to, " Forwarded object should move" );
848
851
Copy::aligned_conjoint_words (compact_from, compact_to, size);
849
852
oop new_obj = cast_to_oop (compact_to);
850
853
You can’t perform that action at this time.
0 commit comments