RFR: 8293187: Store initialized Enum classes in AOTCache [v10]

Andrew Dinn adinn at openjdk.org
Wed Oct 2 09:31:38 UTC 2024


On Tue, 1 Oct 2024 06:27:39 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> src/hotspot/share/cds/heapShared.cpp line 939:
>> 
>>> 937: 
>>> 938:   _run_time_subgraph_info_table.serialize_header(soc);
>>> 939:   soc->do_ptr(&_runtime_default_subgraph_info);
>> 
>> It would help to have a comment here explaining that 1) before the do_ptr call the specific subgraph_info passed into this call holds all the classes that need to be initialized on behalf of java.lang.Object 2) after the call it is includes all the extra classes that need initializing on behalf of some archived java.lang.Class mirror. This would help to clarify why it was picked as the holder for these extra classes (i.e. it is the obvious root class from which to start running initializations).
>> 
>> If field `_runtime_default_subgraph_info` was renamed to identify it as being the root subgraph associated with class java.lang.Object this would also be clearer (see related comment)
>
> Actually, the `do_ptr()` call is a somewhat cryptic API for passing values and pointers between the assembly phase and the production run.
> 
> In this example, during the production run, before the `do_ptr()` call,  `_runtime_default_subgraph_info` is null. After the call, it points to the `ArchivedKlassSubGraphInfoRecord` that was created by `HeapShared::archive_subgraph_info()` during the assembly phase.

Ok, I see now what is gong on here. This is driven by either a `ReadClosure` or a `WriteClosure` depening on where `MetadataShared::serialize` get called from. I was mixing this up with what goes on when we see a call to `do_entry` in `CopyKlassSubGraphInfoToArchive`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20958#discussion_r1784114360


More information about the hotspot-dev mailing list