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

Coleen Phillimore coleenp at openjdk.org
Wed Aug 27 12:42:42 UTC 2025


On Tue, 26 Aug 2025 16:53:17 GMT, Ioi Lam <iklam 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.

This comment is helpful.  At one point, I made Metaspace::allocate not zero memory and several things broke.  This would have been one of them it if existed.  I don't know if there's a better solution to to ensuring alignment gaps in fields always zeroed.

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26946#pullrequestreview-3159621546


More information about the hotspot-dev mailing list