52
52
import com .oracle .graal .python .builtins .objects .function .BuiltinMethodDescriptor ;
53
53
import com .oracle .graal .python .builtins .objects .function .BuiltinMethodDescriptor .BinaryBuiltinDescriptor ;
54
54
import com .oracle .graal .python .builtins .objects .function .BuiltinMethodDescriptor .UnaryBuiltinDescriptor ;
55
- import com .oracle .graal .python .builtins .objects .function .PArguments ;
56
55
import com .oracle .graal .python .builtins .objects .function .PBuiltinFunction ;
57
56
import com .oracle .graal .python .builtins .objects .function .PKeyword ;
58
57
import com .oracle .graal .python .builtins .objects .function .Signature ;
72
71
import com .oracle .truffle .api .dsl .Bind ;
73
72
import com .oracle .truffle .api .dsl .Cached ;
74
73
import 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 ;
79
74
import com .oracle .truffle .api .interop .ArityException ;
80
75
import com .oracle .truffle .api .interop .InteropLibrary ;
81
76
import com .oracle .truffle .api .interop .TruffleObject ;
84
79
import com .oracle .truffle .api .library .CachedLibrary ;
85
80
import com .oracle .truffle .api .library .ExportLibrary ;
86
81
import com .oracle .truffle .api .library .ExportMessage ;
87
- import com .oracle .truffle .api .nodes .DirectCallNode ;
88
82
import com .oracle .truffle .api .nodes .Node ;
89
83
import com .oracle .truffle .api .strings .TruffleString ;
90
84
import com .oracle .truffle .nfi .api .SignatureLibrary ;
@@ -247,34 +241,6 @@ public static PyCFunctionWrapper createFromBuiltinFunction(CApiContext cApiConte
247
241
}
248
242
}
249
243
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
-
278
244
@ ExportLibrary (InteropLibrary .class )
279
245
static final class PyCFunctionUnaryWrapper extends PyCFunctionWrapper {
280
246
@@ -292,7 +258,7 @@ Object execute(Object[] arguments,
292
258
@ Cached PythonToNativeNewRefNode toNativeNode ,
293
259
@ Cached CallUnaryMethodNode callUnaryNode ,
294
260
@ Cached CreateAndCheckArgumentsNode createArgsNode ,
295
- @ Cached CallTargetDispatchNode invokeNode ,
261
+ @ Cached CallDispatchers . CallTargetCachedInvokeNode invokeNode ,
296
262
@ Cached NativeToPythonNode toJavaNode ,
297
263
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
298
264
@ Exclusive @ Cached GilNode gil ) throws ArityException {
@@ -318,7 +284,7 @@ Object execute(Object[] arguments,
318
284
assert callTargetName != null ;
319
285
Object [] pArgs = createArgsNode .execute (inliningTarget , callTargetName , PythonUtils .EMPTY_OBJECT_ARRAY , PKeyword .EMPTY_KEYWORDS , signature , jArg0 , null ,
320
286
PythonUtils .EMPTY_OBJECT_ARRAY , PKeyword .EMPTY_KEYWORDS , false );
321
- result = invokeNode .execute (inliningTarget , callTarget , pArgs );
287
+ result = invokeNode .execute (null , inliningTarget , callTarget , pArgs );
322
288
}
323
289
return toNativeNode .execute (result );
324
290
} catch (Throwable t ) {
@@ -360,7 +326,7 @@ Object execute(Object[] arguments,
360
326
@ Bind ("$node" ) Node inliningTarget ,
361
327
@ Cached PythonToNativeNewRefNode toNativeNode ,
362
328
@ Cached CallBinaryMethodNode callBinaryMethodNode ,
363
- @ Cached CallTargetDispatchNode invokeNode ,
329
+ @ Cached CallDispatchers . CallTargetCachedInvokeNode invokeNode ,
364
330
@ Cached CreateAndCheckArgumentsNode createArgsNode ,
365
331
@ Cached NativeToPythonNode toJavaNode ,
366
332
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -385,7 +351,7 @@ Object execute(Object[] arguments,
385
351
assert callTargetName != null ;
386
352
Object [] pArgs = createArgsNode .execute (inliningTarget , callTargetName , new Object []{jArg1 }, PKeyword .EMPTY_KEYWORDS , signature , jArg0 , null ,
387
353
PythonUtils .EMPTY_OBJECT_ARRAY , PKeyword .EMPTY_KEYWORDS , false );
388
- result = invokeNode .execute (inliningTarget , callTarget , pArgs );
354
+ result = invokeNode .execute (null , inliningTarget , callTarget , pArgs );
389
355
}
390
356
return toNativeNode .execute (result );
391
357
} catch (Throwable t ) {
@@ -438,7 +404,7 @@ Object execute(Object[] arguments,
438
404
@ Cached PythonToNativeNewRefNode toNativeNode ,
439
405
@ Cached ExecutePositionalStarargsNode posStarargsNode ,
440
406
@ Cached CreateAndCheckArgumentsNode createArgsNode ,
441
- @ Cached CallTargetDispatchNode invokeNode ,
407
+ @ Cached CallDispatchers . CallTargetCachedInvokeNode invokeNode ,
442
408
@ Cached NativeToPythonNode toJavaNode ,
443
409
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
444
410
@ Exclusive @ Cached GilNode gil ) throws ArityException {
@@ -459,7 +425,7 @@ Object execute(Object[] arguments,
459
425
Object [] starArgsArray = posStarargsNode .executeWith (null , starArgs );
460
426
Object [] pArgs = createArgsNode .execute (inliningTarget , callTargetName , starArgsArray , PKeyword .EMPTY_KEYWORDS , signature , receiver , null ,
461
427
PBuiltinFunction .generateDefaults (numDefaults ), PKeyword .EMPTY_KEYWORDS , false );
462
- result = invokeNode .execute (inliningTarget , callTarget , pArgs );
428
+ result = invokeNode .execute (null , inliningTarget , callTarget , pArgs );
463
429
return toNativeNode .execute (result );
464
430
} catch (Throwable t ) {
465
431
throw checkThrowableBeforeNative (t , toString (), "" );
@@ -504,7 +470,7 @@ Object execute(Object[] arguments,
504
470
@ Cached PythonToNativeNewRefNode toNativeNode ,
505
471
@ Cached ExecutePositionalStarargsNode posStarargsNode ,
506
472
@ Cached CreateAndCheckArgumentsNode createArgsNode ,
507
- @ Cached CallTargetDispatchNode invokeNode ,
473
+ @ Cached CallDispatchers . CallTargetCachedInvokeNode invokeNode ,
508
474
@ Cached ExpandKeywordStarargsNode expandKwargsNode ,
509
475
@ Cached NativeToPythonNode toJavaNode ,
510
476
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -529,7 +495,7 @@ Object execute(Object[] arguments,
529
495
PKeyword [] kwArgsArray = expandKwargsNode .execute (inliningTarget , kwArgs );
530
496
Object [] pArgs = createArgsNode .execute (inliningTarget , callTargetName , starArgsArray , kwArgsArray , signature , receiver , null , PBuiltinFunction .generateDefaults (numDefaults ),
531
497
PKeyword .EMPTY_KEYWORDS , false );
532
- Object result = invokeNode .execute (inliningTarget , callTarget , pArgs );
498
+ Object result = invokeNode .execute (null , inliningTarget , callTarget , pArgs );
533
499
return toNativeNode .execute (result );
534
500
} catch (Throwable t ) {
535
501
throw checkThrowableBeforeNative (t , toString (), "" );
0 commit comments