RFR: 8306331: assert((cnt > 0.0f) && (prob > 0.0f)) failed: Bad frequency assignment in if

Tobias Hartmann thartmann at openjdk.org
Mon Apr 24 05:33:44 UTC 2023


On Thu, 20 Apr 2023 02:44:00 GMT, Dean Long <dlong at openjdk.org> wrote:

> This change removes undefined behavior caused by signed overflow, which triggered an assert with Xcode14.3+1.0-beta1 on macos aarch64.

Looks good to me.

src/hotspot/share/opto/parse2.cpp line 1200:

> 1198: // (check for saturation, integer overflow, and immature counts)
> 1199: static bool counters_are_meaningful(int counter1, int counter2, int min) {
> 1200:   // check for saturation, inluding "uint" values too big to fit it "int"

Suggestion:

  // check for saturation, including "uint" values too big to fit in "int"

src/hotspot/share/opto/parse2.cpp line 1211:

> 1209:   }
> 1210:   // check if mature
> 1211:   return counter1 + counter2 >= min;

Suggestion:

  return (counter1 + counter2) >= min;

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

Marked as reviewed by thartmann (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13551#pullrequestreview-1397218355
PR Review Comment: https://git.openjdk.org/jdk/pull/13551#discussion_r1174789335
PR Review Comment: https://git.openjdk.org/jdk/pull/13551#discussion_r1174792091


More information about the hotspot-compiler-dev mailing list