RFR: 8290833: Remove ConstantPoolCache::walk_entries_for_initialization() [v2]
Ioi Lam
iklam at openjdk.org
Mon Aug 8 18:51:03 UTC 2022
On Fri, 5 Aug 2022 23:04:34 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
>>
>> review comments by @calvinccheung and @coleenp
>
> src/hotspot/share/cds/dumpTimeClassInfo.cpp line 80:
>
>> 78: // The saved cp entries array is not modified by the ArchiveBuilder, so there's
>> 79: // no need to make a deep copy. It will be freed when the holder class is removed.
>> 80: _saved_cpcache_entries = src._saved_cpcache_entries;
>
> If you're copying these entries, should you make src._saved_cpcache_entries null so you don't double delete them? Or just for safety in case someone adds deleting it to the destructor later.
Actually, the `_saved_cpcache_entries` has a different lifecycle than the `DumpTimeClassInfo`. We set the `_saved_cpcache_entries` after the cpCache is allocated, and it's never changed afterwards. It's freed when the cpCache is deallocated.
I can see why the current code is confusing. I'll try to move it to a new table of `cpCache*` -> `ConstantPoolEntry*` which will make the code easier to understand and maintain.
-------------
PR: https://git.openjdk.org/jdk/pull/9759
More information about the hotspot-runtime-dev
mailing list