Skip to content

Commit fbb905f

Browse files
committed
avoid early migration of dict.get to uncached
1 parent 53315a4 commit fbb905f

File tree

1 file changed

+3
-12
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/dict

1 file changed

+3
-12
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/dict/DictBuiltins.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,12 @@ public PDictView items(PDict self) {
254254
@Builtin(name = "get", minNumOfPositionalArgs = 2, maxNumOfPositionalArgs = 3)
255255
@GenerateNodeFactory
256256
public abstract static class GetNode extends PythonTernaryBuiltinNode {
257-
258-
@Specialization(guards = "!isNoValue(defaultValue)", limit = "1")
257+
@Specialization(limit = "getCallSiteInlineCacheMaxDepth()")
259258
public Object doWithDefault(VirtualFrame frame, PDict self, Object key, Object defaultValue,
260259
@CachedLibrary(value = "self.getDictStorage()") HashingStorageLibrary hlib,
261-
@Exclusive @Cached("createBinaryProfile()") ConditionProfile profile) {
262-
final Object value = hlib.getItemWithFrame(self.getDictStorage(), key, profile, frame);
263-
return value != null ? value : defaultValue;
264-
}
265-
266-
@Specialization(limit = "1")
267-
public Object doNoDefault(VirtualFrame frame, PDict self, Object key, @SuppressWarnings("unused") PNone defaultValue,
268-
@CachedLibrary(value = "self.getDictStorage()") HashingStorageLibrary hlib,
269-
@Exclusive @Cached("createBinaryProfile()") ConditionProfile profile) {
260+
@Cached ConditionProfile profile) {
270261
final Object value = hlib.getItemWithFrame(self.getDictStorage(), key, profile, frame);
271-
return value != null ? value : PNone.NONE;
262+
return value != null ? value : (defaultValue == PNone.NO_VALUE ? PNone.NONE : defaultValue);
272263
}
273264
}
274265

0 commit comments

Comments
 (0)