|
109 | 109 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
110 | 110 | import com.oracle.truffle.api.TruffleLanguage.ContextReference;
|
111 | 111 | import com.oracle.truffle.api.dsl.Cached;
|
| 112 | +import com.oracle.truffle.api.dsl.Cached.Exclusive; |
112 | 113 | import com.oracle.truffle.api.dsl.Cached.Shared;
|
113 | 114 | import com.oracle.truffle.api.dsl.Fallback;
|
114 | 115 | import com.oracle.truffle.api.dsl.GenerateNodeFactory;
|
@@ -1167,30 +1168,34 @@ Object doEmptyStorage(VirtualFrame frame, EmptyStorage storage, Object key) {
|
1167 | 1168 | // this is just a minor performance optimization
|
1168 | 1169 | @Specialization
|
1169 | 1170 | static Object doPythonObjectString(PythonObjectDictStorage storage, String key,
|
1170 |
| - @Shared("readKey") @Cached ReadAttributeFromDynamicObjectNode readKey) { |
1171 |
| - return doDynamicObjectString(storage, key, readKey); |
| 1171 | + @Shared("readKey") @Cached ReadAttributeFromDynamicObjectNode readKey, |
| 1172 | + @Exclusive @Cached("createBinaryProfile()") ConditionProfile profile) { |
| 1173 | + return doDynamicObjectString(storage, key, readKey, profile); |
1172 | 1174 | }
|
1173 | 1175 |
|
1174 | 1176 | // this is just a minor performance optimization
|
1175 | 1177 | @Specialization
|
1176 | 1178 | static Object doPythonObjectPString(PythonObjectDictStorage storage, PString key,
|
1177 |
| - @Shared("readKey") @Cached ReadAttributeFromDynamicObjectNode readKey) { |
1178 |
| - return doDynamicObjectPString(storage, key, readKey); |
| 1179 | + @Shared("readKey") @Cached ReadAttributeFromDynamicObjectNode readKey, |
| 1180 | + @Exclusive @Cached("createBinaryProfile()") ConditionProfile profile) { |
| 1181 | + return doDynamicObjectPString(storage, key, readKey, profile); |
1179 | 1182 | }
|
1180 | 1183 |
|
1181 | 1184 | // this will read from the dynamic object
|
1182 | 1185 | @Specialization
|
1183 | 1186 | static Object doDynamicObjectString(DynamicObjectStorage storage, String key,
|
1184 |
| - @Shared("readKey") @Cached ReadAttributeFromDynamicObjectNode readKey) { |
| 1187 | + @Shared("readKey") @Cached ReadAttributeFromDynamicObjectNode readKey, |
| 1188 | + @Exclusive @Cached("createBinaryProfile()") ConditionProfile profile) { |
1185 | 1189 | Object result = readKey.execute(storage.getStore(), key);
|
1186 |
| - return result == PNone.NO_VALUE ? null : result; |
| 1190 | + return profile.profile(result == PNone.NO_VALUE) ? null : result; |
1187 | 1191 | }
|
1188 | 1192 |
|
1189 | 1193 | @Specialization
|
1190 | 1194 | static Object doDynamicObjectPString(DynamicObjectStorage storage, PString key,
|
1191 |
| - @Shared("readKey") @Cached ReadAttributeFromDynamicObjectNode readKey) { |
| 1195 | + @Shared("readKey") @Cached ReadAttributeFromDynamicObjectNode readKey, |
| 1196 | + @Exclusive @Cached("createBinaryProfile()") ConditionProfile profile) { |
1192 | 1197 | Object result = readKey.execute(storage.getStore(), key);
|
1193 |
| - return result == PNone.NO_VALUE ? null : result; |
| 1198 | + return profile.profile(result == PNone.NO_VALUE) ? null : result; |
1194 | 1199 | }
|
1195 | 1200 |
|
1196 | 1201 | // this must read from the non-dynamic object storage
|
|
0 commit comments