JDK-8287052 : comparing double to max_intx gives unexpected results
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 19
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-05-19
  • Updated: 2022-06-20
  • Resolved: 2022-05-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 19
19 b24Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
% java -XX:CompileThresholdScaling=922337203685477.5808 -version
CompileThreshold (-9223372036854775808) must be between 0 and 1073741823
intx Tier0InvokeNotifyFreqLog=32 is outside the allowed range [ 0 ... 30 ]
intx Tier0BackedgeNotifyFreqLog=32 is outside the allowed range [ 0 ... 30 ]
intx Tier3InvocationThreshold=184467440737095520 is outside the allowed range [ 0 ... 2147483647 ]
intx Tier3MinInvocationThreshold=92233720368547760 is outside the allowed range [ 0 ... 2147483647 ]
intx Tier3CompileThreshold=1844674407370955264 is outside the allowed range [ 0 ... 2147483647 ]
intx Tier3BackEdgeThreshold=9223372036854775807 is outside the allowed range [ 0 ... 2147483647 ]
intx Tier2InvokeNotifyFreqLog=32 is outside the allowed range [ 0 ... 30 ]
intx Tier2BackedgeNotifyFreqLog=32 is outside the allowed range [ 0 ... 30 ]
intx Tier3InvokeNotifyFreqLog=32 is outside the allowed range [ 0 ... 30 ]
intx Tier3BackedgeNotifyFreqLog=32 is outside the allowed range [ 0 ... 30 ]
intx Tier23InlineeNotifyFreqLog=32 is outside the allowed range [ 0 ... 30 ]
intx Tier4InvocationThreshold=4611686018427387904 is outside the allowed range [ 0 ... 2147483647 ]
intx Tier4MinInvocationThreshold=553402322211286592 is outside the allowed range [ 0 ... 2147483647 ]
intx Tier4CompileThreshold=9223372036854775807 is outside the allowed range [ 0 ... 2147483647 ]
intx Tier4BackEdgeThreshold=9223372036854775807 is outside the allowed range [ 0 ... 2147483647 ]
java version "19-internal" 2022-09-20

Comments
Changeset: ba23f140 Author: Dean Long <dlong@openjdk.org> Date: 2022-05-20 20:24:04 +0000 URL: https://git.openjdk.java.net/jdk/commit/ba23f14025f42bdb3bc831782b2f11443d1c572c
20-05-2022

ILW = Wrong compile threshold due to conversion error, only with huge CompileThresholdScaling values, use smaller values = MLM = P4
20-05-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/8798 Date: 2022-05-20 01:03:02 +0000
20-05-2022

The warning given by clang-12 shows the problem: compilerDefinitions.cpp:134:13: error: implicit conversion from 'const intx' (aka 'const long') to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion] if (v > max_intx) { ~ ^~~~~~~~ 1 error generated. The value max_intx cannot be represented exactly by a double. For the above logic to work, we need to round towards zero/truncate when converting, while rounding to the nearest value causes problems. Doing an explicit cast gets rid of the warning but not the problem.
19-05-2022