|
45 | 45 | import com.oracle.graal.python.builtins.objects.method.PBuiltinMethod;
|
46 | 46 | import com.oracle.graal.python.nodes.call.CallNode;
|
47 | 47 | import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
|
| 48 | +import com.oracle.graal.python.nodes.function.builtins.PythonTernaryBuiltinNode; |
48 | 49 | import com.oracle.truffle.api.RootCallTarget;
|
49 | 50 | import com.oracle.truffle.api.dsl.Cached;
|
50 | 51 | import com.oracle.truffle.api.dsl.Specialization;
|
@@ -199,13 +200,29 @@ Object callObject(@SuppressWarnings("unused") PBuiltinMethod func, Object arg1,
|
199 | 200 | return builtinNode.execute(arg1, arg2);
|
200 | 201 | }
|
201 | 202 |
|
| 203 | + @Specialization(guards = {"func == cachedFunc", "builtinNode != null", "isFixed"}, limit = "getCallSiteInlineCacheMaxDepth()", assumptions = "singleContextAssumption()") |
| 204 | + Object callObject(@SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2, |
| 205 | + @SuppressWarnings("unused") @Cached("func") PBuiltinMethod cachedFunc, |
| 206 | + @SuppressWarnings("unused") @Cached("func.getArity().takesFixedNumOfPositionalArgs()") boolean isFixed, |
| 207 | + @Cached("getTernary(func.getFunction())") PythonTernaryBuiltinNode builtinNode) { |
| 208 | + return builtinNode.execute(func.getSelf(), arg1, arg2); |
| 209 | + } |
| 210 | + |
202 | 211 | @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()")
|
203 | 212 | Object callObject(@SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2,
|
204 | 213 | @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct,
|
205 | 214 | @Cached("getBinary(func.getFunction())") PythonBinaryBuiltinNode builtinNode) {
|
206 | 215 | return builtinNode.execute(arg1, arg2);
|
207 | 216 | }
|
208 | 217 |
|
| 218 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null", "isFixed"}, limit = "getCallSiteInlineCacheMaxDepth()") |
| 219 | + Object callObject(@SuppressWarnings("unused") PBuiltinMethod func, Object arg1, Object arg2, |
| 220 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 221 | + @SuppressWarnings("unused") @Cached("func.getArity().takesFixedNumOfPositionalArgs()") boolean isFixed, |
| 222 | + @Cached("getTernary(func.getFunction())") PythonTernaryBuiltinNode builtinNode) { |
| 223 | + return builtinNode.execute(func.getSelf(), arg1, arg2); |
| 224 | + } |
| 225 | + |
209 | 226 | @Specialization
|
210 | 227 | Object call(Object func, Object arg1, Object arg2,
|
211 | 228 | @Cached("create()") CallNode callNode) {
|
|
0 commit comments