43
43
import com .oracle .graal .python .builtins .objects .function .PBuiltinFunction ;
44
44
import com .oracle .graal .python .builtins .objects .function .PKeyword ;
45
45
import com .oracle .graal .python .nodes .call .CallNode ;
46
+ import com .oracle .graal .python .nodes .function .builtins .PythonBinaryBuiltinNode ;
47
+ import com .oracle .graal .python .nodes .function .builtins .PythonTernaryBuiltinNode ;
48
+ import com .oracle .graal .python .nodes .function .builtins .PythonUnaryBuiltinNode ;
46
49
import com .oracle .graal .python .nodes .function .builtins .PythonVarargsBuiltinNode ;
47
50
import com .oracle .graal .python .nodes .function .builtins .PythonVarargsBuiltinNode .VarargsBuiltinDirectInvocationNotSupported ;
48
51
import com .oracle .truffle .api .dsl .Cached ;
@@ -57,11 +60,32 @@ public static CallVarargsMethodNode create() {
57
60
58
61
@ Specialization (guards = {"func == cachedFunc" , "builtinNode != null" }, limit = "getCallSiteInlineCacheMaxDepth()" , rewriteOn = VarargsBuiltinDirectInvocationNotSupported .class )
59
62
Object call (@ SuppressWarnings ("unused" ) PBuiltinFunction func , Object [] arguments , PKeyword [] keywords ,
60
- @ SuppressWarnings ( "unused " ) @ Cached ( "func " ) PBuiltinFunction cachedFunc ,
63
+ @ Cached ( "func " ) @ SuppressWarnings ( "unused " ) PBuiltinFunction cachedFunc ,
61
64
@ Cached ("getVarargs(func)" ) PythonVarargsBuiltinNode builtinNode ) throws VarargsBuiltinDirectInvocationNotSupported {
62
65
return builtinNode .varArgExecute (arguments , keywords );
63
66
}
64
67
68
+ @ Specialization (guards = {"arguments.length == 1" , "keywords.length == 0" , "func == cachedFunc" , "builtinNode != null" }, limit = "getCallSiteInlineCacheMaxDepth()" )
69
+ Object callUnary (@ SuppressWarnings ("unused" ) PBuiltinFunction func , Object [] arguments , @ SuppressWarnings ("unused" ) PKeyword [] keywords ,
70
+ @ Cached ("func" ) @ SuppressWarnings ("unused" ) PBuiltinFunction cachedFunc ,
71
+ @ Cached ("getUnary(func)" ) PythonUnaryBuiltinNode builtinNode ) throws VarargsBuiltinDirectInvocationNotSupported {
72
+ return builtinNode .execute (arguments [0 ]);
73
+ }
74
+
75
+ @ Specialization (guards = {"arguments.length == 2" , "keywords.length == 0" , "func == cachedFunc" , "builtinNode != null" }, limit = "getCallSiteInlineCacheMaxDepth()" )
76
+ Object callBinary (@ SuppressWarnings ("unused" ) PBuiltinFunction func , Object [] arguments , @ SuppressWarnings ("unused" ) PKeyword [] keywords ,
77
+ @ Cached ("func" ) @ SuppressWarnings ("unused" ) PBuiltinFunction cachedFunc ,
78
+ @ Cached ("getBinary(func)" ) PythonBinaryBuiltinNode builtinNode ) throws VarargsBuiltinDirectInvocationNotSupported {
79
+ return builtinNode .execute (arguments [0 ], arguments [1 ]);
80
+ }
81
+
82
+ @ Specialization (guards = {"arguments.length == 3" , "keywords.length == 0" , "func == cachedFunc" , "builtinNode != null" }, limit = "getCallSiteInlineCacheMaxDepth()" )
83
+ Object callTernary (@ SuppressWarnings ("unused" ) PBuiltinFunction func , Object [] arguments , @ SuppressWarnings ("unused" ) PKeyword [] keywords ,
84
+ @ Cached ("func" ) @ SuppressWarnings ("unused" ) PBuiltinFunction cachedFunc ,
85
+ @ Cached ("getTernary(func)" ) PythonTernaryBuiltinNode builtinNode ) throws VarargsBuiltinDirectInvocationNotSupported {
86
+ return builtinNode .execute (arguments [0 ], arguments [1 ], arguments [2 ]);
87
+ }
88
+
65
89
@ Specialization
66
90
Object call (Object func , Object [] arguments , PKeyword [] keywords ,
67
91
@ Cached ("create()" ) CallNode callNode ) {
0 commit comments