RFR: 8373266: Strengthen constant CardTable base accesses [v4]
Aleksey Shipilev
shade at openjdk.org
Wed Jan 21 16:44:36 UTC 2026
> 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, `all` with Serial, Parallel, G1, Shenandoah, Z
> - [x] Linux AArch64 server fastdebug, `all` with Serial, Parallel, G1, Shenandoah, Z
> - [x] GHA, cross-compilation only
Aleksey Shipilev has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains 11 new commits since the last revision:
- Some polishing
- 8341496: Improve JMX connections
Co-authored-by: Daniel Fuchs <dfuchs at openjdk.org>
Reviewed-by: skoivu, rhalade, coffeys, dfuchs, kevinw, jnimeh
- 8375342: jdk/javadoc/doccheck/checks/jdkCheckHtml.java failed with duplicate anchors
Reviewed-by: alanb, iris
- 8373836: add anchors to the java options in the java man page
Reviewed-by: jwilhelm, iris
- Another build fix
- Fix Minimal builds
- Shenandoah non-generational can have nullptr card table
- Also simplify CTBS builder
- CI should also mention "const"
- Fix JVMCI by answering proper things
- ... and 1 more: https://git.openjdk.org/jdk/compare/79dca36a...5c2206b9
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/28703/files
- new: https://git.openjdk.org/jdk/pull/28703/files/79dca36a..5c2206b9
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=28703&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=28703&range=02-03
Stats: 23 lines in 1 file changed: 23 ins; 0 del; 0 mod
Patch: https://git.openjdk.org/jdk/pull/28703.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28703/head:pull/28703
PR: https://git.openjdk.org/jdk/pull/28703
More information about the hotspot-dev
mailing list