RFR: 8367391: Loss of precision on implicit conversion in vectornode.cpp

erifan duke at openjdk.org
Wed Sep 24 01:31:22 UTC 2025


On Tue, 23 Sep 2025 10:03:09 GMT, erifan <duke at openjdk.org> wrote:

> There is an issue with fix against JDK-8356760 on windows-x64 related to following lines
> 
>   long mask = (-1ULL >> (64 - vlen));
>   long bit  = type->get_con() & mask;
> 
> 
> `-1ULL` is an unsigned **64-bit** value; on Linux/macOS-x64, `long` is **64** bits, but on Windows-x64 it’s **32** bits. When assigning `-1ULL >> (64 - vlen)` to a `long` on Windows-x64, the **64-bit** result is truncated to **32** bits, causing precision loss as the upper 32 bits are discarded.
> 
> This pull request addresses the issue by replacing the `long` type with `jlong`. The fix has been verified on a Windows x64 machine with avx-512 support and resolves the reported problem.

Thanks for your review!

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

PR Comment: https://git.openjdk.org/jdk/pull/27449#issuecomment-3326105945


More information about the hotspot-compiler-dev mailing list