Skip to content

Commit a0288cc

Browse files
committed
Fix uncached backward-branch threshold generation
1 parent 1c76109 commit a0288cc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

truffle/src/com.oracle.truffle.api.bytecode.test/src/com/oracle/truffle/api/bytecode/test/basic_interpreter/BasicInterpreterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,8 +2575,8 @@ public void testTransitionToCachedLoop() {
25752575

25762576
node.getBytecodeNode().setUncachedThreshold(10);
25772577
assertEquals(BytecodeTier.UNCACHED, node.getBytecodeNode().getTier());
2578-
// 1 call + 9 backedges causes on-stack transition to cached.
2579-
assertEquals(9L, node.getCallTarget().call());
2578+
// 1 call + 10 backedges causes on-stack transition to cached.
2579+
assertEquals(10L, node.getCallTarget().call());
25802580
assertEquals(BytecodeTier.CACHED, node.getBytecodeNode().getTier());
25812581
}
25822582

truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/bytecode/generator/BytecodeInstructionHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ private TypeMirror emitBranchBackward(CodeTreeBuilder b) {
790790

791791
b.end();
792792
} else {
793-
b.startIf().string("uncachedExecuteCount_ <= 1").end().startBlock();
793+
b.startIf().string("uncachedExecuteCount_ <= 0").end().startBlock();
794794
/*
795795
* The force uncached check is put in here so that we don't need to check it in the
796796
* common case (the else branch where we just decrement).
@@ -858,7 +858,7 @@ private void emitBranchBackwardCaseBlock(CodeTreeBuilder b) {
858858
if (getTier().isUncached()) {
859859
b.statement("bci = " + BytecodeRootNodeElement.readImmediate("bc", "bci", instruction.getImmediate(ImmediateKind.BYTECODE_INDEX)));
860860

861-
b.startIf().string("uncachedExecuteCount_ <= 1").end().startBlock();
861+
b.startIf().string("uncachedExecuteCount_ <= 0").end().startBlock();
862862
/*
863863
* The force uncached check is put in here so that we don't need to check it in the
864864
* common case (the else branch where we just decrement).

0 commit comments

Comments
 (0)