Integrated: 8374549: Extend MetaspaceClosure to cover non-MetaspaceObj types

Ioi Lam iklam at openjdk.org
Tue Jan 27 03:19:31 UTC 2026


On Mon, 5 Jan 2026 20:32:46 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> Previously, `MetaspaceClosure` could iterate only `MetaspaceObject`, using its four member functions:
> 
> - `is_read_only_by_default()`
> - `metaspace_pointers_do()`
> - `size()`
> - `type()`
> 
> `PackageEntry`, `ModuleEntry` and `GrowableArray` cannot be subclasses from `MetaspaceObject` due to various constraints.  As a result, they were copied with ad-hoc code.
> 
> This PR updates the templates in `MetaspaceClosure` so that it can iterate any classes  that have the above four functions. This allows new types of data to be uniformly copied into the AOT cache (aka CDS archive) without ad-hoc copiers.
> 
> This PR is necessary for future evolution of AOT as more types of data will be copied into the AOT cache. For example, in Valhalla we have a `GrowableArray` that needs to be copied along with `AdapterHandleEntry`.

This pull request has now been integrated.

Changeset: cba7d88c
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/cba7d88ca427984ebb27a1634aab10a62c9eede1
Stats:     1166 lines in 30 files changed: 653 ins; 306 del; 207 mod

8374549: Extend MetaspaceClosure to cover non-MetaspaceObj types

Reviewed-by: kvn, asmehra

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

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


More information about the hotspot-dev mailing list