@@ -146,16 +146,18 @@ private static int incrementLen(DynamicObjectStorage self, ReadAttributeFromDyna
146
146
public static class GetItemWithState {
147
147
@ Specialization
148
148
static Object string (DynamicObjectStorage self , String key , ThreadState state ,
149
- @ Shared ("readKey" ) @ Cached ReadAttributeFromDynamicObjectNode readKey ) {
149
+ @ Shared ("readKey" ) @ Cached ReadAttributeFromDynamicObjectNode readKey ,
150
+ @ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile noValueProfile ) {
150
151
Object result = readKey .execute (self .store , key );
151
- return result == PNone .NO_VALUE ? null : result ;
152
+ return noValueProfile . profile ( result == PNone .NO_VALUE ) ? null : result ;
152
153
}
153
154
154
155
@ Specialization (guards = "isBuiltinString(key, profile)" , limit = "1" )
155
156
static Object pstring (DynamicObjectStorage self , PString key , ThreadState state ,
156
157
@ Shared ("readKey" ) @ Cached ReadAttributeFromDynamicObjectNode readKey ,
157
- @ Shared ("builtinStringProfile" ) @ Cached IsBuiltinClassProfile profile ) {
158
- return string (self , key .getValue (), state , readKey );
158
+ @ Shared ("builtinStringProfile" ) @ Cached IsBuiltinClassProfile profile ,
159
+ @ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile noValueProfile ) {
160
+ return string (self , key .getValue (), state , readKey , noValueProfile );
159
161
}
160
162
161
163
@ Specialization (guards = {"cachedShape == self.store.getShape()" , "!isBuiltinString(key, profile)" }, limit = "1" )
@@ -166,20 +168,21 @@ static Object notString(DynamicObjectStorage self, Object key, ThreadState state
166
168
@ Cached (value = "cachedShape.getKeyList().toArray()" , dimensions = 1 ) Object [] keyList ,
167
169
@ Shared ("builtinStringProfile" ) @ Cached IsBuiltinClassProfile profile ,
168
170
@ CachedLibrary (limit = "2" ) PythonObjectLibrary lib ,
169
- @ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile gotState ) {
171
+ @ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile gotState ,
172
+ @ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile noValueProfile ) {
170
173
long hash = self .getHashWithState (key , lib , state , gotState );
171
174
for (int i = 0 ; i < keyList .length ; i ++) {
172
175
Object currentKey = keyList [i ];
173
176
if (currentKey instanceof String ) {
174
177
if (gotState .profile (state != null )) {
175
178
long keyHash = lib .hashWithState (currentKey , state );
176
179
if (keyHash == hash && lib .equalsWithState (key , currentKey , lib , state )) {
177
- return string (self , (String ) currentKey , state , readKey );
180
+ return string (self , (String ) currentKey , state , readKey , noValueProfile );
178
181
}
179
182
} else {
180
183
long keyHash = lib .hash (currentKey );
181
184
if (keyHash == hash && lib .equals (key , currentKey , lib )) {
182
- return string (self , (String ) currentKey , null , readKey );
185
+ return string (self , (String ) currentKey , null , readKey , noValueProfile );
183
186
}
184
187
}
185
188
}
@@ -192,7 +195,8 @@ static Object notStringLoop(DynamicObjectStorage self, Object key, ThreadState s
192
195
@ Shared ("readKey" ) @ Cached ReadAttributeFromDynamicObjectNode readKey ,
193
196
@ Shared ("builtinStringProfile" ) @ Cached IsBuiltinClassProfile profile ,
194
197
@ CachedLibrary (limit = "2" ) PythonObjectLibrary lib ,
195
- @ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile gotState ) {
198
+ @ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile gotState ,
199
+ @ Exclusive @ Cached ("createBinaryProfile()" ) ConditionProfile noValueProfile ) {
196
200
long hash = self .getHashWithState (key , lib , state , gotState );
197
201
Iterator <Object > keys = self .store .getShape ().getKeys ().iterator ();
198
202
while (hasNext (keys )) {
@@ -202,12 +206,12 @@ static Object notStringLoop(DynamicObjectStorage self, Object key, ThreadState s
202
206
if (gotState .profile (state != null )) {
203
207
keyHash = lib .hashWithState (currentKey , state );
204
208
if (keyHash == hash && lib .equalsWithState (key , currentKey , lib , state )) {
205
- return string (self , (String ) currentKey , state , readKey );
209
+ return string (self , (String ) currentKey , state , readKey , noValueProfile );
206
210
}
207
211
} else {
208
212
keyHash = lib .hash (currentKey );
209
213
if (keyHash == hash && lib .equals (key , currentKey , lib )) {
210
- return string (self , (String ) currentKey , null , readKey );
214
+ return string (self , (String ) currentKey , null , readKey , noValueProfile );
211
215
}
212
216
}
213
217
}
0 commit comments