8361252: Compact Full-GC Forwarding #26133
Draft
+794
−116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'd like to propose a new Full-GC forwarding scheme for the Serial, Parallel, G1 and Shenandoah GCs.
Primarily, it solves a limitation when compact object headers are turned on: the above mentioned GCs can then not handle heaps > 8TB, and we turn off compact object headers, instead. I realize that this is most likely not an issue in practice for Serial GC (who would want this?). It may be an issue with Parallel and G1 GCs (I know some folks run with Parallel GC on large batch jobs, where latency is not a concern at all. G1 may be useful in the same situation, perhaps). It is an issue with Shenandoah GC, because large heaps is one reason why Shenandoah exists to begin with. (ZGC doesn't have this problem, because it does not have a full-GC.) Given that I think we should make compact object headers on by default in JDK 26, and obsolete the old mode in JDK 27, I think it'd be useful to have the new implementation available now.
Second, it's a first step and preparation towards 4-byte-headers, which I hope to bring into JDK 27. With 4-byte-headers, we only have 9 bits in the header for storing forwarding-pointers during full-GC, and this implementation provides that with minimal overhead.
I've proposed something similar before (see #20605), but this improved implementation is simpler, uses less memory overhead, and has basically no performance impact.
There is a large comment at the top of fullGCForwarding.hpp which explains the algorithm in detail. I am not repeating it here. I'll just state some basic properties:
In order to facilitate testing and later reduction of the implementation to fewer bits, I template-ized the forwarding table implementation on the number of bits. This allows me to write unit tests that don't take >8TB of heap and stress some of the interesting scenarios, without affecting performance in normal HotSpot product situations.
Testing:
Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26133/head:pull/26133
$ git checkout pull/26133
Update a local copy of the PR:
$ git checkout pull/26133
$ git pull https://git.openjdk.org/jdk.git pull/26133/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26133
View PR using the GUI difftool:
$ git pr show -t 26133
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26133.diff