RFR: 8360558: Use hex literals instead of decimal literals in math intrinsic constants

Kim Barrett kbarrett at openjdk.org
Tue Sep 30 21:13:38 UTC 2025


On Thu, 25 Sep 2025 19:26:34 GMT, Mohamed Issa <missa at openjdk.org> wrote:

> A simple change to use hex literals instead of decimal literals in the constant arrays of the x86 cbrt and tanh stubs. The JTREG tests listed below were used to verify correctness. The baseline build used is [OpenJDK v26-b17](https://github.com/openjdk/jdk/releases/tag/jdk-26%2B17).
> 
> 1. `jtreg:test/jdk/java/lang/Math/CubeRootTests.java`
> 2. `jtreg:test/jdk/java/lang/Math/HyperbolicTests.java`

Changes requested by kbarrett (Reviewer).

src/hotspot/cpu/x86/stubGenerator_x86_64_cbrt.cpp line 52:

> 50: ATTRIBUTE_ALIGNED(16) static const juint _ABS_MASK[] =
> 51: {
> 52:     4294967295, 2147483647, 0, 0

The "L" suffix means different things for Windows (MSVC) and gcc/clang and, like the `long`
type, should rarely (perhaps never?) be used in HotSpot code.  `long` is a 32bit type on Windows
and 32bit gcc/clang platforms, and a 64bit type on 64bit gcc/clang platforms. (Or something like
that. I'm not sure what happens when building for windows with gcc/clang, which isn't a
supported configuration anyway.)

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

PR Review: https://git.openjdk.org/jdk/pull/27497#pullrequestreview-3286727971
PR Review Comment: https://git.openjdk.org/jdk/pull/27497#discussion_r2392842756


More information about the hotspot-compiler-dev mailing list