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

Ioi Lam iklam at openjdk.org
Thu Sep 26 21:04:37 UTC 2024


On Thu, 26 Sep 2024 20:50:17 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:

>> The `subgraph_object_klasses` are built during assembly phase when each mirror is added to the cache. Note that we don't add the "real" mirror of the classes, but we add the scratch mirror:
>> 
>> 
>> void HeapShared::archive_java_mirrors() {
>>     ...
>>     oop m = scratch_java_mirror(orig_k);
>>     if (m != nullptr) {
>>       Klass* buffered_k = ArchiveBuilder::get_buffered_klass(orig_k);
>>       bool success = archive_reachable_objects_from(1, _default_subgraph_info, m);
>> 
>> 
>> So the scratch mirrors of `B` and `C` will be empty when they are being archived.
>> 
>> Because `A` is marked as aot-initialized, we copy the fields of the "real" mirror of `A` into its scratch mirror. See `HeapShared::copy_aot_initialized_mirror()`. That's why we are able to add `X` into the subgraph_object_klasses (when `A`'s scratch mirror is scanned inside `archive_reachable_objects_from()`)
>
> @iklam are you planning to address this? Otherwise the patch looks good to me.

Yes, I plan to to address this.

I think the name `init_classes_reachable_from_archived_mirrors` is confusing, as it also initializes classes that may not be reachable from archived mirrors. I will try to rename this function and related data structures to make the meaning more obvious.

I'd like to keep the logic the same, as I still need to do the initialization in 4 steps (boo1/boot2/platform/app) for classes listed under `_runtime_default_subgraph_info`. If I split up `_runtime_default_subgraph_info` into two separate parts the code will just become more verbose.

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

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


More information about the hotspot-dev mailing list