File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/control Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 3232import com .oracle .truffle .api .nodes .Node ;
3333import com .oracle .truffle .api .nodes .NodeInfo ;
3434import com .oracle .truffle .api .nodes .RepeatingNode ;
35+ import com .oracle .truffle .api .profiles .LoopConditionProfile ;
3536
3637final class WhileRepeatingNode extends Node implements RepeatingNode {
3738
39+ private final LoopConditionProfile conditionProfile = LoopConditionProfile .createCountingProfile ();
40+
3841 @ Child CastToBooleanNode condition ;
3942 @ Child StatementNode body ;
4043
@@ -45,11 +48,11 @@ final class WhileRepeatingNode extends Node implements RepeatingNode {
4548
4649 @ Override
4750 public boolean executeRepeating (VirtualFrame frame ) {
48- if (!condition .executeBoolean (frame )) {
49- return false ;
51+ if (conditionProfile .profile (condition .executeBoolean (frame ))) {
52+ body .executeVoid (frame );
53+ return true ;
5054 }
51- body .executeVoid (frame );
52- return true ;
55+ return false ;
5356 }
5457}
5558
You can’t perform that action at this time.
0 commit comments