RFR: 8291457: Clean up lifecycle of CDS dump-time data structures [v2]

Coleen Phillimore coleenp at openjdk.org
Thu Aug 4 15:15:24 UTC 2022


On Thu, 4 Aug 2022 05:25:57 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> I've rewritten the following data CDS structures to follow the [C++ rule-of-three](https://en.cppreference.com/w/cpp/language/rule_of_three) to improve their lifecycle handling and fix a memory leak. This is done to prepare for future CDS changes that make more allocations during archive creation.
>> 
>>> Rule of Three: If a class requires a user-defined destructor, a user-defined copy constructor, or a user-defined copy assignment operator, it almost certainly requires all three.
>> 
>> - DumpTimeClassInfo
>> - DumpTimeClassInfo::DTLoaderConstraint
>> - DumpTimeClassInfo::DTVerifierConstraint
>> - DumpTimeLambdaProxyClassInfo
>> 
>> I implemented some of the assignment operators using the [copy-and-swap idiom](https://en.cppreference.com/w/cpp/language/copy_assignment) to handle `Symbol` refcounting. Thanks to @kimbarrett for the suggestion.
>
> Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:
> 
>   moved maybe_increment_refcount() to Symbol class; added comments about the need for deep copy

Looks good. Thanks for the comment.

src/hotspot/share/classfile/systemDictionaryShared.cpp line 1493:

> 1491: // must make a deep copy, as internal data structures such as the contents of
> 1492: // DumpTimeClassInfo::_loader_constraints are also modified by the ArchiveBuilder.
> 1493: 

Ok, I see.  So it can't make a shallow copy.

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

Marked as reviewed by coleenp (Reviewer).

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


More information about the hotspot-runtime-dev mailing list