# HG changeset patch # User Stefan Marr # Date 1447943546 -3600 # Node ID c1dfbaeef4af5d4a55821192c36a56708a968aa7 # Parent 9f64eb5ad9c1df1f9c20e4771f9934ad9b409eec Profile counts should not overflow, otherwise injectBranchProbability triggers assertion diff -r 9f64eb5ad9c1 -r c1dfbaeef4af truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/CountingConditionProfile.java --- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/CountingConditionProfile.java Thu Nov 19 09:59:05 2015 +0100 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/utilities/CountingConditionProfile.java Thu Nov 19 15:32:26 2015 +0100 @@ -52,14 +52,18 @@ CompilerDirectives.transferToInterpreterAndInvalidate(); } if (CompilerDirectives.inInterpreter()) { - trueCount++; + if (trueCount < Integer.MAX_VALUE) { + trueCount++; + } } } else { if (falseCount == 0) { CompilerDirectives.transferToInterpreterAndInvalidate(); } if (CompilerDirectives.inInterpreter()) { - falseCount++; + if (falseCount < Integer.MAX_VALUE) { + falseCount++; + } } } return CompilerDirectives.injectBranchProbability((double) trueCount / (double) (trueCount + falseCount), value);