51
51
import com .oracle .truffle .api .CompilerDirectives ;
52
52
import com .oracle .truffle .api .dsl .Cached ;
53
53
import com .oracle .truffle .api .dsl .GenerateUncached ;
54
+ import com .oracle .truffle .api .dsl .ImportStatic ;
55
+ import com .oracle .truffle .api .dsl .ReportPolymorphism ;
54
56
import com .oracle .truffle .api .dsl .Specialization ;
55
57
import com .oracle .truffle .api .frame .VirtualFrame ;
56
58
import com .oracle .truffle .api .library .CachedLibrary ;
57
59
import com .oracle .truffle .api .nodes .Node ;
58
60
import com .oracle .truffle .api .nodes .UnexpectedResultException ;
59
61
import com .oracle .truffle .api .profiles .ConditionProfile ;
60
62
63
+ @ ReportPolymorphism
61
64
public abstract class LookupAndCallUnaryNode extends Node {
62
65
63
66
public abstract static class NoAttributeHandler extends PNodeWithContext {
@@ -130,88 +133,88 @@ protected PythonUnaryBuiltinNode getBuiltin(Object receiver) {
130
133
// int
131
134
132
135
@ Specialization (guards = "function != null" , rewriteOn = UnexpectedResultException .class )
133
- int callInt (VirtualFrame frame , int receiver ,
136
+ static int callInt (VirtualFrame frame , int receiver ,
134
137
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) throws UnexpectedResultException {
135
138
return function .executeInt (frame , receiver );
136
139
}
137
140
138
141
@ Specialization (guards = "function != null" , rewriteOn = UnexpectedResultException .class )
139
- boolean callBool (VirtualFrame frame , int receiver ,
142
+ static boolean callBool (VirtualFrame frame , int receiver ,
140
143
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) throws UnexpectedResultException {
141
144
return function .executeBool (frame , receiver );
142
145
}
143
146
144
147
@ Specialization (guards = "function != null" )
145
- Object callObject (VirtualFrame frame , int receiver ,
148
+ static Object callObject (VirtualFrame frame , int receiver ,
146
149
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) {
147
150
return function .execute (frame , receiver );
148
151
}
149
152
150
153
// long
151
154
152
155
@ Specialization (guards = "function != null" , rewriteOn = UnexpectedResultException .class )
153
- long callInt (VirtualFrame frame , long receiver ,
156
+ static long callInt (VirtualFrame frame , long receiver ,
154
157
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) throws UnexpectedResultException {
155
158
return function .executeLong (frame , receiver );
156
159
}
157
160
158
161
@ Specialization (guards = "function != null" , rewriteOn = UnexpectedResultException .class )
159
- boolean callBool (VirtualFrame frame , long receiver ,
162
+ static boolean callBool (VirtualFrame frame , long receiver ,
160
163
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) throws UnexpectedResultException {
161
164
return function .executeBool (frame , receiver );
162
165
}
163
166
164
167
@ Specialization (guards = "function != null" )
165
- Object callObject (VirtualFrame frame , long receiver ,
168
+ static Object callObject (VirtualFrame frame , long receiver ,
166
169
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) {
167
170
return function .execute (frame , receiver );
168
171
}
169
172
170
173
// double
171
174
172
175
@ Specialization (guards = "function != null" , rewriteOn = UnexpectedResultException .class )
173
- double callInt (VirtualFrame frame , double receiver ,
176
+ static double callInt (VirtualFrame frame , double receiver ,
174
177
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) throws UnexpectedResultException {
175
178
return function .executeDouble (frame , receiver );
176
179
}
177
180
178
181
@ Specialization (guards = "function != null" , rewriteOn = UnexpectedResultException .class )
179
- boolean callBool (VirtualFrame frame , double receiver ,
182
+ static boolean callBool (VirtualFrame frame , double receiver ,
180
183
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) throws UnexpectedResultException {
181
184
return function .executeBool (frame , receiver );
182
185
}
183
186
184
187
@ Specialization (guards = "function != null" )
185
- Object callObject (VirtualFrame frame , double receiver ,
188
+ static Object callObject (VirtualFrame frame , double receiver ,
186
189
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) {
187
190
return function .execute (frame , receiver );
188
191
}
189
192
190
193
// bool
191
194
192
195
@ Specialization (guards = "function != null" , rewriteOn = UnexpectedResultException .class )
193
- boolean callBool (VirtualFrame frame , boolean receiver ,
196
+ static boolean callBool (VirtualFrame frame , boolean receiver ,
194
197
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) throws UnexpectedResultException {
195
198
return function .executeBool (frame , receiver );
196
199
}
197
200
198
201
@ Specialization (guards = "function != null" )
199
- Object callObject (VirtualFrame frame , boolean receiver ,
202
+ static Object callObject (VirtualFrame frame , boolean receiver ,
200
203
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) {
201
204
return function .execute (frame , receiver );
202
205
}
203
206
204
207
// PNone
205
208
206
209
@ Specialization (guards = "function != null" )
207
- Object callObject (VirtualFrame frame , PNone receiver ,
210
+ static Object callObject (VirtualFrame frame , PNone receiver ,
208
211
@ Cached ("getBuiltin(receiver)" ) PythonUnaryBuiltinNode function ) {
209
212
return function .execute (frame , receiver );
210
213
}
211
214
212
215
// Object
213
216
214
- @ Specialization ( limit = "3" )
217
+ @ Specialization
215
218
Object callObject (VirtualFrame frame , Object receiver ,
216
219
@ CachedLibrary ("receiver" ) PythonObjectLibrary lib ,
217
220
@ Cached ("create(name, ignoreDescriptorException)" ) LookupSpecialMethodNode getattr ,
@@ -236,7 +239,7 @@ public abstract static class LookupAndCallUnaryDynamicNode extends PNodeWithCont
236
239
237
240
public abstract Object executeObject (Object receiver , String name );
238
241
239
- @ Specialization (limit = "3 " )
242
+ @ Specialization (limit = "2 " )
240
243
static Object doObject (Object receiver , String name ,
241
244
@ CachedLibrary ("receiver" ) PythonObjectLibrary lib ,
242
245
@ Cached LookupSpecialMethodNode .Dynamic getattr ,
0 commit comments