113
113
import com .oracle .graal .python .runtime .object .PythonObjectFactory ;
114
114
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
115
115
import com .oracle .truffle .api .CompilerDirectives .ValueType ;
116
+ import com .oracle .truffle .api .HostCompilerDirectives .InliningCutoff ;
116
117
import com .oracle .truffle .api .dsl .Bind ;
117
118
import com .oracle .truffle .api .dsl .Cached ;
118
119
import com .oracle .truffle .api .dsl .Cached .Exclusive ;
@@ -168,6 +169,7 @@ static ComplexValue doComplex(PComplex v) {
168
169
}
169
170
170
171
@ Specialization (guards = "check.execute(inliningTarget, v)" , limit = "1" )
172
+ @ InliningCutoff
171
173
static ComplexValue doNative (@ SuppressWarnings ("unused" ) Node inliningTarget , PythonAbstractNativeObject v ,
172
174
@ SuppressWarnings ("unused" ) @ Cached PyComplexCheckNode check ,
173
175
@ Cached (inline = false ) CStructAccess .ReadDoubleNode read ) {
@@ -187,13 +189,15 @@ static ComplexValue doDouble(double v) {
187
189
}
188
190
189
191
@ Specialization (guards = "check.execute(inliningTarget, v)" , limit = "1" )
192
+ @ InliningCutoff
190
193
static ComplexValue doIntGeneric (Node inliningTarget , Object v ,
191
194
@ SuppressWarnings ("unused" ) @ Cached PyLongCheckNode check ,
192
195
@ Cached PyLongAsDoubleNode longAsDoubleNode ) {
193
196
return new ComplexValue (longAsDoubleNode .execute (inliningTarget , v ), 0 );
194
197
}
195
198
196
199
@ Specialization (guards = "check.execute(inliningTarget, v)" , limit = "1" )
200
+ @ InliningCutoff
197
201
static ComplexValue doFloatGeneric (Node inliningTarget , Object v ,
198
202
@ SuppressWarnings ("unused" ) @ Cached PyFloatCheckNode check ,
199
203
@ Cached PyFloatAsDoubleNode floatAsDoubleNode ) {
@@ -232,6 +236,7 @@ public abstract static class AbsNode extends PythonUnaryBuiltinNode {
232
236
public abstract double executeDouble (Object arg );
233
237
234
238
@ Specialization
239
+ @ InliningCutoff
235
240
static double abs (Object self ,
236
241
@ Bind ("this" ) Node inliningTarget ,
237
242
@ Cached ToComplexValueNode toComplexValueNode ,
@@ -380,19 +385,19 @@ public static AbsNode create() {
380
385
@ GenerateNodeFactory
381
386
abstract static class AddNode extends PythonBinaryBuiltinNode {
382
387
@ Specialization
383
- static PComplex doComplex (PComplex left , int right ,
388
+ static PComplex doInt (PComplex left , int right ,
384
389
@ Shared @ Cached PythonObjectFactory factory ) {
385
390
return factory .createComplex (left .getReal () + right , left .getImag ());
386
391
}
387
392
388
393
@ Specialization
389
- static PComplex doComplex (PComplex left , double right ,
394
+ static PComplex doDouble (PComplex left , double right ,
390
395
@ Shared @ Cached PythonObjectFactory factory ) {
391
396
return factory .createComplex (left .getReal () + right , left .getImag ());
392
397
}
393
398
394
399
@ Specialization
395
- static Object doComplex (Object leftObj , Object rightObj ,
400
+ static Object doGeneric (Object leftObj , Object rightObj ,
396
401
@ Bind ("this" ) Node inliningTarget ,
397
402
@ Cached ToComplexValueNode toComplexLeft ,
398
403
@ Cached ToComplexValueNode toComplexRight ,
@@ -533,6 +538,7 @@ static Object doComplex(Object leftObj, Object rightObj,
533
538
abstract static class PowerNode extends PythonTernaryBuiltinNode {
534
539
535
540
@ Specialization
541
+ @ InliningCutoff
536
542
static Object doGeneric (Object leftObj , Object rightObj , @ SuppressWarnings ("unused" ) PNone mod ,
537
543
@ Bind ("this" ) Node inliningTarget ,
538
544
@ Cached ToComplexValueNode toComplexLeft ,
@@ -579,8 +585,9 @@ static Object doGeneric(Object leftObj, Object rightObj, @SuppressWarnings("unus
579
585
}
580
586
581
587
@ Specialization (guards = "!isPNone(mod)" )
588
+ @ InliningCutoff
582
589
@ SuppressWarnings ("unused" )
583
- static Object doGeneric (Object left , Object right , Object mod ,
590
+ static Object error (Object left , Object right , Object mod ,
584
591
@ Cached PRaiseNode raiseNode ) {
585
592
throw raiseNode .raise (ValueError , ErrorMessages .COMPLEX_MODULO );
586
593
}
@@ -660,7 +667,7 @@ static boolean doComplexInt(Node inliningTarget, Object leftObj, PInt right,
660
667
661
668
@ SuppressWarnings ("unused" )
662
669
@ Fallback
663
- static PNotImplemented doGeneric (Object left , Object right ) {
670
+ static PNotImplemented doNotImplemented (Object left , Object right ) {
664
671
return PNotImplemented .NOT_IMPLEMENTED ;
665
672
}
666
673
}
@@ -735,6 +742,7 @@ static PNotImplemented doGeneric(Object left, Object right) {
735
742
@ Builtin (name = J___REPR__ , minNumOfPositionalArgs = 1 )
736
743
abstract static class ReprNode extends PythonUnaryBuiltinNode {
737
744
@ Specialization
745
+ @ InliningCutoff
738
746
static TruffleString repr (Object self ,
739
747
@ Bind ("this" ) Node inliningTarget ,
740
748
@ Cached ToComplexValueNode toComplexValueNode ) {
@@ -760,6 +768,7 @@ protected ArgumentClinicProvider getArgumentClinic() {
760
768
}
761
769
762
770
@ Specialization
771
+ @ InliningCutoff
763
772
static TruffleString format (Object self , TruffleString formatString ,
764
773
@ Bind ("this" ) Node inliningTarget ,
765
774
@ Cached ToComplexValueNode toComplexValueNode ,
@@ -849,6 +858,7 @@ static double get(PComplex self) {
849
858
}
850
859
851
860
@ Specialization
861
+ @ InliningCutoff
852
862
static double getNative (PythonAbstractNativeObject self ,
853
863
@ Cached CStructAccess .ReadDoubleNode read ) {
854
864
return read .readFromObj (self , PyComplexObject__cval__real );
@@ -864,6 +874,7 @@ static double get(PComplex self) {
864
874
}
865
875
866
876
@ Specialization
877
+ @ InliningCutoff
867
878
static double getNative (PythonAbstractNativeObject self ,
868
879
@ Cached CStructAccess .ReadDoubleNode read ) {
869
880
return read .readFromObj (self , PyComplexObject__cval__imag );
0 commit comments