RFR: 8291969: Convert LoaderConstraintsTable to ResourceHashtable [v5]

Coleen Phillimore coleenp at openjdk.org
Mon Aug 22 18:18:29 UTC 2022


On Mon, 22 Aug 2022 17:16:43 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   How about ConstraintSet ? It looks unconfusing in context.
>
> src/hotspot/share/classfile/loaderConstraints.cpp line 56:
> 
>> 54:   }
>> 55: 
>> 56:   ~LoaderConstraint() { delete _loaders; }
> 
> These two lines should be added to make sure that we never make a shallow copy of LoaderConstraint, or else the `_loaders` would be deleted multiple times.
> 
> 
>   LoaderConstraint(const LoaderConstraint& src) = delete;
>   LoaderConstraint& operator=(const LoaderConstraint&) = delete;

ok, fixed.  There's a NONCOPYABLE() macro that I can use but I put in the lines instead.

> src/hotspot/share/classfile/loaderConstraints.cpp line 415:
> 
>> 413:   // Copy into the shorter of the constraints.
>> 414:   LoaderConstraint* dest = p1->num_loaders() <= p2->num_loaders() ? p1 : p2;
>> 415:   LoaderConstraint* src = dest == p1 ? p2 : p1;
> 
> Is the purpose to reduce the number of copies? If so, you should copy into the one with more loaders.

Yes, I should have done that.

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

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


More information about the hotspot-runtime-dev mailing list