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 32
32
import com .oracle .truffle .api .nodes .Node ;
33
33
import com .oracle .truffle .api .nodes .NodeInfo ;
34
34
import com .oracle .truffle .api .nodes .RepeatingNode ;
35
+ import com .oracle .truffle .api .profiles .LoopConditionProfile ;
35
36
36
37
final class WhileRepeatingNode extends Node implements RepeatingNode {
37
38
39
+ private final LoopConditionProfile conditionProfile = LoopConditionProfile .createCountingProfile ();
40
+
38
41
@ Child CastToBooleanNode condition ;
39
42
@ Child StatementNode body ;
40
43
@@ -45,11 +48,11 @@ final class WhileRepeatingNode extends Node implements RepeatingNode {
45
48
46
49
@ Override
47
50
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 ;
50
54
}
51
- body .executeVoid (frame );
52
- return true ;
55
+ return false ;
53
56
}
54
57
}
55
58
You can’t perform that action at this time.
0 commit comments