RFR: 8377895: Create sizeof_auto, to reduce narrowing conversions [v2]
Johan Sjölen
jsjolen at openjdk.org
Tue Feb 17 09:44:13 UTC 2026
On Mon, 16 Feb 2026 14:00:38 GMT, Leo Korinth <lkorinth at openjdk.org> wrote:
>> src/hotspot/share/oops/cpCache.hpp line 199:
>>
>>> 197:
>>> 198: public:
>>> 199: static int size() { return align_metadata_size(sizeof_auto<ConstantPoolCache>() / wordSize); }
>>
>> Surely, this should no be a part of this PR?
>
> This line of code is one of the /reasons/ for implementing `sizeof_auto`. Without `sizeof_auto` this expression creates an implicit narrowing conversion (a warning in my emacs, and hopefully a compiler error soon). I can remove the change, but I thought it was a nice way to show its value.
>
> Do you still want me to remove the fix for an implicit narrowing conversion?
OK, I think we can keep it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29716#discussion_r2815909635
More information about the hotspot-dev
mailing list