RFR: 8160404: RelocationHolder constructors have bugs [v2]

Jorn Vernee jvernee at openjdk.org
Fri Dec 16 12:24:49 UTC 2022


On Fri, 16 Dec 2022 02:54:14 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> src/hotspot/share/code/relocInfo.hpp line 859:
>> 
>>> 857:   // We never heap allocate a Relocation, so never delete through a base pointer.
>>> 858:   // RelocationHolder depends on (and verifies) the destructor for all relocation
>>> 859:   // types is trivial, so can't be virtual.
>> 
>> Should this be:
>> Suggestion:
>> 
>>   // types is trivial, so can be non-virtual.
>> 
>> ?
>
> We have a requirement that the derived classes have trivial destructors (so we know it's safe to just construct over the storage without first destructing the old object).  Hence this destructor must *not* be virtual, as that would make it and destructors for derived classes not trivial.  I expanded the comment a bit to clarify that.

Ah, ok. Thanks for explaining.

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

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


More information about the hotspot-compiler-dev mailing list