RFR: 8360558: Use hex literals instead of decimal literals in math intrinsic constants
    Kim Barrett 
    kbarrett at openjdk.org
       
    Tue Sep 30 21:17:33 UTC 2025
    
    
  
On Tue, 30 Sep 2025 21:10:10 GMT, Kim Barrett <kbarrett 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`
>
> 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.)
I was surprised to discover that the "L" suffix is used quite a lot. I think those are likely often mistakes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27497#discussion_r2392849724
    
    
More information about the hotspot-compiler-dev
mailing list