Skip to content

Commit ecceee9

Browse files
committed
Use LookupAndCallBinaryNode with slots in BinaryComparisonNode
1 parent 6042bdd commit ecceee9

File tree

3 files changed

+8
-19
lines changed

3 files changed

+8
-19
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/call/special/LookupAndCallBinaryNode.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,6 @@ public static LookupAndCallBinaryNode create(String name) {
140140
return LookupAndCallBinaryNodeGen.create(name, null, null, false, false);
141141
}
142142

143-
public static LookupAndCallBinaryNode createReversible(String name, String reverseName, Supplier<NotImplementedHandler> handlerFactory) {
144-
assert name.startsWith("__") && reverseName.startsWith("__r");
145-
return LookupAndCallBinaryNodeGen.create(name, reverseName, handlerFactory, false, false);
146-
}
147-
148-
public static LookupAndCallBinaryNode create(String name, String rname, boolean alwaysCheckReverse, boolean ignoreDescriptorException) {
149-
return LookupAndCallBinaryNodeGen.create(name, rname, null, alwaysCheckReverse, ignoreDescriptorException);
150-
}
151-
152143
public static LookupAndCallBinaryNode create(String name, Supplier<NotImplementedHandler> handlerFactory) {
153144
return LookupAndCallBinaryNodeGen.create(name, null, handlerFactory, false, false);
154145
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/expression/BinaryArithmetic.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,6 @@ static LookupAndCallBinaryNode createCallNode(SpecialMethodSlot slot, Supplier<N
168168
return LookupAndCallBinaryNode.createReversible(slot, slot.getReverse(), handler);
169169
}
170170

171-
static LookupAndCallBinaryNode createCallNode(String name, Supplier<NotImplementedHandler> handler) {
172-
return LookupAndCallBinaryNode.createReversible(name, "__r" + name.substring(2), handler);
173-
}
174-
175171
}
176172
/*
177173
*

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/expression/BinaryComparisonNode.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
import com.oracle.graal.python.builtins.objects.PNotImplemented;
3737
import com.oracle.graal.python.builtins.objects.str.StringUtils;
38+
import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
3839
import com.oracle.graal.python.nodes.ErrorMessages;
3940
import com.oracle.graal.python.nodes.PRaiseNode;
4041
import com.oracle.graal.python.nodes.call.special.LookupAndCallBinaryNode;
@@ -46,6 +47,7 @@
4647
import com.oracle.graal.python.nodes.expression.BinaryComparisonNodeFactory.NeNodeGen;
4748
import com.oracle.graal.python.nodes.object.IsNode;
4849
import com.oracle.graal.python.nodes.truffle.PythonArithmeticTypes;
50+
import com.oracle.graal.python.runtime.formatting.InternalFormat.Spec;
4951
import com.oracle.truffle.api.CompilerDirectives;
5052
import com.oracle.truffle.api.dsl.Cached;
5153
import com.oracle.truffle.api.dsl.Specialization;
@@ -155,7 +157,7 @@ protected final Object doGeneric(VirtualFrame frame, Object left, Object right,
155157
}
156158

157159
protected static LookupAndCallBinaryNode createCallNode() {
158-
return LookupAndCallBinaryNode.create(__LE__, __GE__, true, true);
160+
return LookupAndCallBinaryNode.create(SpecialMethodSlot.Le, SpecialMethodSlot.Ge, true, true);
159161
}
160162

161163
@Override
@@ -227,7 +229,7 @@ protected final Object doGeneric(VirtualFrame frame, Object left, Object right,
227229
}
228230

229231
protected static LookupAndCallBinaryNode createCallNode() {
230-
return LookupAndCallBinaryNode.create(__LT__, __GT__, true, true);
232+
return LookupAndCallBinaryNode.create(SpecialMethodSlot.Lt, SpecialMethodSlot.Gt, true, true);
231233
}
232234

233235
@Override
@@ -299,7 +301,7 @@ protected final Object doGeneric(VirtualFrame frame, Object left, Object right,
299301
}
300302

301303
protected static LookupAndCallBinaryNode createCallNode() {
302-
return LookupAndCallBinaryNode.create(__GE__, __LE__, true, true);
304+
return LookupAndCallBinaryNode.create(SpecialMethodSlot.Ge, SpecialMethodSlot.Le, true, true);
303305
}
304306

305307
@Override
@@ -371,7 +373,7 @@ protected final Object doGeneric(VirtualFrame frame, Object left, Object right,
371373
}
372374

373375
protected static LookupAndCallBinaryNode createCallNode() {
374-
return LookupAndCallBinaryNode.create(__GT__, __LT__, true, true);
376+
return LookupAndCallBinaryNode.create(SpecialMethodSlot.Gt, SpecialMethodSlot.Lt, true, true);
375377
}
376378

377379
@Override
@@ -445,7 +447,7 @@ protected final Object doGeneric(VirtualFrame frame, Object left, Object right,
445447
}
446448

447449
protected static LookupAndCallBinaryNode createCallNode() {
448-
return LookupAndCallBinaryNode.create(__EQ__, __EQ__, true, true);
450+
return LookupAndCallBinaryNode.create(SpecialMethodSlot.Eq, SpecialMethodSlot.Eq, true, true);
449451
}
450452

451453
public static EqNode create() {
@@ -514,7 +516,7 @@ protected final Object doGeneric(VirtualFrame frame, Object left, Object right,
514516
}
515517

516518
protected static LookupAndCallBinaryNode createCallNode() {
517-
return LookupAndCallBinaryNode.create(__NE__, __NE__, true, true);
519+
return LookupAndCallBinaryNode.create(SpecialMethodSlot.Ne, SpecialMethodSlot.Ne, true, true);
518520
}
519521

520522
public static NeNode create() {

0 commit comments

Comments
 (0)