1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* The Universal Permissive License (UPL), Version 1.0
44
44
import static com .oracle .graal .python .builtins .objects .type .MethodsFlags .AM_ANEXT ;
45
45
import static com .oracle .graal .python .builtins .objects .type .MethodsFlags .AM_AWAIT ;
46
46
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 ;
49
47
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 ;
51
48
import static com .oracle .graal .python .builtins .objects .type .MethodsFlags .NB_INDEX ;
52
49
import static com .oracle .graal .python .builtins .objects .type .MethodsFlags .NB_INPLACE_ADD ;
53
50
import static com .oracle .graal .python .builtins .objects .type .MethodsFlags .NB_INPLACE_MULTIPLY ;
54
51
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 ;
58
52
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 ;
64
53
import static com .oracle .graal .python .builtins .objects .type .MethodsFlags .SQ_ASS_ITEM ;
65
54
import static com .oracle .graal .python .builtins .objects .type .MethodsFlags .SQ_CONTAINS ;
66
55
import static com .oracle .graal .python .builtins .objects .type .SpecialMethodSlot .Flags .NO_BUILTIN_DESCRIPTORS ;
69
58
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___AENTER__ ;
70
59
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___AEXIT__ ;
71
60
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___AITER__ ;
72
- import static com .oracle .graal .python .nodes .SpecialMethodNames .T___AND__ ;
73
61
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___ANEXT__ ;
74
62
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___AWAIT__ ;
75
63
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___BYTES__ ;
76
64
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___CALL__ ;
77
65
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___CONTAINS__ ;
78
66
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___DELATTR__ ;
79
67
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___DELITEM__ ;
80
- import static com .oracle .graal .python .nodes .SpecialMethodNames .T___DIVMOD__ ;
81
68
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___ENTER__ ;
82
69
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___EQ__ ;
83
70
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___EXIT__ ;
84
71
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___FLOAT__ ;
85
- import static com .oracle .graal .python .nodes .SpecialMethodNames .T___FLOORDIV__ ;
86
72
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___FORMAT__ ;
87
73
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___GE__ ;
88
74
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___GT__ ;
96
82
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___ITER__ ;
97
83
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___LENGTH_HINT__ ;
98
84
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___LE__ ;
99
- import static com .oracle .graal .python .nodes .SpecialMethodNames .T___LSHIFT__ ;
100
85
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___LT__ ;
101
- import static com .oracle .graal .python .nodes .SpecialMethodNames .T___MATMUL__ ;
102
86
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___MISSING__ ;
103
- import static com .oracle .graal .python .nodes .SpecialMethodNames .T___MOD__ ;
104
87
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___NEW__ ;
105
88
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___NEXT__ ;
106
89
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___NE__ ;
107
- import static com .oracle .graal .python .nodes .SpecialMethodNames .T___OR__ ;
108
90
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__ ;
111
91
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___REPR__ ;
112
92
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__ ;
118
93
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___ROUND__ ;
119
94
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__ ;
125
95
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___SETITEM__ ;
126
96
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___SET_NAME__ ;
127
97
import static com .oracle .graal .python .nodes .SpecialMethodNames .T___STR__ ;
128
98
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__ ;
132
99
import static com .oracle .graal .python .util .PythonUtils .TS_ENCODING ;
133
100
import static com .oracle .graal .python .util .PythonUtils .tsLiteral ;
134
101
@@ -243,32 +210,8 @@ public enum SpecialMethodSlot {
243
210
Gt (T___GT__ ),
244
211
Ge (T___GE__ ),
245
212
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 ),
262
213
Pow (T___POW__ , NB_POWER ),
263
214
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 ),
272
215
Round (T___ROUND__ ),
273
216
274
217
IAdd (T___IADD__ , NB_INPLACE_ADD ),
@@ -323,18 +266,7 @@ static class Flags {
323
266
}
324
267
325
268
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 ;
336
269
Pow .reverse = RPow ;
337
- Mod .reverse = RMod ;
338
270
assert checkFind ();
339
271
assert checkReverseSlots ();
340
272
}
@@ -855,9 +787,6 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
855
787
if (eqNode .execute (name , T___DICT__ , TS_ENCODING )) {
856
788
return Dict ;
857
789
}
858
- if (eqNode .execute (name , T___DIVMOD__ , TS_ENCODING )) {
859
- return DivMod ;
860
- }
861
790
break ;
862
791
case 'i' * 26 + 't' : // it
863
792
if (eqNode .execute (name , T___ITER__ , TS_ENCODING )) {
@@ -893,9 +822,6 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
893
822
if (eqNode .execute (name , T___SUBCLASSCHECK__ , TS_ENCODING )) {
894
823
return Subclasscheck ;
895
824
}
896
- if (eqNode .execute (name , T___SUB__ , TS_ENCODING )) {
897
- return Sub ;
898
- }
899
825
break ;
900
826
case 'c' * 26 + 'a' : // ca
901
827
if (eqNode .execute (name , T___CALL__ , TS_ENCODING )) {
@@ -934,9 +860,6 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
934
860
if (eqNode .execute (name , T___FLOAT__ , TS_ENCODING )) {
935
861
return Float ;
936
862
}
937
- if (eqNode .execute (name , T___FLOORDIV__ , TS_ENCODING )) {
938
- return FloorDiv ;
939
- }
940
863
break ;
941
864
case 's' * 26 + 't' : // st
942
865
if (eqNode .execute (name , T___STR__ , TS_ENCODING )) {
@@ -977,72 +900,15 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
977
900
}
978
901
break ;
979
902
case 'a' * 26 + 'n' : // an
980
- if (eqNode .execute (name , T___AND__ , TS_ENCODING )) {
981
- return And ;
982
- }
983
903
if (eqNode .execute (name , T___ANEXT__ , TS_ENCODING )) {
984
904
return ANext ;
985
905
}
986
906
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 ;
997
907
case 'r' * 26 + 'o' : // ro
998
- if (eqNode .execute (name , T___ROR__ , TS_ENCODING )) {
999
- return ROr ;
1000
- }
1001
908
if (eqNode .execute (name , T___ROUND__ , TS_ENCODING )) {
1002
909
return Round ;
1003
910
}
1004
911
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 ;
1046
912
case 'p' * 26 + 'o' : // po
1047
913
if (eqNode .execute (name , T___POW__ , TS_ENCODING )) {
1048
914
return Pow ;
@@ -1053,36 +919,6 @@ public static SpecialMethodSlot findSpecialSlot(TruffleString name, TruffleStrin
1053
919
return RPow ;
1054
920
}
1055
921
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 ;
1086
922
case 'i' * 26 + 'a' : // ia
1087
923
if (eqNode .execute (name , T___IADD__ , TS_ENCODING )) {
1088
924
return IAdd ;
0 commit comments