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

Ioi Lam iklam at openjdk.org
Thu Aug 4 05:26:00 UTC 2022


On Wed, 3 Aug 2022 16:10:08 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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
>
> src/hotspot/share/cds/dumpTimeClassInfo.cpp line 72:
> 
>> 70:       for (int i = 0; i < n; i++) {
>> 71:         _loader_constraints->append(src._loader_constraints->at(i));
>> 72:       }
> 
> Do you need the src copy after the copy constructor runs?  You could transfer ownership of the verifier and loader_constraints arrays if not.

The src copy is still needed after the copy. I added more comments to explain why the deep copy is necessary.

> src/hotspot/share/cds/dumpTimeClassInfo.cpp line 85:
> 
>> 83:   if (_loader_constraints != NULL) {
>> 84:     delete _loader_constraints;
>> 85:   }
> 
> So this delete operator in this destructor calls the destructors for all the elements of the _verifier_constraints, _verifier_constraint_flags and _loader_constraints elements, which decrements refcounts in them, right?

Yes. `_loader_constraints` is a GrowableArray, which calls its element type's destructor.

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

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


More information about the hotspot-runtime-dev mailing list