@@ -150,10 +150,12 @@ protected Object execute(VirtualFrame frame, PythonCallable callee, Object[] arg
150
150
abstract class CallTargetInvokeNode extends AbstractInvokeNode {
151
151
@ Child private DirectCallNode callNode ;
152
152
@ Child private ArityCheckNode arityCheck = ArityCheckNode .create ();
153
+ private final Arity arity ;
153
154
protected final boolean isBuiltin ;
154
155
155
- protected CallTargetInvokeNode (CallTarget callTarget , boolean isBuiltin , boolean isGenerator ) {
156
+ protected CallTargetInvokeNode (CallTarget callTarget , Arity arity , boolean isBuiltin , boolean isGenerator ) {
156
157
this .callNode = Truffle .getRuntime ().createDirectCallNode (callTarget );
158
+ this .arity = arity ;
157
159
if (isBuiltin ) {
158
160
callNode .cloneCallTarget ();
159
161
}
@@ -167,13 +169,13 @@ protected CallTargetInvokeNode(CallTarget callTarget, boolean isBuiltin, boolean
167
169
public static CallTargetInvokeNode create (PythonCallable callee ) {
168
170
RootCallTarget callTarget = getCallTarget (callee );
169
171
boolean builtin = isBuiltin (callee );
170
- return CallTargetInvokeNodeGen .create (callTarget , builtin , callee .isGeneratorFunction ());
172
+ return CallTargetInvokeNodeGen .create (callTarget , callee . getArity (), builtin , callee .isGeneratorFunction ());
171
173
}
172
174
173
- public abstract Object execute (VirtualFrame frame , PythonObject globals , PCell [] closure , Arity arity , Object [] arguments , PKeyword [] keywords );
175
+ public abstract Object execute (VirtualFrame frame , PythonObject globals , PCell [] closure , Object [] arguments , PKeyword [] keywords );
174
176
175
177
@ Specialization (guards = {"keywords.length == 0" })
176
- protected Object doNoKeywords (VirtualFrame frame , PythonObject globals , PCell [] closure , Arity arity , Object [] arguments , PKeyword [] keywords ) {
178
+ protected Object doNoKeywords (VirtualFrame frame , PythonObject globals , PCell [] closure , Object [] arguments , PKeyword [] keywords ) {
177
179
PArguments .setGlobals (arguments , globals );
178
180
PArguments .setClosure (arguments , closure );
179
181
PArguments .setCallerFrame (arguments , getCallerFrame (frame , callNode .getCallTarget ()));
@@ -182,7 +184,7 @@ protected Object doNoKeywords(VirtualFrame frame, PythonObject globals, PCell[]
182
184
}
183
185
184
186
@ Specialization (guards = {"!isBuiltin" })
185
- protected Object doWithKeywords (VirtualFrame frame , PythonObject globals , PCell [] closure , Arity arity , Object [] arguments , PKeyword [] keywords ,
187
+ protected Object doWithKeywords (VirtualFrame frame , PythonObject globals , PCell [] closure , Object [] arguments , PKeyword [] keywords ,
186
188
@ Cached ("create()" ) ApplyKeywordsNode applyKeywords ) {
187
189
Object [] combined = applyKeywords .execute (arity , arguments , keywords );
188
190
PArguments .setGlobals (combined , globals );
@@ -193,7 +195,7 @@ protected Object doWithKeywords(VirtualFrame frame, PythonObject globals, PCell[
193
195
}
194
196
195
197
@ Specialization (guards = "isBuiltin" )
196
- protected Object doBuiltinWithKeywords (VirtualFrame frame , @ SuppressWarnings ("unused" ) PythonObject globals , @ SuppressWarnings ("unused" ) PCell [] closure , Arity arity , Object [] arguments ,
198
+ protected Object doBuiltinWithKeywords (VirtualFrame frame , @ SuppressWarnings ("unused" ) PythonObject globals , @ SuppressWarnings ("unused" ) PCell [] closure , Object [] arguments ,
197
199
PKeyword [] keywords ) {
198
200
PArguments .setKeywordArguments (arguments , keywords );
199
201
PArguments .setCallerFrame (arguments , getCallerFrame (frame , callNode .getCallTarget ()));
0 commit comments