8373266: Strengthen constant CardTable base accesses
Shenandoah and G1 are using CardTable for most of its infrastructure, but flip the card tables as they go, and maintain the actual card table reference in TLS. As such, accessing card table base from assembler and compilers runs into risk of accidentally encoding the wrong card table base in generated code.
Most of the current code avoids this trouble by carefully implementing their GC barriers to avoid touching shared parts where card table base constness is assumed. Except for JVMCI, that reads the card table base for G1 barrier set, and that is wrong. The JVMCI users would need to rectify this downstream.
Shenandoah added a few asserts to catch these errors: SHENANDOAHGC_ONLY(assert(!UseShenandoahGC, "Shenandoah byte_map_base is not constant.");)
...but G1 would also benefit from the similar safety mechanism.
This PR strengthens the code to prevent future accidents.
Additional testing:
- [x] Linux x86_64 server fastdebug,
hotspot_gc - [x] Linux x86_64 server fastdebug,
allwith Serial, Parallel, G1, Shenandoah, Z - [x] Linux AArch64 server fastdebug,
allwith Serial, Parallel, G1, Shenandoah, Z - [x] GHA, cross-compilation only
Progress
- [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
- [x] Change must not contain extraneous whitespace
- [x] Commit message must refer to an issue
Issue
- JDK-8373266: Strengthen constant CardTable base accesses (Enhancement - P4)
Reviewing
Using git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28703/head:pull/28703
$ git checkout pull/28703
Update a local copy of the PR:
$ git checkout pull/28703
$ git pull https://git.openjdk.org/jdk.git pull/28703/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28703
View PR using the GUI difftool:
$ git pr show -t 28703
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28703.diff
Using Webrev
:wave: Welcome back shade! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.
❗ This change is not yet ready to be integrated. See the Progress checklist in the description for automated requirements.
@shipilev The following labels will be automatically applied to this pull request:
-
hotspot -
shenandoah
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.
all tests are passing with various GC combinations as well. Ready for review.