8287052: comparing double to max_intx gives unexpected results

Reviewed-by: kvn
This commit is contained in:
Dean Long 2022-05-20 20:24:04 +00:00
parent 7b274feba5
commit ba23f14025

View File

@ -131,11 +131,15 @@ intx CompilerConfig::scaled_compile_threshold(intx threshold, double scale) {
} else {
double v = threshold * scale;
assert(v >= 0, "must be");
if (v > max_intx) {
if (g_isnan(v) || !g_isfinite(v)) {
return max_intx;
} else {
return (intx)(v);
}
int exp;
(void) frexp(v, &exp);
if (exp > 63) {
return max_intx;
}
return (intx)(v);
}
}