|
124 | 124 | import com.oracle.graal.python.nodes.attributes.LookupAttributeInMRONode; |
125 | 125 | import com.oracle.graal.python.nodes.attributes.ReadAttributeFromObjectNode; |
126 | 126 | import com.oracle.graal.python.nodes.attributes.WriteAttributeToObjectNode; |
127 | | -import com.oracle.graal.python.nodes.call.special.LookupAndCallUnaryNode.LookupAndCallUnaryDynamicNode; |
128 | 127 | import com.oracle.graal.python.nodes.classes.IsSubtypeNode; |
129 | 128 | import com.oracle.graal.python.nodes.object.GetClassNode; |
130 | 129 | import com.oracle.graal.python.nodes.object.GetLazyClassNode; |
@@ -601,24 +600,24 @@ Object doObBase(PString o, @SuppressWarnings("unused") String key, |
601 | 600 | return toSulongNode.execute(o); |
602 | 601 | } |
603 | 602 |
|
604 | | - @Specialization(guards = "eq(OB_SIZE, key)") |
| 603 | + @Specialization(guards = "eq(OB_SIZE, key)", limit = "getCallSiteInlineCacheMaxDepth()") |
605 | 604 | long doObSize(Object object, @SuppressWarnings("unused") String key, |
606 | | - @Exclusive @Cached LookupAndCallUnaryDynamicNode callLenNode) { |
607 | | - Object res = callLenNode.executeObject(object, SpecialMethodNames.__LEN__); |
608 | | - if (res instanceof Number) { |
609 | | - return ((Number) res).intValue(); |
| 605 | + @CachedLibrary("object") PythonObjectLibrary lib) { |
| 606 | + try { |
| 607 | + return lib.length(object); |
| 608 | + } catch (PException e) { |
| 609 | + return -1; |
610 | 610 | } |
611 | | - return -1; |
612 | 611 | } |
613 | 612 |
|
614 | | - @Specialization(guards = "eq(MA_USED, key)") |
| 613 | + @Specialization(guards = "eq(MA_USED, key)", limit = "getCallSiteInlineCacheMaxDepth()") |
615 | 614 | int doMaUsed(PDict object, @SuppressWarnings("unused") String key, |
616 | | - @Exclusive @Cached LookupAndCallUnaryDynamicNode callLenNode) { |
617 | | - Object res = callLenNode.executeObject(object, SpecialMethodNames.__LEN__); |
618 | | - if (res instanceof Number) { |
619 | | - return ((Number) res).intValue(); |
| 615 | + @CachedLibrary("object") PythonObjectLibrary lib) { |
| 616 | + try { |
| 617 | + return lib.length(object); |
| 618 | + } catch (PException e) { |
| 619 | + return -1; |
620 | 620 | } |
621 | | - return -1; |
622 | 621 | } |
623 | 622 |
|
624 | 623 | @Specialization(guards = "eq(OB_SVAL, key)") |
|
0 commit comments