Skip to content

Commit 75edee2

Browse files
committed
Remove uses of ConditionProfile for the loop condition in RepeatingNode impls
1 parent 4c0e222 commit 75edee2

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/ForNode.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ public Object visibleExecute(VirtualFrame frame) {
207207

208208
private abstract static class AbstractIndexRepeatingNode extends AbstractRepeatingNode {
209209

210-
private final ConditionProfile conditionProfile = ConditionProfile.createCountingProfile();
211210
private final BranchProfile breakBlock = BranchProfile.create();
212211
private final BranchProfile nextBlock = BranchProfile.create();
213212

@@ -227,8 +226,6 @@ private abstract static class AbstractIndexRepeatingNode extends AbstractRepeati
227226
this.readIndexNode = LocalReadVariableNode.create(indexName, true);
228227
this.readLengthNode = LocalReadVariableNode.create(lengthName, true);
229228
this.writeIndexNode = WriteVariableNode.createAnonymous(indexName, Mode.REGULAR, null);
230-
// pre-initialize the profile so that loop exits to not deoptimize
231-
conditionProfile.profile(false);
232229
}
233230

234231
private static RNode createPositionLoad(String positionName, String rangeName) {
@@ -252,7 +249,7 @@ public boolean executeRepeating(VirtualFrame frame) {
252249
throw RInternalError.shouldNotReachHere("For index must be Integer.");
253250
}
254251
try {
255-
if (conditionProfile.profile(index <= length)) {
252+
if (index <= length) {
256253
if (writePosition(frame, index)) {
257254
writeElementNode.voidExecute(frame);
258255
body.voidExecute(frame);

com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/WhileNode.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ private static final class WhileRepeatingNode extends AbstractRepeatingNode {
6060

6161
@Child private ConvertBooleanNode condition;
6262

63-
private final ConditionProfile conditionProfile = ConditionProfile.createCountingProfile();
6463
private final BranchProfile normalBlock = BranchProfile.create();
6564
private final BranchProfile breakBlock = BranchProfile.create();
6665
private final BranchProfile nextBlock = BranchProfile.create();
@@ -72,14 +71,12 @@ private static final class WhileRepeatingNode extends AbstractRepeatingNode {
7271
super(body);
7372
this.whileNode = whileNode;
7473
this.condition = condition;
75-
// pre-initialize the profile so that loop exits to not deoptimize
76-
conditionProfile.profile(false);
7774
}
7875

7976
@Override
8077
public boolean executeRepeating(VirtualFrame frame) {
8178
try {
82-
if (conditionProfile.profile(condition.executeByte(frame) == RRuntime.LOGICAL_TRUE)) {
79+
if (condition.executeByte(frame) == RRuntime.LOGICAL_TRUE) {
8380
body.voidExecute(frame);
8481
normalBlock.enter();
8582
return true;

0 commit comments

Comments
 (0)