RFR: 8332455: Improve G1/ParallelGC tasks to not override array lengths

Roman Kennke rkennke at openjdk.org
Thu Jul 4 09:31:45 UTC 2024


In order to not cause excessive traffic on task queues when scanning large object arrays, G1 and ParallelGC use a way of slicing those arrays into smaller pieces. It overrides the from-space array's length field to track the array slices.

I think it would be cleaner if we improve the tasks such that array slices can be fully encoded in the task and does not require overriding the array length.

This PR borrows the principal encoding and slicing algorithm from Shenandoah (originally written by @shipilev). It also unifies the slicing implementations of the young GC and concurrent marking GC and ParallelGC.

For a description of the encoding and slicing algorithm, see top of arraySlicer.hpp.

On x86 (32-bit) we don't have enough bits in the single-word task to encode the slicing, so I'm extending the task to 64 bits (pointer and two int32 fields).

I put in some efforts to make sure the shared array slicing uses the user-configurable flags ParGCArrayScanChunk and ObjArrayMarkingStride just as before, but TBH, I don't see the point of having those flags as product flags to begin with. I would probably deprecate and remove ParGCArrayScanChunk, and use the develop flag ObjArrayMarkingStride everywhere. YMMV.

Testing:
 - [x] hotspot_gc
 - [x] tier1
 - [x] tier2

-------------

Commit messages:
 - Cleanups
 - Merge remote-tracking branch 'rkennke/JDK-8332455' into JDK-8332455
 - Move around code so that linker can find it
 - Use previous user-configurable slice sizes
 - Move ParallelGCArraySlicer into .inline.hpp file
 - Fix signature of PSPromotionManager::process_array_chunk_work()
 - Fix range
 - Merge remote-tracking branch 'rkennke/JDK-8332456' into JDK-8332455
 - Fix scan range, yet again
 - Share ArraySlicer code between G1 and ParallelGC
 - ... and 15 more: https://git.openjdk.org/jdk/compare/baafa662...f7febf94

Changes: https://git.openjdk.org/jdk/pull/19282/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19282&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8332455
  Stats: 1224 lines in 23 files changed: 460 ins; 627 del; 137 mod
  Patch: https://git.openjdk.org/jdk/pull/19282.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19282/head:pull/19282

PR: https://git.openjdk.org/jdk/pull/19282


More information about the hotspot-gc-dev mailing list