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

Ioi Lam iklam at openjdk.org
Thu Aug 4 16:48:18 UTC 2022


> 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:

 - Merge branch 'master' of https://github.com/openjdk/jdk into 8291457-clean-up-lifecycle-of-cds-dumptime-data
 - moved maybe_increment_refcount() to Symbol class; added comments about the need for deep copy
 - added operator= to complete the rule-of-three
 - use c++ copy-and-swap idiom
 - lint
 - fixed c++
 - 8291457: Clean up lifecycle of CDS dump-time data structures

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9722/files
  - new: https://git.openjdk.org/jdk/pull/9722/files/29661dd9..d4c3d87b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9722&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9722&range=01-02

  Stats: 8527 lines in 457 files changed: 4941 ins; 2642 del; 944 mod
  Patch: https://git.openjdk.org/jdk/pull/9722.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9722/head:pull/9722

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


More information about the hotspot-runtime-dev mailing list