RFR: 8367391: Loss of precision on implicit conversion in vectornode.cpp
Christian Hagedorn
chagedorn at openjdk.org
Tue Sep 23 11:42:04 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.
That was easy to miss, thanks for the fix. Looks good to me!
-------------
Marked as reviewed by chagedorn (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/27449#pullrequestreview-3257541918
More information about the hotspot-compiler-dev
mailing list