5252import com .oracle .graal .python .builtins .objects .function .BuiltinMethodDescriptor ;
5353import com .oracle .graal .python .builtins .objects .function .BuiltinMethodDescriptor .BinaryBuiltinDescriptor ;
5454import com .oracle .graal .python .builtins .objects .function .BuiltinMethodDescriptor .UnaryBuiltinDescriptor ;
55- import com .oracle .graal .python .builtins .objects .function .PArguments ;
5655import com .oracle .graal .python .builtins .objects .function .PBuiltinFunction ;
5756import com .oracle .graal .python .builtins .objects .function .PKeyword ;
5857import com .oracle .graal .python .builtins .objects .function .Signature ;
7271import com .oracle .truffle .api .dsl .Bind ;
7372import com .oracle .truffle .api .dsl .Cached ;
7473import com .oracle .truffle .api .dsl .Cached .Exclusive ;
75- import com .oracle .truffle .api .dsl .GenerateCached ;
76- import com .oracle .truffle .api .dsl .GenerateInline ;
77- import com .oracle .truffle .api .dsl .GenerateUncached ;
78- import com .oracle .truffle .api .dsl .Specialization ;
7974import com .oracle .truffle .api .interop .ArityException ;
8075import com .oracle .truffle .api .interop .InteropLibrary ;
8176import com .oracle .truffle .api .interop .TruffleObject ;
8479import com .oracle .truffle .api .library .CachedLibrary ;
8580import com .oracle .truffle .api .library .ExportLibrary ;
8681import com .oracle .truffle .api .library .ExportMessage ;
87- import com .oracle .truffle .api .nodes .DirectCallNode ;
8882import com .oracle .truffle .api .nodes .Node ;
8983import com .oracle .truffle .api .strings .TruffleString ;
9084import com .oracle .truffle .nfi .api .SignatureLibrary ;
@@ -247,34 +241,6 @@ public static PyCFunctionWrapper createFromBuiltinFunction(CApiContext cApiConte
247241 }
248242 }
249243
250- @ GenerateUncached
251- @ GenerateInline
252- @ GenerateCached (false )
253- // TODO move, use in eval etc?
254- abstract static class CallTargetDispatchNode extends Node {
255-
256- abstract Object execute (Node inliningTarget , RootCallTarget ct , Object [] pythonArguments );
257-
258- @ Specialization (guards = "sameCallTarget(callTarget, callNode)" , limit = "1" )
259- static Object doCallTargetDirect (Node inliningTarget , @ SuppressWarnings ("unused" ) RootCallTarget callTarget , Object [] args ,
260- @ Cached (parameters = "callTarget" ) DirectCallNode callNode ,
261- @ Cached CallDispatchers .SimpleDirectInvokeNode invoke ) {
262- assert PArguments .isPythonFrame (args );
263- return invoke .execute (null , inliningTarget , callNode , args );
264- }
265-
266- @ Specialization (replaces = "doCallTargetDirect" )
267- static Object doCallTargetIndirect (Node inliningTarget , RootCallTarget ct , Object [] args ,
268- @ Cached CallDispatchers .SimpleIndirectInvokeNode invoke ) {
269- assert PArguments .isPythonFrame (args );
270- return invoke .execute (null , inliningTarget , ct , args );
271- }
272-
273- protected static boolean sameCallTarget (RootCallTarget callTarget , DirectCallNode callNode ) {
274- return callTarget == callNode .getCallTarget ();
275- }
276- }
277-
278244 @ ExportLibrary (InteropLibrary .class )
279245 static final class PyCFunctionUnaryWrapper extends PyCFunctionWrapper {
280246
@@ -292,7 +258,7 @@ Object execute(Object[] arguments,
292258 @ Cached PythonToNativeNewRefNode toNativeNode ,
293259 @ Cached CallUnaryMethodNode callUnaryNode ,
294260 @ Cached CreateAndCheckArgumentsNode createArgsNode ,
295- @ Cached CallTargetDispatchNode invokeNode ,
261+ @ Cached CallDispatchers . CallTargetCachedInvokeNode invokeNode ,
296262 @ Cached NativeToPythonNode toJavaNode ,
297263 @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
298264 @ Exclusive @ Cached GilNode gil ) throws ArityException {
@@ -318,7 +284,7 @@ Object execute(Object[] arguments,
318284 assert callTargetName != null ;
319285 Object [] pArgs = createArgsNode .execute (inliningTarget , callTargetName , PythonUtils .EMPTY_OBJECT_ARRAY , PKeyword .EMPTY_KEYWORDS , signature , jArg0 , null ,
320286 PythonUtils .EMPTY_OBJECT_ARRAY , PKeyword .EMPTY_KEYWORDS , false );
321- result = invokeNode .execute (inliningTarget , callTarget , pArgs );
287+ result = invokeNode .execute (null , inliningTarget , callTarget , pArgs );
322288 }
323289 return toNativeNode .execute (result );
324290 } catch (Throwable t ) {
@@ -360,7 +326,7 @@ Object execute(Object[] arguments,
360326 @ Bind ("$node" ) Node inliningTarget ,
361327 @ Cached PythonToNativeNewRefNode toNativeNode ,
362328 @ Cached CallBinaryMethodNode callBinaryMethodNode ,
363- @ Cached CallTargetDispatchNode invokeNode ,
329+ @ Cached CallDispatchers . CallTargetCachedInvokeNode invokeNode ,
364330 @ Cached CreateAndCheckArgumentsNode createArgsNode ,
365331 @ Cached NativeToPythonNode toJavaNode ,
366332 @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -385,7 +351,7 @@ Object execute(Object[] arguments,
385351 assert callTargetName != null ;
386352 Object [] pArgs = createArgsNode .execute (inliningTarget , callTargetName , new Object []{jArg1 }, PKeyword .EMPTY_KEYWORDS , signature , jArg0 , null ,
387353 PythonUtils .EMPTY_OBJECT_ARRAY , PKeyword .EMPTY_KEYWORDS , false );
388- result = invokeNode .execute (inliningTarget , callTarget , pArgs );
354+ result = invokeNode .execute (null , inliningTarget , callTarget , pArgs );
389355 }
390356 return toNativeNode .execute (result );
391357 } catch (Throwable t ) {
@@ -438,7 +404,7 @@ Object execute(Object[] arguments,
438404 @ Cached PythonToNativeNewRefNode toNativeNode ,
439405 @ Cached ExecutePositionalStarargsNode posStarargsNode ,
440406 @ Cached CreateAndCheckArgumentsNode createArgsNode ,
441- @ Cached CallTargetDispatchNode invokeNode ,
407+ @ Cached CallDispatchers . CallTargetCachedInvokeNode invokeNode ,
442408 @ Cached NativeToPythonNode toJavaNode ,
443409 @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
444410 @ Exclusive @ Cached GilNode gil ) throws ArityException {
@@ -459,7 +425,7 @@ Object execute(Object[] arguments,
459425 Object [] starArgsArray = posStarargsNode .executeWith (null , starArgs );
460426 Object [] pArgs = createArgsNode .execute (inliningTarget , callTargetName , starArgsArray , PKeyword .EMPTY_KEYWORDS , signature , receiver , null ,
461427 PBuiltinFunction .generateDefaults (numDefaults ), PKeyword .EMPTY_KEYWORDS , false );
462- result = invokeNode .execute (inliningTarget , callTarget , pArgs );
428+ result = invokeNode .execute (null , inliningTarget , callTarget , pArgs );
463429 return toNativeNode .execute (result );
464430 } catch (Throwable t ) {
465431 throw checkThrowableBeforeNative (t , toString (), "" );
@@ -504,7 +470,7 @@ Object execute(Object[] arguments,
504470 @ Cached PythonToNativeNewRefNode toNativeNode ,
505471 @ Cached ExecutePositionalStarargsNode posStarargsNode ,
506472 @ Cached CreateAndCheckArgumentsNode createArgsNode ,
507- @ Cached CallTargetDispatchNode invokeNode ,
473+ @ Cached CallDispatchers . CallTargetCachedInvokeNode invokeNode ,
508474 @ Cached ExpandKeywordStarargsNode expandKwargsNode ,
509475 @ Cached NativeToPythonNode toJavaNode ,
510476 @ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -529,7 +495,7 @@ Object execute(Object[] arguments,
529495 PKeyword [] kwArgsArray = expandKwargsNode .execute (inliningTarget , kwArgs );
530496 Object [] pArgs = createArgsNode .execute (inliningTarget , callTargetName , starArgsArray , kwArgsArray , signature , receiver , null , PBuiltinFunction .generateDefaults (numDefaults ),
531497 PKeyword .EMPTY_KEYWORDS , false );
532- Object result = invokeNode .execute (inliningTarget , callTarget , pArgs );
498+ Object result = invokeNode .execute (null , inliningTarget , callTarget , pArgs );
533499 return toNativeNode .execute (result );
534500 } catch (Throwable t ) {
535501 throw checkThrowableBeforeNative (t , toString (), "" );
0 commit comments