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 @@ -361,11 +361,13 @@ class ShenandoahPrepareForCompactionObjectClosure : public ObjectClosure {
361
361
_compact_point = _to_region->bottom ();
362
362
}
363
363
364
- // Object fits into current region, record new location:
364
+ // Object fits into current region, record new location, if object does not move :
365
365
assert (_compact_point + obj_size <= _to_region->end (), " must fit" );
366
366
shenandoah_assert_not_forwarded (NULL , p);
367
- _preserved_marks->push_if_necessary (p, p->mark ());
368
- p->forward_to (cast_to_oop (_compact_point));
367
+ if (_compact_point != cast_from_oop<HeapWord*>(p)) {
368
+ _preserved_marks->push_if_necessary (p, p->mark ());
369
+ p->forward_to (cast_to_oop (_compact_point));
370
+ }
369
371
_compact_point += obj_size;
370
372
}
371
373
};
@@ -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
new_obj->init_mark ();
You can’t perform that action at this time.
0 commit comments