Skip to content

Commit

Permalink
8328075: Shenandoah: Avoid forwarding when objects don't move in full-GC
Browse files Browse the repository at this point in the history
Reviewed-by: wkemper, shade, kdnilsen, ysr
  • Loading branch information
rkennke committed Mar 15, 2024
1 parent 5249cc0 commit 80ccc98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/hotspot/share/gc/shenandoah/shenandoahFullGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,13 @@ class ShenandoahPrepareForCompactionObjectClosure : public ObjectClosure {
_compact_point = _to_region->bottom();
}

// Object fits into current region, record new location:
// Object fits into current region, record new location, if object does not move:
assert(_compact_point + obj_size <= _to_region->end(), "must fit");
shenandoah_assert_not_forwarded(nullptr, p);
_preserved_marks->push_if_necessary(p, p->mark());
p->forward_to(cast_to_oop(_compact_point));
if (_compact_point != cast_from_oop<HeapWord*>(p)) {
_preserved_marks->push_if_necessary(p, p->mark());
p->forward_to(cast_to_oop(_compact_point));
}
_compact_point += obj_size;
}
};
Expand Down Expand Up @@ -864,6 +866,7 @@ class ShenandoahCompactObjectsClosure : public ObjectClosure {
if (p->is_forwarded()) {
HeapWord* compact_from = cast_from_oop<HeapWord*>(p);
HeapWord* compact_to = cast_from_oop<HeapWord*>(p->forwardee());
assert(compact_from != compact_to, "Forwarded object should move");
Copy::aligned_conjoint_words(compact_from, compact_to, size);
oop new_obj = cast_to_oop(compact_to);

Expand Down

5 comments on commit 80ccc98

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pengxiaolong
Copy link

@pengxiaolong pengxiaolong commented on 80ccc98 May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk22u

@pengxiaolong
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 80ccc98 May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pengxiaolong To use the /backport command, you need to be in the OpenJDK census and your GitHub account needs to be linked with your OpenJDK username (how to associate your GitHub account with your OpenJDK username).

@pengxiaolong
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll backport the fix to jdk22, jdk 21 and jdk17.

Please sign in to comment.