RFR: 8287052: comparing double to max_intx gives unexpected results

Vladimir Kozlov kvn at openjdk.java.net
Fri May 20 02:52:45 UTC 2022


On Fri, 20 May 2022 01:03:02 GMT, Dean Long <dlong at openjdk.org> wrote:

> It isn't safe to compare a double to 2^63-1 because the latter will be changed to 2^63 when converting to a double.
> This fixes a compiler warning with clang-12 and prevents the code from returning a negative value in some cases (observed on x64 with g++).

I think it is **insane** to allow DBL_MAX as upper limit for CompileThresholdScaling:

range(0.0, DBL_MAX)

It should be `(double)max_intx` since we can't have compilation threshold (which is integer) more than that.

If limited to that, your checks for NAN and INF double values will not be needed because you will only can get max_intx^2 value. You can convert them to assert to catch case if `scale` is something different from `CompileThresholdScaling`. But I don't see such path in code.

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

Changes requested by kvn (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/8798


More information about the hotspot-compiler-dev mailing list