RFR: 8261492: Shenandoah: reconsider forwardee accesses memory ordering [v3]
Aleksey Shipilev
shade at openjdk.java.net
Tue Feb 16 10:26:06 UTC 2021
> Shenandoah carries forwardee information in object's mark word. Installing the new mark word is effectively "releasing" the object copy, and reading from the new mark word is "acquiring" that object copy.
>
> For the forwardee update side, Hotspot's default for atomic operations is memory_order_conservative, which emits two-way memory fences around the CASes at least on AArch64 and PPC64. This seems to be excessive for Shenandoah forwardee updates, and "release" is enough.
>
> For the forwardee load side, we need to guarantee "acquire". We do not do it now, reading the markword without memory semantics. It does not seem to pose a practical problem today, because GC does not access the object contents in the new copy, and mutators get this from the JRT-called stub that separates the fwdptr access and object contents access by a lot. It still should be cleaner to "acquire" the mark on load to avoid surprises.
>
> Additional testing:
> - [x] Linux x86_64 `hotspot_gc_shenandoah`
> - [x] Linux AArch64 `hotspot_gc_shenandoah`
> - [x] Linux AArch64 `tier1` with Shenandoah
Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
- A few minor touchups
- Add a blurb to x86 code as well
- Use implicit "consume" in AArch64, add more notes.
- Merge branch 'master' into JDK-8261492-shenandoah-forwardee-memord
- Make sure to access fwdptr with acquire semantics in assembler code
- 8261492: Shenandoah: reconsider forwardee accesses memory ordering
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2496/files
- new: https://git.openjdk.java.net/jdk/pull/2496/files/49626781..0c159cc3
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2496&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2496&range=01-02
Stats: 11804 lines in 386 files changed: 5929 ins; 3700 del; 2175 mod
Patch: https://git.openjdk.java.net/jdk/pull/2496.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2496/head:pull/2496
PR: https://git.openjdk.java.net/jdk/pull/2496
More information about the shenandoah-dev
mailing list