RFR: 8366193: Add comments about ResolvedFieldEntry::copy_from()

Andrew Dinn adinn at openjdk.org
Thu Aug 28 12:18:45 UTC 2025


On Wed, 27 Aug 2025 08:52:28 GMT, Francesco Andreuzzi <duke at openjdk.org> wrote:

>> [JDK-8293980](https://bugs.openjdk.org/browse/JDK-8293980) added `ResolvedFieldEntry::copy_from()` to prevent random bits in the CDS archive. However, I forgot to add a comment to explain why this is necessary.
>> 
>> This PR adds the missing comment, which will be useful if we consider alternative solutions (using `memset()` in constructor??) in the future.
>
> Hi @iklam, thanks for the explanation. I was wondering, would it be possible to explicitly set padding fields with default value zero? Something like this:
> 
> u8 padding1;
> #ifdef _LP64
> u32 padding2;
> #endif
> 
> so we could use the default constructor, like I'm doing in #26818.

@fandreuz @albertnetymk The problem with requiring the use of padding fields is that it is fragile. Changing a type definition might easily reintroduce the archive comparison problem and also inadvertently increase allocation sizes.

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

PR Comment: https://git.openjdk.org/jdk/pull/26946#issuecomment-3233266473


More information about the hotspot-dev mailing list