|
69 | 69 | import com.oracle.graal.python.nodes.PGuards; |
70 | 70 | import com.oracle.graal.python.nodes.PNodeWithContext; |
71 | 71 | import com.oracle.graal.python.nodes.PRaiseNode; |
| 72 | +import com.oracle.graal.python.nodes.attributes.ReadAttributeFromPythonObjectNode; |
72 | 73 | import com.oracle.graal.python.nodes.interop.PForeignToPTypeNode; |
73 | 74 | import com.oracle.graal.python.nodes.object.IsForeignObjectNode; |
74 | 75 | import com.oracle.graal.python.nodes.util.CastBuiltinStringToTruffleStringNode; |
@@ -146,6 +147,46 @@ static Object foreign(Node inliningTarget, ForeignHashingStorage self, Object ke |
146 | 147 | } |
147 | 148 | } |
148 | 149 |
|
| 150 | + @GenerateUncached |
| 151 | + @GenerateInline |
| 152 | + @GenerateCached(false) |
| 153 | + public abstract static class HashingStorageGetItemStringKey extends Node { |
| 154 | + public abstract Object execute(Node inliningTarget, HashingStorage self, TruffleString key); |
| 155 | + |
| 156 | + @Specialization |
| 157 | + static Object economicMap(Node inliningTarget, EconomicMapStorage self, TruffleString key, |
| 158 | + @Cached TruffleString.HashCodeNode hashCodeNode, |
| 159 | + @Cached ObjectHashMap.GetNode getNode) { |
| 160 | + return getNode.execute(null, inliningTarget, self.map, key, PyObjectHashNode.hash(key, hashCodeNode)); |
| 161 | + } |
| 162 | + |
| 163 | + @Specialization |
| 164 | + static Object dom(Node inliningTarget, DynamicObjectStorage self, TruffleString key, |
| 165 | + @Cached(inline = false) ReadAttributeFromPythonObjectNode readKey, |
| 166 | + @Cached InlinedConditionProfile noValueProfile) { |
| 167 | + return DynamicObjectStorage.GetItemNode.string(inliningTarget, self, key, -1, readKey, noValueProfile); |
| 168 | + } |
| 169 | + |
| 170 | + @Specialization |
| 171 | + @SuppressWarnings("unused") |
| 172 | + static Object empty(EmptyStorage self, TruffleString key) { |
| 173 | + return null; |
| 174 | + } |
| 175 | + |
| 176 | + @Specialization |
| 177 | + @InliningCutoff |
| 178 | + static Object keywords(Node inliningTarget, KeywordsStorage self, TruffleString key, |
| 179 | + @Cached GetKeywordsStorageItemNode getNode) { |
| 180 | + return getNode.execute(null, inliningTarget, self, key, -1); |
| 181 | + } |
| 182 | + |
| 183 | + @Specialization |
| 184 | + static Object foreign(Node inliningTarget, ForeignHashingStorage self, TruffleString key, |
| 185 | + @Cached ForeignHashingStorage.GetNode getNode) { |
| 186 | + return getNode.execute(inliningTarget, self, key); |
| 187 | + } |
| 188 | + } |
| 189 | + |
149 | 190 | @GenerateUncached |
150 | 191 | @GenerateInline |
151 | 192 | @GenerateCached(false) |
|
0 commit comments