|
69 | 69 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__GETATTRIBUTE__;
|
70 | 70 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__HASH__;
|
71 | 71 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__INIT__;
|
72 |
| -import static com.oracle.graal.python.nodes.SpecialMethodNames.__LEN__; |
73 | 72 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__NEW__;
|
74 | 73 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__NEXT__;
|
75 | 74 | import static com.oracle.graal.python.nodes.SpecialMethodNames.__REPR__;
|
|
139 | 138 | import com.oracle.graal.python.builtins.objects.type.PythonBuiltinClass;
|
140 | 139 | import com.oracle.graal.python.builtins.objects.type.PythonClass;
|
141 | 140 | import com.oracle.graal.python.builtins.objects.type.PythonManagedClass;
|
| 141 | +import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot; |
142 | 142 | import com.oracle.graal.python.builtins.objects.type.TypeBuiltins;
|
143 | 143 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetMroStorageNode;
|
144 | 144 | import com.oracle.graal.python.builtins.objects.type.TypeNodes.GetNameNode;
|
|
153 | 153 | import com.oracle.graal.python.nodes.SpecialAttributeNames;
|
154 | 154 | import com.oracle.graal.python.nodes.SpecialMethodNames;
|
155 | 155 | import com.oracle.graal.python.nodes.attributes.LookupAttributeInMRONode;
|
| 156 | +import com.oracle.graal.python.nodes.attributes.LookupCallableSlotInMRONode; |
156 | 157 | import com.oracle.graal.python.nodes.attributes.ReadAttributeFromObjectNode;
|
157 | 158 | import com.oracle.graal.python.nodes.attributes.WriteAttributeToBuiltinTypeNode;
|
158 | 159 | import com.oracle.graal.python.nodes.attributes.WriteAttributeToObjectNode;
|
@@ -343,7 +344,7 @@ public final Throwable fillInStackTrace() {
|
343 | 344 | }
|
344 | 345 | }
|
345 | 346 |
|
346 |
| - @ImportStatic({NativeMember.class, SpecialMethodNames.class, SpecialAttributeNames.class, PythonOptions.class}) |
| 347 | + @ImportStatic({NativeMember.class, SpecialMethodNames.class, SpecialAttributeNames.class, PythonOptions.class, SpecialMethodSlot.class}) |
347 | 348 | @TypeSystemReference(PythonArithmeticTypes.class)
|
348 | 349 | abstract static class ReadNativeMemberNode extends Node {
|
349 | 350 |
|
@@ -510,22 +511,23 @@ static Object doTpAsBuffer(PythonManagedClass object, @SuppressWarnings("unused"
|
510 | 511 |
|
511 | 512 | @Specialization(guards = "eq(TP_AS_SEQUENCE, key)")
|
512 | 513 | static Object doTpAsSequence(PythonManagedClass object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key,
|
513 |
| - @Cached LookupAttributeInMRONode.Dynamic getAttrNode, |
| 514 | + @Shared("lookupLen") @Cached(parameters = "Len") LookupCallableSlotInMRONode lookupLen, |
514 | 515 | @Shared("getNativeNullNode") @Cached GetNativeNullNode getNativeNullNode,
|
515 | 516 | @Shared("nullToSulongNode") @Cached ToSulongNode toSulongNode) {
|
516 |
| - if (getAttrNode.execute(object, __LEN__) != PNone.NO_VALUE) { |
| 517 | + if (lookupLen.execute(object) != PNone.NO_VALUE) { |
517 | 518 | return new PySequenceMethodsWrapper(object);
|
518 | 519 | } else {
|
519 | 520 | return toSulongNode.execute(getNativeNullNode.execute());
|
520 | 521 | }
|
521 | 522 | }
|
522 | 523 |
|
523 |
| - @Specialization(guards = "eq(TP_AS_MAPPING, key)", limit = "1") |
| 524 | + @Specialization(guards = "eq(TP_AS_MAPPING, key)") |
524 | 525 | static Object doTpAsMapping(PythonManagedClass object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key,
|
525 |
| - @CachedLibrary("object") PythonObjectLibrary pythonTypeLibrary, |
| 526 | + @Cached(parameters = "GetItem") LookupCallableSlotInMRONode lookupGetitem, |
| 527 | + @Shared("lookupLen") @Cached(parameters = "Len") LookupCallableSlotInMRONode lookupLen, |
526 | 528 | @Shared("getNativeNullNode") @Cached GetNativeNullNode getNativeNullNode,
|
527 | 529 | @Shared("nullToSulongNode") @Cached ToSulongNode toSulongNode) {
|
528 |
| - if (pythonTypeLibrary.isSequenceType(object)) { |
| 530 | + if (lookupGetitem.execute(object) != PNone.NO_VALUE && lookupLen.execute(object) != PNone.NONE) { |
529 | 531 | return new PyMappingMethodsWrapper(object);
|
530 | 532 | } else {
|
531 | 533 | return toSulongNode.execute(getNativeNullNode.execute());
|
|
0 commit comments