RFR: 8318019: GenShen: Fix assertion to allow empty evacuation cycles

Zhengyu Gu zgu at openjdk.org
Thu Oct 12 14:35:38 UTC 2023


On Wed, 11 Oct 2023 16:27:18 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

> Assertion needs to allow for gc phase EVACUATION even if no forwarding objects because we are only promoting in place.

Changes requested by zgu (Committer).

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 2428:

> 2426:   bool has_forwarded = has_forwarded_objects()? 1: 0;
> 2427:   bool updating_or_evacuating = _gc_state.is_set(UPDATEREFS | EVACUATION)? 1: 0;
> 2428:   bool evacuating = gc_state.is_set(EVACUATION)? 1: 0;

suggestion: 
`
bool evacuating = gc_state.is_set(EVACUATION);
`
pre-exist:
`bool has_forwarded = has_forwarded_objects()? 1: 0;` to `bool has_forwarded = has_forwarded_objects();`

src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 2429:

> 2427:   bool updating_or_evacuating = _gc_state.is_set(UPDATEREFS | EVACUATION);
> 2428:   bool evacuating = _gc_state.is_set(EVACUATION);
> 2429:   assert ((has_forwarded == updating_or_evacuating) || (evacuating && !has_forwarded && collection_set()->is_empty()),

Sorry, I did not realize this is generational Shenandoah. I am a bit puzzled why setting `EVACUATION` flag if collection set is empty?

-------------

PR Review: https://git.openjdk.org/shenandoah/pull/337#pullrequestreview-1672023292
PR Review Comment: https://git.openjdk.org/shenandoah/pull/337#discussion_r1355435553
PR Review Comment: https://git.openjdk.org/shenandoah/pull/337#discussion_r1355609862


More information about the shenandoah-dev mailing list