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 @@ -364,11 +364,13 @@ class ShenandoahPrepareForCompactionObjectClosure : public ObjectClosure {
364
364
_compact_point = _to_region->bottom ();
365
365
}
366
366
367
- // Object fits into current region, record new location:
367
+ // Object fits into current region, record new location, if object does not move :
368
368
assert (_compact_point + obj_size <= _to_region->end (), " must fit" );
369
369
shenandoah_assert_not_forwarded (nullptr , p);
370
- _preserved_marks->push_if_necessary (p, p->mark ());
371
- p->forward_to (cast_to_oop (_compact_point));
370
+ if (_compact_point != cast_from_oop<HeapWord*>(p)) {
371
+ _preserved_marks->push_if_necessary (p, p->mark ());
372
+ p->forward_to (cast_to_oop (_compact_point));
373
+ }
372
374
_compact_point += obj_size;
373
375
}
374
376
};
@@ -864,6 +866,7 @@ class ShenandoahCompactObjectsClosure : public ObjectClosure {
864
866
if (p->is_forwarded ()) {
865
867
HeapWord* compact_from = cast_from_oop<HeapWord*>(p);
866
868
HeapWord* compact_to = cast_from_oop<HeapWord*>(p->forwardee ());
869
+ assert (compact_from != compact_to, " Forwarded object should move" );
867
870
Copy::aligned_conjoint_words (compact_from, compact_to, size);
868
871
oop new_obj = cast_to_oop (compact_to);
869
872
You can’t perform that action at this time.
0 commit comments