RFR: 8344665: Refactor PartialArrayState allocation for reuse

Kim Barrett kbarrett at openjdk.org
Wed Nov 20 23:45:28 UTC 2024


This change splits the existing PartialArrayStateAllocator class into an
allocator class and a manager class.  The allocator class is per worker
thread.  The manager class provides the memory management context for a
group of allocators.

This change is in preparation for some other refactorings around partial array
state handling.  That work is intended to make it easier for various
collections to adopt the use of that mechanism for chunking the processing of
large objArrays.

The new implementation for the memory management context is based on the
existing one, with an Arena per worker, now controlled by the manager object.
Potential improvements to that can be explored in the future.  Some ideas
include improvements to the Arena API or a single thread-safe Arena variant
(trading slower arena allocation (which is the slow path) for less memory
usage).

G1 has a single manager, reused by each young/mixed GC. Associated state
allocators are nested in the per-worker structures, so deleted at the end of
the collection. The manager is reset at the end of the collection to allow the
memory to be recycled. It is planned that the STW full collector will also use
this manager when converted to use PartialArrayState. So it will be reused by
all STW collections.

ParallelGC has a single manager, reused by each young collection. Because the
per-worker promotion managers are never destroyed, their nested state
allocators are never destroyed. So the manager is not reset, instead leaving
previously allocated states in the allocator free lists for use by the next
collection. This means the full collector won't be able to use the same
manager object as the young collectors.

Testing: mach5 tier1-5

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

Commit messages:
 - parallel youngen uses new PAS
 - g1 uses refactored PAS
 - refactor PAS allocation

Changes: https://git.openjdk.org/jdk/pull/22287/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22287&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8344665
  Stats: 310 lines in 14 files changed: 178 ins; 52 del; 80 mod
  Patch: https://git.openjdk.org/jdk/pull/22287.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22287/head:pull/22287

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


More information about the hotspot-dev mailing list