|
44 | 44 | import com.oracle.graal.python.builtins.objects.function.PKeyword;
|
45 | 45 | import com.oracle.graal.python.nodes.call.CallNode;
|
46 | 46 | import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
|
| 47 | +import com.oracle.truffle.api.RootCallTarget; |
47 | 48 | import com.oracle.truffle.api.dsl.Cached;
|
48 | 49 | import com.oracle.truffle.api.dsl.Specialization;
|
49 | 50 | import com.oracle.truffle.api.nodes.UnexpectedResultException;
|
@@ -71,62 +72,125 @@ public static CallBinaryMethodNode create() {
|
71 | 72 |
|
72 | 73 | public abstract Object executeObject(Object callable, Object arg1, Object arg2);
|
73 | 74 |
|
74 |
| - @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 75 | + @Specialization(guards = {"func == cachedFunc", |
| 76 | + "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class, assumptions = "singleContextAssumption()") |
75 | 77 | boolean callBool(@SuppressWarnings("unused") PBuiltinFunction func, boolean arg1, boolean arg2,
|
76 | 78 | @SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
|
77 | 79 | @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException {
|
78 | 80 | return builtinNode.executeBool(arg1, arg2);
|
79 | 81 | }
|
80 | 82 |
|
81 |
| - @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 83 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 84 | + boolean callBool(@SuppressWarnings("unused") PBuiltinFunction func, boolean arg1, boolean arg2, |
| 85 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 86 | + @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException { |
| 87 | + return builtinNode.executeBool(arg1, arg2); |
| 88 | + } |
| 89 | + |
| 90 | + @Specialization(guards = {"func == cachedFunc", |
| 91 | + "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class, assumptions = "singleContextAssumption()") |
82 | 92 | int callInt(@SuppressWarnings("unused") PBuiltinFunction func, int arg1, int arg2,
|
83 | 93 | @SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
|
84 | 94 | @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException {
|
85 | 95 | return builtinNode.executeInt(arg1, arg2);
|
86 | 96 | }
|
87 | 97 |
|
88 |
| - @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 98 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 99 | + int callInt(@SuppressWarnings("unused") PBuiltinFunction func, int arg1, int arg2, |
| 100 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 101 | + @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException { |
| 102 | + return builtinNode.executeInt(arg1, arg2); |
| 103 | + } |
| 104 | + |
| 105 | + @Specialization(guards = {"func == cachedFunc", |
| 106 | + "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class, assumptions = "singleContextAssumption()") |
89 | 107 | boolean callBool(@SuppressWarnings("unused") PBuiltinFunction func, int arg1, int arg2,
|
90 | 108 | @SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
|
91 | 109 | @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException {
|
92 | 110 | return builtinNode.executeBool(arg1, arg2);
|
93 | 111 | }
|
94 | 112 |
|
95 |
| - @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 113 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 114 | + boolean callBool(@SuppressWarnings("unused") PBuiltinFunction func, int arg1, int arg2, |
| 115 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 116 | + @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException { |
| 117 | + return builtinNode.executeBool(arg1, arg2); |
| 118 | + } |
| 119 | + |
| 120 | + @Specialization(guards = {"func == cachedFunc", |
| 121 | + "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class, assumptions = "singleContextAssumption()") |
96 | 122 | long callLong(@SuppressWarnings("unused") PBuiltinFunction func, long arg1, long arg2,
|
97 | 123 | @SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
|
98 | 124 | @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException {
|
99 | 125 | return builtinNode.executeLong(arg1, arg2);
|
100 | 126 | }
|
101 | 127 |
|
102 |
| - @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 128 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 129 | + long callLong(@SuppressWarnings("unused") PBuiltinFunction func, long arg1, long arg2, |
| 130 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 131 | + @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException { |
| 132 | + return builtinNode.executeLong(arg1, arg2); |
| 133 | + } |
| 134 | + |
| 135 | + @Specialization(guards = {"func == cachedFunc", |
| 136 | + "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class, assumptions = "singleContextAssumption()") |
103 | 137 | boolean callBool(@SuppressWarnings("unused") PBuiltinFunction func, long arg1, long arg2,
|
104 | 138 | @SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
|
105 | 139 | @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException {
|
106 | 140 | return builtinNode.executeBool(arg1, arg2);
|
107 | 141 | }
|
108 | 142 |
|
109 |
| - @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 143 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 144 | + boolean callBool(@SuppressWarnings("unused") PBuiltinFunction func, long arg1, long arg2, |
| 145 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 146 | + @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException { |
| 147 | + return builtinNode.executeBool(arg1, arg2); |
| 148 | + } |
| 149 | + |
| 150 | + @Specialization(guards = {"func == cachedFunc", |
| 151 | + "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class, assumptions = "singleContextAssumption()") |
110 | 152 | double callDouble(@SuppressWarnings("unused") PBuiltinFunction func, double arg1, double arg2,
|
111 | 153 | @SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
|
112 | 154 | @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException {
|
113 | 155 | return builtinNode.executeDouble(arg1, arg2);
|
114 | 156 | }
|
115 | 157 |
|
116 |
| - @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 158 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 159 | + double callDouble(@SuppressWarnings("unused") PBuiltinFunction func, double arg1, double arg2, |
| 160 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 161 | + @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException { |
| 162 | + return builtinNode.executeDouble(arg1, arg2); |
| 163 | + } |
| 164 | + |
| 165 | + @Specialization(guards = {"func == cachedFunc", |
| 166 | + "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class, assumptions = "singleContextAssumption()") |
117 | 167 | boolean callBool(@SuppressWarnings("unused") PBuiltinFunction func, double arg1, double arg2,
|
118 | 168 | @SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
|
119 | 169 | @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException {
|
120 | 170 | return builtinNode.executeBool(arg1, arg2);
|
121 | 171 | }
|
122 | 172 |
|
123 |
| - @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()") |
124 |
| - Object callObject(@SuppressWarnings("unused") PBuiltinFunction func, Object arg1, Object arg2, |
| 173 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", rewriteOn = UnexpectedResultException.class) |
| 174 | + boolean callBool(@SuppressWarnings("unused") PBuiltinFunction func, double arg1, double arg2, |
| 175 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 176 | + @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) throws UnexpectedResultException { |
| 177 | + return builtinNode.executeBool(arg1, arg2); |
| 178 | + } |
| 179 | + |
| 180 | + @Specialization(guards = {"func == cachedFunc", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()", assumptions = "singleContextAssumption()") |
| 181 | + Object callObjectSingleContext(@SuppressWarnings("unused") PBuiltinFunction func, Object arg1, Object arg2, |
125 | 182 | @SuppressWarnings("unused") @Cached("func") PBuiltinFunction cachedFunc,
|
126 | 183 | @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) {
|
127 | 184 | return builtinNode.execute(arg1, arg2);
|
128 | 185 | }
|
129 | 186 |
|
| 187 | + @Specialization(guards = {"func.getCallTarget() == ct", "builtinNode != null"}, limit = "getCallSiteInlineCacheMaxDepth()") |
| 188 | + Object callObject(@SuppressWarnings("unused") PBuiltinFunction func, Object arg1, Object arg2, |
| 189 | + @SuppressWarnings("unused") @Cached("func.getCallTarget()") RootCallTarget ct, |
| 190 | + @Cached("getBinary(func)") PythonBinaryBuiltinNode builtinNode) { |
| 191 | + return builtinNode.execute(arg1, arg2); |
| 192 | + } |
| 193 | + |
130 | 194 | @Specialization
|
131 | 195 | Object call(Object func, Object arg1, Object arg2,
|
132 | 196 | @Cached("create()") CallNode callNode) {
|
|
0 commit comments