RFR: 8263427: Shenandoah: Trigger weak-LRB even when heap is stable [v2]

Roman Kennke rkennke at openjdk.java.net
Thu Mar 11 20:17:28 UTC 2021


> We currently guard all LRBs, including weak-LRB, by a test for heap-stable and only enter the LRB when heap is unstable (e.g. evacuation or update-refs in progress). However, the weak LRB must also be entered when heap is stable and concurrent refs is in progress, otherwise we may accidentally resurrect otherwise unreachable weak referents. This can happen when we take the shortcut cycle and skip evac&update-refs.
> 
> I believe this might be the root cause for JDK-8262852. 
> 
> The way out of it is change conc-weakroots-in-progress flag to a bit in gc-state, and test for this in weak-LRB gc-state-check, and enter weak-LRB even when heap is stable, but conc-weakroots-in-progress.
> 
> There's one gotcha here: we used to change gc-state only at safepoints so that the flag can safely be propagated to all Java threads. But conc-weakroots-in-progress is turned-off concurrently. I deal with this by propagating the flag change to Java threads via the rendevouz (that we do anyway), and change the global flag only once all threads got the thread-local flag change.
> 
> This stuff makes the verifier unhappy, because it doesn't know about the new bit. And it'd be difficult to properly verify it, because sometimes it is set (conc-cycle) and sometimes it is not (degen-cycle), so instead of additing extra verification, I figured we could keep ignoring the flag (for now?)
> 
> Testing:
>  - [x] New testcase failed without change, passes now
>  - [x] hotspot_gc_shenandoah
>  - [ ] tier1 (+Shenandoah)

Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:

  Ensure test does a complete GC cycle before verification

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2945/files
  - new: https://git.openjdk.java.net/jdk/pull/2945/files/eec5e186..94575b41

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2945&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2945&range=00-01

  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2945.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2945/head:pull/2945

PR: https://git.openjdk.java.net/jdk/pull/2945


More information about the shenandoah-dev mailing list