Skip to content

Commit edd3ff5

Browse files
committed
Replacing BoolNode with CastToBooleanNode.
1 parent dabb466 commit edd3ff5

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,6 @@ private static String toString(byte[] barr) {
11921192
@SuppressWarnings("unused")
11931193
public abstract static class BoolNode extends PythonBinaryBuiltinNode {
11941194

1195-
public abstract boolean executeWith(Object cls, Object val);
1196-
11971195
@Specialization
11981196
public boolean boolB(Object cls, boolean arg) {
11991197
return arg;
@@ -1229,9 +1227,6 @@ public boolean bool(Object cls, Object obj,
12291227
}
12301228
}
12311229

1232-
public static BoolNode create() {
1233-
return BuiltinConstructorsFactory.BoolNodeFactory.create();
1234-
}
12351230
}
12361231

12371232
// list([iterable])

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object/ObjectBuiltins.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
import com.oracle.graal.python.nodes.call.special.LookupAndCallBinaryNode;
7777
import com.oracle.graal.python.nodes.call.special.LookupAndCallUnaryNode;
7878
import com.oracle.graal.python.nodes.expression.BinaryComparisonNode;
79+
import com.oracle.graal.python.nodes.expression.CastToBooleanNode;
7980
import com.oracle.graal.python.nodes.function.PythonBuiltinBaseNode;
8081
import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
8182
import com.oracle.graal.python.nodes.function.builtins.PythonTernaryBuiltinNode;
@@ -200,21 +201,20 @@ public boolean eq(Object self, Object other) {
200201
public abstract static class NeNode extends PythonBinaryBuiltinNode {
201202

202203
@Specialization
204+
@TruffleBoundary
203205
public boolean ne(PythonNativeObject self, PythonNativeObject other) {
204206
return !self.object.equals(other.object);
205207
}
206208

207209
@Specialization
208210
public Object ne(Object self, Object other,
209211
@Cached("create(__EQ__)") LookupAndCallBinaryNode eqNode,
210-
@Cached("create()") BuiltinConstructors.BoolNode boolNode,
211-
@Cached("create()") GetClassNode getClassNode) {
212+
@Cached("createIfFalseNode()") CastToBooleanNode ifFalseNode) {
212213
Object result = eqNode.executeObject(self, other);
213214
if (result == PNotImplemented.NOT_IMPLEMENTED) {
214215
return result;
215216
}
216-
217-
return !boolNode.executeWith(getClassNode.execute(result), result);
217+
return ifFalseNode.executeWith(result);
218218
}
219219
}
220220

0 commit comments

Comments
 (0)