[master] Integrated: Implement sliding forwarding scheme that preserves upper header bits

Roman Kennke rkennke at openjdk.java.net
Fri Jul 9 11:37:27 UTC 2021

On Thu, 10 Jun 2021 13:06:18 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> The current way of storing forwarding information - by storing the forwardee address into the header - poses a problem for sliding collectors: it overrides the upper bits that keep the (compressed) Klass*. Sliding collectors have no way to recover the Klass*, and therefore need a different forwarding scheme that preserves the upper bits. I propose a scheme that compresses the forwarding pointer and by taking advantage of the fact that each region only ever forwards to at most two other regions (when dividing the heap into equal-sized logical regions), it can address all of the heap, regardless of its size. This obviouly works well with regionalized collectors, but it also works with contiguous-heap collectors like serial or parallel GC. The latter would divide the heap into logical regions sized by 4G (or single region if heap is smaller than that). Notice that evacuating and scavenging collectors don't have this problem: they can safely stomp over the from-space copy of objects, t
 he Klass* information is preserved in the to-space copy.
> G1 is special: the fallback from parallel to serial full GC means that we can have maximum of N target regions with N == ParallelGCThreads. For this reason, I use an encoding with 5 bits for target region index, that is enough to address 32 target regions from each region, assuming a maximum heap region size of 32M. In the future we will be able to steal bits from the Klass* in the upper half of the header, allowing us to address even more regions. Alternatively, we can change the full-GC fallback to re-forward all objects serially, instead of trying to re-use the already-forwarded state from the parallel full GC.
> Serial GC and Shenandoah GC use only 1 bit to address target regions, because they really can only ever have 2 target regions out of a single region.
> Testing:
> - [x] manual testing with +passive and -degen-gc
> - [x] hotspot_gc_shenandoah
> - [x] tier1
> - [x] tier2
> - [x] tier1 (x86_32)

This pull request has now been integrated.

Changeset: 5f6cb177
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.java.net/lilliput/commit/5f6cb1777d4b9cf51486ad33f8b975bf29d8d3a0
Stats:     448 lines in 31 files changed: 392 ins; 5 del; 51 mod

Implement sliding forwarding scheme that preserves upper header bits

Reviewed-by: shade


PR: https://git.openjdk.java.net/lilliput/pull/8

More information about the lilliput-dev mailing list