|
85 | 85 | import com.oracle.graal.python.nodes.PNodeWithGlobalState.DefaultContextManager;
|
86 | 86 | import com.oracle.graal.python.nodes.PRaiseNode;
|
87 | 87 | import com.oracle.graal.python.nodes.SpecialMethodNames;
|
| 88 | +import com.oracle.graal.python.nodes.attributes.LookupAttributeInMRONode; |
88 | 89 | import com.oracle.graal.python.nodes.attributes.LookupInheritedAttributeNode;
|
89 | 90 | import com.oracle.graal.python.nodes.attributes.ReadAttributeFromDynamicObjectNode;
|
90 | 91 | import com.oracle.graal.python.nodes.builtins.ListNodes.FastConstructListNode;
|
@@ -266,7 +267,7 @@ protected boolean wrappedString(PString s) {
|
266 | 267 | CompilerDirectives.transferToInterpreterAndInvalidate();
|
267 | 268 | isBuiltinClassProfile = IsBuiltinClassProfile.create();
|
268 | 269 | }
|
269 |
| - return isBuiltinClassProfile.profileClassWithBaseClasses(getClass(s), PythonBuiltinClassType.PString); |
| 270 | + return isBuiltinClassProfile.profileClass(getClass(s), PythonBuiltinClassType.PString); |
270 | 271 | }
|
271 | 272 |
|
272 | 273 | protected EconomicMapStorage switchToEconomicMap(HashingStorage storage) {
|
@@ -589,6 +590,19 @@ protected boolean readUncached(VirtualFrame frame, PythonObjectHybridDictStorage
|
589 | 590 | }
|
590 | 591 |
|
591 | 592 | @Specialization(guards = "!isJavaString(name)")
|
| 593 | + protected boolean readUncached(VirtualFrame frame, DynamicObjectStorage storage, PString name, |
| 594 | + @Cached LookupInheritedAttributeNode.Dynamic lookupHash, |
| 595 | + @Cached LookupAttributeInMRONode.Dynamic lookupStringHash, |
| 596 | + @Cached ContainsKeyNode recursiveNode) { |
| 597 | + if (lookupHash.execute(name, __HASH__) == lookupStringHash.execute(PythonBuiltinClassType.PString, __HASH__)) { |
| 598 | + return recursiveNode.execute(frame, storage, name.getValue()); |
| 599 | + } |
| 600 | + CompilerDirectives.transferToInterpreter(); |
| 601 | + // see GR-17389 |
| 602 | + throw new RuntimeException("String subclasses with custom hash in dict not implemented."); |
| 603 | + } |
| 604 | + |
| 605 | + @Specialization(guards = {"!isJavaString(name)", "!isPString(name)"}) |
592 | 606 | @SuppressWarnings("unused")
|
593 | 607 | protected boolean readUncached(DynamicObjectStorage storage, Object name) {
|
594 | 608 | return false;
|
|
0 commit comments