66
66
import com .oracle .graal .python .util .PythonUtils ;
67
67
import com .oracle .truffle .api .CompilerDirectives ;
68
68
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
69
- import com .oracle .truffle .api .TruffleLogger ;
70
69
import com .oracle .truffle .api .dsl .Cached ;
71
70
import com .oracle .truffle .api .dsl .Cached .Exclusive ;
72
71
import com .oracle .truffle .api .dsl .Specialization ;
83
82
@ ExportLibrary (value = NativeTypeLibrary .class , useForAOT = false )
84
83
public abstract class PyProcsWrapper extends PythonNativeWrapper {
85
84
86
- private static final TruffleLogger LOGGER = CApiContext .getLogger (PyProcsWrapper .class );
87
-
88
85
protected final CApiTiming timing ;
89
86
90
87
public PyProcsWrapper (Object delegate ) {
@@ -100,8 +97,7 @@ protected boolean isExecutable() {
100
97
@ ExportMessage
101
98
@ SuppressWarnings ({"unused" , "static-method" })
102
99
protected Object execute (Object [] arguments ) throws UnsupportedTypeException , ArityException , UnsupportedMessageException {
103
- CompilerDirectives .transferToInterpreterAndInvalidate ();
104
- throw new IllegalStateException ("should not reach" );
100
+ throw CompilerDirectives .shouldNotReachHere ("abstract class" );
105
101
}
106
102
107
103
@ ExportMessage
@@ -147,7 +143,7 @@ public GetAttrWrapper(Object delegate) {
147
143
148
144
@ ExportMessage
149
145
protected Object execute (Object [] arguments ,
150
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
146
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
151
147
@ Cached CallBinaryMethodNode executeNode ,
152
148
@ Cached NativeToPythonNode toJavaNode ,
153
149
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -160,7 +156,7 @@ protected Object execute(Object[] arguments,
160
156
throw ArityException .create (2 , 2 , arguments .length );
161
157
}
162
158
try {
163
- return PythonToNativeTransferNode .execute (executeNode .executeObject (null , getDelegate (), toJavaNode .execute (arguments [0 ]), toJavaNode .execute (arguments [1 ])));
159
+ return toNativeNode .execute (executeNode .executeObject (null , getDelegate (), toJavaNode .execute (arguments [0 ]), toJavaNode .execute (arguments [1 ])));
164
160
} catch (Throwable t ) {
165
161
throw checkThrowableBeforeNative (t , "GetAttrWrapper" , getDelegate ());
166
162
}
@@ -188,7 +184,7 @@ public BinaryFuncWrapper(Object delegate) {
188
184
189
185
@ ExportMessage
190
186
protected Object execute (Object [] arguments ,
191
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
187
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
192
188
@ Cached CallBinaryMethodNode executeNode ,
193
189
@ Cached NativeToPythonNode toJavaNode ,
194
190
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -201,7 +197,7 @@ protected Object execute(Object[] arguments,
201
197
throw ArityException .create (2 , 2 , arguments .length );
202
198
}
203
199
try {
204
- return PythonToNativeTransferNode .execute (executeNode .executeObject (null , getDelegate (), toJavaNode .execute (arguments [0 ]), toJavaNode .execute (arguments [1 ])));
200
+ return toNativeNode .execute (executeNode .executeObject (null , getDelegate (), toJavaNode .execute (arguments [0 ]), toJavaNode .execute (arguments [1 ])));
205
201
} catch (Throwable t ) {
206
202
throw checkThrowableBeforeNative (t , "BinaryFuncWrapper" , getDelegate ());
207
203
}
@@ -229,7 +225,7 @@ public UnaryFuncWrapper(Object delegate) {
229
225
230
226
@ ExportMessage
231
227
protected Object execute (Object [] arguments ,
232
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
228
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
233
229
@ Cached CallUnaryMethodNode executeNode ,
234
230
@ Cached NativeToPythonNode toJavaNode ,
235
231
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -246,7 +242,7 @@ protected Object execute(Object[] arguments,
246
242
throw ArityException .create (1 , 2 , arguments .length );
247
243
}
248
244
try {
249
- return PythonToNativeTransferNode .execute (executeNode .executeObject (null , getDelegate (), toJavaNode .execute (arguments [0 ])));
245
+ return toNativeNode .execute (executeNode .executeObject (null , getDelegate (), toJavaNode .execute (arguments [0 ])));
250
246
} catch (Throwable t ) {
251
247
throw checkThrowableBeforeNative (t , "UnaryFuncWrapper" , getDelegate ());
252
248
}
@@ -416,7 +412,7 @@ static class Execute {
416
412
417
413
@ Specialization (guards = "arguments.length == 2" )
418
414
static Object init (VarargWrapper self , Object [] arguments ,
419
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
415
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
420
416
@ Cached ExecutePositionalStarargsNode posStarargsNode ,
421
417
@ Cached CallVarargsMethodNode callNode ,
422
418
@ Cached NativeToPythonNode toJavaNode ,
@@ -432,7 +428,7 @@ static Object init(VarargWrapper self, Object[] arguments,
432
428
433
429
Object [] starArgsArray = posStarargsNode .executeWith (null , starArgs );
434
430
Object [] pArgs = PythonUtils .prependArgument (receiver , starArgsArray );
435
- return PythonToNativeTransferNode .execute (callNode .execute (null , self .getDelegate (), pArgs , PKeyword .EMPTY_KEYWORDS ));
431
+ return toNativeNode .execute (callNode .execute (null , self .getDelegate (), pArgs , PKeyword .EMPTY_KEYWORDS ));
436
432
} catch (Throwable t ) {
437
433
throw checkThrowableBeforeNative (t , "VarargWrapper" , self .getDelegate ());
438
434
}
@@ -470,7 +466,7 @@ static class Execute {
470
466
471
467
@ Specialization (guards = "arguments.length == 3" )
472
468
static Object init (VarargKeywordWrapper self , Object [] arguments ,
473
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
469
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
474
470
@ Cached ExecutePositionalStarargsNode posStarargsNode ,
475
471
@ Cached ExpandKeywordStarargsNode expandKwargsNode ,
476
472
@ Cached CallVarargsMethodNode callNode ,
@@ -489,7 +485,7 @@ static Object init(VarargKeywordWrapper self, Object[] arguments,
489
485
Object [] starArgsArray = posStarargsNode .executeWith (null , starArgs );
490
486
Object [] pArgs = PythonUtils .prependArgument (receiver , starArgsArray );
491
487
PKeyword [] kwArgsArray = expandKwargsNode .execute (kwArgs );
492
- return PythonToNativeTransferNode .execute (callNode .execute (null , self .getDelegate (), pArgs , kwArgsArray ));
488
+ return toNativeNode .execute (callNode .execute (null , self .getDelegate (), pArgs , kwArgsArray ));
493
489
} catch (Throwable t ) {
494
490
throw checkThrowableBeforeNative (t , "VarargKeywordWrapper" , self .getDelegate ());
495
491
}
@@ -531,7 +527,7 @@ static Object call(TernaryFunctionWrapper self, Object[] arguments,
531
527
@ Cached ExpandKeywordStarargsNode expandKwargsNode ,
532
528
@ Cached CallVarargsMethodNode callNode ,
533
529
@ Cached NativeToPythonNode toJavaNode ,
534
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
530
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
535
531
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
536
532
@ Exclusive @ Cached GilNode gil ) {
537
533
boolean mustRelease = gil .acquire ();
@@ -547,7 +543,7 @@ static Object call(TernaryFunctionWrapper self, Object[] arguments,
547
543
Object [] pArgs = PythonUtils .prependArgument (receiver , starArgsArray );
548
544
PKeyword [] kwArgsArray = expandKwargsNode .execute (kwArgs );
549
545
Object result = callNode .execute (null , self .getDelegate (), pArgs , kwArgsArray );
550
- return PythonToNativeTransferNode .execute (result );
546
+ return toNativeNode .execute (result );
551
547
} catch (Throwable t ) {
552
548
throw checkThrowableBeforeNative (t , "TernaryFunctionWrapper" , self .getDelegate ());
553
549
}
@@ -584,7 +580,7 @@ public RichcmpFunctionWrapper(Object delegate) {
584
580
protected Object execute (Object [] arguments ,
585
581
@ Cached NativeToPythonNode toJavaNode ,
586
582
@ Cached CallTernaryMethodNode callNode ,
587
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
583
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
588
584
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
589
585
@ Exclusive @ Cached GilNode gil ) throws ArityException {
590
586
boolean mustRelease = gil .acquire ();
@@ -601,7 +597,7 @@ protected Object execute(Object[] arguments,
601
597
Object arg2 = arguments [2 ];
602
598
603
599
Object result = callNode .execute (null , getDelegate (), arg0 , arg1 , arg2 );
604
- return PythonToNativeTransferNode .execute (result );
600
+ return toNativeNode .execute (result );
605
601
} catch (Throwable t ) {
606
602
throw checkThrowableBeforeNative (t , "RichcmpFunctionWrapper" , getDelegate ());
607
603
}
@@ -629,7 +625,7 @@ public SsizeargfuncWrapper(Object delegate) {
629
625
630
626
@ ExportMessage
631
627
protected Object execute (Object [] arguments ,
632
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
628
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
633
629
@ Cached CallBinaryMethodNode executeNode ,
634
630
@ Cached NativeToPythonNode toJavaNode ,
635
631
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
@@ -644,7 +640,7 @@ protected Object execute(Object[] arguments,
644
640
assert arguments [1 ] instanceof Number ;
645
641
try {
646
642
Object result = executeNode .executeObject (null , getDelegate (), toJavaNode .execute (arguments [0 ]), arguments [1 ]);
647
- return PythonToNativeTransferNode .execute (result );
643
+ return toNativeNode .execute (result );
648
644
} catch (Throwable t ) {
649
645
throw checkThrowableBeforeNative (t , "SsizeargfuncWrapper" , getDelegate ());
650
646
}
@@ -767,7 +763,7 @@ static class Execute {
767
763
static Object call (DescrGetFunctionWrapper self , Object [] arguments ,
768
764
@ Cached CallTernaryMethodNode callNode ,
769
765
@ Cached NativeToPythonNode toJavaNode ,
770
- @ Cached PythonToNativeNewRefNode PythonToNativeTransferNode ,
766
+ @ Cached PythonToNativeNewRefNode toNativeNode ,
771
767
@ Cached TransformExceptionToNativeNode transformExceptionToNativeNode ,
772
768
@ Exclusive @ Cached GilNode gil ) {
773
769
boolean mustRelease = gil .acquire ();
@@ -780,7 +776,7 @@ static Object call(DescrGetFunctionWrapper self, Object[] arguments,
780
776
Object cls = toJavaNode .execute (arguments [2 ]);
781
777
782
778
Object result = callNode .execute (null , self .getDelegate (), receiver , obj , cls );
783
- return PythonToNativeTransferNode .execute (result );
779
+ return toNativeNode .execute (result );
784
780
} catch (Throwable t ) {
785
781
throw checkThrowableBeforeNative (t , "DescrGetFunctionWrapper" , self .getDelegate ());
786
782
}
0 commit comments