Skip to content

Commit d0c1e3f

Browse files
committed
Clean up old slot infrastructure
1 parent 50119d4 commit d0c1e3f

File tree

6 files changed

+4
-702
lines changed

6 files changed

+4
-702
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/PythonBuiltinClassType.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,6 @@ public final Shape getInstanceShape(PythonLanguage lang) {
800800
SpecialMethodSlot[] repr = new SpecialMethodSlot[]{SpecialMethodSlot.Repr};
801801
SpecialMethodSlot[] reprAndNew = new SpecialMethodSlot[]{SpecialMethodSlot.Repr, SpecialMethodSlot.New};
802802

803-
Boolean.redefinedSlots = new SpecialMethodSlot[]{SpecialMethodSlot.And};
804803
PythonModule.redefinedSlots = Super.redefinedSlots = repr;
805804
SyntaxError.redefinedSlots = new SpecialMethodSlot[]{SpecialMethodSlot.Str};
806805
UnicodeEncodeError.redefinedSlots = new SpecialMethodSlot[]{SpecialMethodSlot.Str};

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/SpecialMethodSlot.java

Lines changed: 1 addition & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -44,23 +44,12 @@
4444
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.AM_ANEXT;
4545
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.AM_AWAIT;
4646
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.MP_ASS_SUBSCRIPT;
47-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_AND;
48-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_DIVMOD;
4947
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_FLOAT;
50-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_FLOOR_DIVIDE;
5148
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_INDEX;
5249
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_INPLACE_ADD;
5350
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_INPLACE_MULTIPLY;
5451
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_INT;
55-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_LSHIFT;
56-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_MATRIX_MULTIPLY;
57-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_OR;
5852
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_POWER;
59-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_REMAINDER;
60-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_RSHIFT;
61-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_SUBTRACT;
62-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_TRUE_DIVIDE;
63-
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.NB_XOR;
6453
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.SQ_ASS_ITEM;
6554
import static com.oracle.graal.python.builtins.objects.type.MethodsFlags.SQ_CONTAINS;
6655
import static com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot.Flags.NO_BUILTIN_DESCRIPTORS;
@@ -69,20 +58,17 @@
6958
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___AENTER__;
7059
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___AEXIT__;
7160
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___AITER__;
72-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___AND__;
7361
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___ANEXT__;
7462
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___AWAIT__;
7563
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___BYTES__;
7664
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___CALL__;
7765
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___CONTAINS__;
7866
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___DELATTR__;
7967
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___DELITEM__;
80-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___DIVMOD__;
8168
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___ENTER__;
8269
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___EQ__;
8370
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___EXIT__;
8471
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___FLOAT__;
85-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___FLOORDIV__;
8672
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___FORMAT__;
8773
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___GE__;
8874
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___GT__;
@@ -96,39 +82,20 @@
9682
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___ITER__;
9783
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___LENGTH_HINT__;
9884
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___LE__;
99-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___LSHIFT__;
10085
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___LT__;
101-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___MATMUL__;
10286
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___MISSING__;
103-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___MOD__;
10487
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___NEW__;
10588
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___NEXT__;
10689
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___NE__;
107-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___OR__;
10890
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___POW__;
109-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RAND__;
110-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RDIVMOD__;
11191
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___REPR__;
11292
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___REVERSED__;
113-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RFLOORDIV__;
114-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RLSHIFT__;
115-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RMATMUL__;
116-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RMOD__;
117-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___ROR__;
11893
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___ROUND__;
11994
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RPOW__;
120-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RRSHIFT__;
121-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RSHIFT__;
122-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RSUB__;
123-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RTRUEDIV__;
124-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___RXOR__;
12595
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___SETITEM__;
12696
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___SET_NAME__;
12797
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___STR__;
12898
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___SUBCLASSCHECK__;
129-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___SUB__;
130-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___TRUEDIV__;
131-
import static com.oracle.graal.python.nodes.SpecialMethodNames.T___XOR__;
13299
import static com.oracle.graal.python.util.PythonUtils.TS_ENCODING;
133100
import static com.oracle.graal.python.util.PythonUtils.tsLiteral;
134101

@@ -243,32 +210,8 @@ public enum SpecialMethodSlot {
243210
Gt(T___GT__),
244211
Ge(T___GE__),
245212

246-
And(T___AND__, NB_AND),
247-
RAnd(T___RAND__, NB_AND),
248-
Or(T___OR__, NB_OR),
249-
ROr(T___ROR__, NB_OR),
250-
Xor(T___XOR__, NB_XOR),
251-
RXor(T___RXOR__, NB_XOR),
252-
// Don't add SQ_CONCAT, CPython doesn't add a wrapper for it
253-
Sub(T___SUB__, NB_SUBTRACT),
254-
RSub(T___RSUB__, NB_SUBTRACT),
255-
// Don't add SQ_REPEAT, CPython doesn't add a wrapper for it
256-
MatMul(T___MATMUL__, NB_MATRIX_MULTIPLY),
257-
RMatMul(T___RMATMUL__, NB_MATRIX_MULTIPLY),
258-
Mod(T___MOD__, NB_REMAINDER),
259-
RMod(T___RMOD__, NB_REMAINDER),
260-
DivMod(T___DIVMOD__, NB_DIVMOD),
261-
RDivMod(T___RDIVMOD__, NB_DIVMOD),
262213
Pow(T___POW__, NB_POWER),
263214
RPow(T___RPOW__, NB_POWER),
264-
TrueDiv(T___TRUEDIV__, NB_TRUE_DIVIDE),
265-
RTrueDiv(T___RTRUEDIV__, NB_TRUE_DIVIDE),
266-
FloorDiv(T___FLOORDIV__, NB_FLOOR_DIVIDE),
267-
RFloorDiv(T___RFLOORDIV__, NB_FLOOR_DIVIDE),
268-
LShift(T___LSHIFT__, NB_LSHIFT),
269-
RLShift(T___RLSHIFT__, NB_LSHIFT),
270-
RShift(T___RSHIFT__, NB_RSHIFT),
271-
RRShift(T___RRSHIFT__, NB_RSHIFT),
272215
Round(T___ROUND__),
273216

274217
IAdd(T___IADD__, NB_INPLACE_ADD),
@@ -323,18 +266,7 @@ static class Flags {
323266
}
324267

325268
static {
326-
And.reverse = RAnd;
327-
Or.reverse = ROr;
328-
Sub.reverse = RSub;
329-
DivMod.reverse = RDivMod;
330-
TrueDiv.reverse = RTrueDiv;
331-
FloorDiv.reverse = RFloorDiv;
332-
LShift.reverse = RLShift;
333-
RShift.reverse = RRShift;
334-
Xor.reverse = RXor;
335-
MatMul.reverse = RMatMul;
336269
Pow.reverse = RPow;
337-
Mod.reverse = RMod;
338270
assert checkFind();
339271
assert checkReverseSlots();
340272
}
@@ -855,9 +787,6 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
855787
if (eqNode.execute(name, T___DICT__, TS_ENCODING)) {
856788
return Dict;
857789
}
858-
if (eqNode.execute(name, T___DIVMOD__, TS_ENCODING)) {
859-
return DivMod;
860-
}
861790
break;
862791
case 'i' * 26 + 't': // it
863792
if (eqNode.execute(name, T___ITER__, TS_ENCODING)) {
@@ -893,9 +822,6 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
893822
if (eqNode.execute(name, T___SUBCLASSCHECK__, TS_ENCODING)) {
894823
return Subclasscheck;
895824
}
896-
if (eqNode.execute(name, T___SUB__, TS_ENCODING)) {
897-
return Sub;
898-
}
899825
break;
900826
case 'c' * 26 + 'a': // ca
901827
if (eqNode.execute(name, T___CALL__, TS_ENCODING)) {
@@ -934,9 +860,6 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
934860
if (eqNode.execute(name, T___FLOAT__, TS_ENCODING)) {
935861
return Float;
936862
}
937-
if (eqNode.execute(name, T___FLOORDIV__, TS_ENCODING)) {
938-
return FloorDiv;
939-
}
940863
break;
941864
case 's' * 26 + 't': // st
942865
if (eqNode.execute(name, T___STR__, TS_ENCODING)) {
@@ -977,72 +900,15 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
977900
}
978901
break;
979902
case 'a' * 26 + 'n': // an
980-
if (eqNode.execute(name, T___AND__, TS_ENCODING)) {
981-
return And;
982-
}
983903
if (eqNode.execute(name, T___ANEXT__, TS_ENCODING)) {
984904
return ANext;
985905
}
986906
break;
987-
case 'r' * 26 + 'a': // ra
988-
if (eqNode.execute(name, T___RAND__, TS_ENCODING)) {
989-
return RAnd;
990-
}
991-
break;
992-
case 'o' * 26 + 'r': // or
993-
if (eqNode.execute(name, T___OR__, TS_ENCODING)) {
994-
return Or;
995-
}
996-
break;
997907
case 'r' * 26 + 'o': // ro
998-
if (eqNode.execute(name, T___ROR__, TS_ENCODING)) {
999-
return ROr;
1000-
}
1001908
if (eqNode.execute(name, T___ROUND__, TS_ENCODING)) {
1002909
return Round;
1003910
}
1004911
break;
1005-
case 'x' * 26 + 'o': // xo
1006-
if (eqNode.execute(name, T___XOR__, TS_ENCODING)) {
1007-
return Xor;
1008-
}
1009-
break;
1010-
case 'r' * 26 + 'x': // rx
1011-
if (eqNode.execute(name, T___RXOR__, TS_ENCODING)) {
1012-
return RXor;
1013-
}
1014-
break;
1015-
case 'r' * 26 + 's': // rs
1016-
if (eqNode.execute(name, T___RSUB__, TS_ENCODING)) {
1017-
return RSub;
1018-
}
1019-
if (eqNode.execute(name, T___RSHIFT__, TS_ENCODING)) {
1020-
return RShift;
1021-
}
1022-
break;
1023-
case 'r' * 26 + 'm': // rm
1024-
if (eqNode.execute(name, T___RMATMUL__, TS_ENCODING)) {
1025-
return RMatMul;
1026-
}
1027-
if (eqNode.execute(name, T___RMOD__, TS_ENCODING)) {
1028-
return RMod;
1029-
}
1030-
break;
1031-
case 'm' * 26 + 'a': // ma
1032-
if (eqNode.execute(name, T___MATMUL__, TS_ENCODING)) {
1033-
return MatMul;
1034-
}
1035-
break;
1036-
case 'm' * 26 + 'o': // mo
1037-
if (eqNode.execute(name, T___MOD__, TS_ENCODING)) {
1038-
return Mod;
1039-
}
1040-
break;
1041-
case 'r' * 26 + 'd': // rd
1042-
if (eqNode.execute(name, T___RDIVMOD__, TS_ENCODING)) {
1043-
return RDivMod;
1044-
}
1045-
break;
1046912
case 'p' * 26 + 'o': // po
1047913
if (eqNode.execute(name, T___POW__, TS_ENCODING)) {
1048914
return Pow;
@@ -1053,36 +919,6 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
1053919
return RPow;
1054920
}
1055921
break;
1056-
case 't' * 26 + 'r': // tr
1057-
if (eqNode.execute(name, T___TRUEDIV__, TS_ENCODING)) {
1058-
return TrueDiv;
1059-
}
1060-
break;
1061-
case 'r' * 26 + 't': // rt
1062-
if (eqNode.execute(name, T___RTRUEDIV__, TS_ENCODING)) {
1063-
return RTrueDiv;
1064-
}
1065-
break;
1066-
case 'r' * 26 + 'f': // rf
1067-
if (eqNode.execute(name, T___RFLOORDIV__, TS_ENCODING)) {
1068-
return RFloorDiv;
1069-
}
1070-
break;
1071-
case 'l' * 26 + 's': // ls
1072-
if (eqNode.execute(name, T___LSHIFT__, TS_ENCODING)) {
1073-
return LShift;
1074-
}
1075-
break;
1076-
case 'r' * 26 + 'l': // rl
1077-
if (eqNode.execute(name, T___RLSHIFT__, TS_ENCODING)) {
1078-
return RLShift;
1079-
}
1080-
break;
1081-
case 'r' * 26 + 'r': // rr
1082-
if (eqNode.execute(name, T___RRSHIFT__, TS_ENCODING)) {
1083-
return RRShift;
1084-
}
1085-
break;
1086922
case 'i' * 26 + 'a': // ia
1087923
if (eqNode.execute(name, T___IADD__, TS_ENCODING)) {
1088924
return IAdd;

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -113,11 +113,6 @@ public static LookupAndCallBinaryNode createReversible(SpecialMethodSlot slot, S
113113
return LookupAndCallReversibleBinaryNodeGen.create(slot, rslot, handlerFactory, false, false);
114114
}
115115

116-
@NeverDefault
117-
public static LookupAndCallBinaryNode createBinaryOp(SpecialMethodSlot slot, SpecialMethodSlot rslot, Supplier<NotImplementedHandler> handlerFactory) {
118-
return LookupAndCallNbNumbersBinaryNodeFactory.BinaryOpNodeGen.create(slot, rslot, handlerFactory);
119-
}
120-
121116
@NeverDefault
122117
public static LookupAndCallBinaryNode create(SpecialMethodSlot slot, SpecialMethodSlot rslot, boolean alwaysCheckReverse, boolean ignoreDescriptorException) {
123118
return LookupAndCallReversibleBinaryNodeGen.create(slot, rslot, null, alwaysCheckReverse, ignoreDescriptorException);
@@ -199,8 +194,6 @@ static Object doOthers(@SuppressWarnings("unused") Object callable) {
199194

200195
public abstract TruffleString getName();
201196

202-
public abstract TruffleString getRname();
203-
204197
protected final CallBinaryMethodNode ensureDispatch() {
205198
// this also serves as a branch profile
206199
if (dispatchNode == null) {

0 commit comments

Comments
 (0)