|
29 | 29 |
|
30 | 30 | import com.oracle.graal.python.builtins.PythonBuiltinClassType;
|
31 | 31 | import com.oracle.graal.python.builtins.objects.PNone;
|
| 32 | +import com.oracle.graal.python.builtins.objects.function.PArguments; |
32 | 33 | import com.oracle.graal.python.builtins.objects.ints.PInt;
|
| 34 | +import com.oracle.graal.python.builtins.objects.object.PythonObjectLibrary; |
33 | 35 | import com.oracle.graal.python.builtins.objects.slice.PSlice;
|
34 | 36 | import com.oracle.graal.python.nodes.PNode;
|
35 | 37 | import com.oracle.graal.python.nodes.PNodeWithContext;
|
|
48 | 50 | import com.oracle.truffle.api.dsl.Specialization;
|
49 | 51 | import com.oracle.truffle.api.dsl.TypeSystemReference;
|
50 | 52 | import com.oracle.truffle.api.frame.VirtualFrame;
|
| 53 | +import com.oracle.truffle.api.library.CachedLibrary; |
51 | 54 | import com.oracle.truffle.api.profiles.BranchProfile;
|
52 | 55 |
|
53 | 56 | @NodeChild(value = "first", type = ExpressionNode.class)
|
@@ -169,12 +172,12 @@ int doPInt(PInt i) {
|
169 | 172 | }
|
170 | 173 | }
|
171 | 174 |
|
172 |
| - @Specialization |
| 175 | + @Specialization(replaces = {"doBoolean", "doInt", "doLong", "doPInt"}, limit = "getCallSiteInlineCacheMaxDepth()") |
173 | 176 | int doGeneric(VirtualFrame frame, Object i,
|
174 |
| - @Cached("createCastToIndex()") CastToIndexNode castToIndexNode, |
| 177 | + @CachedLibrary("i") PythonObjectLibrary lib, |
175 | 178 | @Cached IsBuiltinClassProfile errorProfile) {
|
176 | 179 | try {
|
177 |
| - return castToIndexNode.execute(frame, i); |
| 180 | + return lib.asIndexWithState(i, PArguments.getThreadState(frame)); |
178 | 181 | } catch (PException e) {
|
179 | 182 | e.expect(PythonBuiltinClassType.OverflowError, errorProfile);
|
180 | 183 | return overflowValue;
|
|
0 commit comments