Skip to content

Commit d767749

Browse files
committed
isDictUnsetOrSameAsStorage: getDict value profile not needed since we cache the dict class in the getDictStorageNode
1 parent 4de47af commit d767749

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/attributes/ObjectAttributeNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ protected Object attrKey(Object key) {
7575
}
7676
}
7777

78-
protected boolean isDictUnsetOrSameAsStorage(PythonObject object, ValueProfile dictClassProfile) {
79-
PHashingCollection dict = dictClassProfile.profile(object.getDict());
78+
protected boolean isDictUnsetOrSameAsStorage(PythonObject object) {
79+
PHashingCollection dict = object.getDict();
8080
if (dict == null) {
8181
return true;
8282
} else {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/attributes/ReadAttributeFromObjectNode.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060

6161
@ImportStatic({PGuards.class, PythonOptions.class})
6262
public abstract class ReadAttributeFromObjectNode extends ObjectAttributeNode {
63-
protected final ValueProfile dictClassProfile = ValueProfile.createClassProfile();
64-
6563
public static ReadAttributeFromObjectNode create() {
6664
return ReadAttributeFromObjectNodeGen.create();
6765
}
@@ -82,7 +80,7 @@ protected Object readFromDynamicStorageCached(PythonObject object, Object key,
8280
}
8381

8482
@Specialization(guards = {
85-
"isDictUnsetOrSameAsStorage(object, dictClassProfile)"
83+
"isDictUnsetOrSameAsStorage(object)"
8684
}, replaces = "readFromDynamicStorageCached")
8785
protected Object readFromDynamicStorage(PythonObject object, Object key,
8886
@Cached("create()") ReadAttributeFromDynamicObjectNode readAttributeFromDynamicObjectNode) {
@@ -107,7 +105,7 @@ protected Object readFromDictCached(PythonObject object, Object key,
107105
}
108106

109107
@Specialization(guards = {
110-
"!isDictUnsetOrSameAsStorage(object, dictClassProfile)"
108+
"!isDictUnsetOrSameAsStorage(object)"
111109
}, replaces = "readFromDictCached")
112110
protected Object readFromDict(PythonObject object, Object key,
113111
@Cached("create()") HashingStorageNodes.GetItemNode getItemNode) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/attributes/WriteAttributeToObjectNode.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ public abstract class WriteAttributeToObjectNode extends ObjectAttributeNode {
6666
private final ConditionProfile isClassProfile = ConditionProfile.createBinaryProfile();
6767
private final IsBuiltinClassProfile exactBuiltinInstanceProfile = IsBuiltinClassProfile.create();
6868

69-
protected final ValueProfile dictClassProfile = ValueProfile.createClassProfile();
70-
7169
public abstract boolean execute(Object primary, Object key, Object value);
7270

7371
public abstract boolean execute(Object primary, String key, Object value);
@@ -108,7 +106,7 @@ protected boolean writeToDynamicStorageCached(PythonObject object, Object key, O
108106

109107
@Specialization(guards = {
110108
"isAttrWritable(object) || isHiddenKey(key)",
111-
"isDictUnsetOrSameAsStorage(object, dictClassProfile)"
109+
"isDictUnsetOrSameAsStorage(object)"
112110
}, replaces = "writeToDynamicStorageCached")
113111
protected boolean writeToDynamicStorage(PythonObject object, Object key, Object value,
114112
@Cached("create()") WriteAttributeToDynamicObjectNode writeAttributeToDynamicObjectNode) {
@@ -133,7 +131,7 @@ protected boolean writeToDictCached(PythonObject object, Object key, Object valu
133131
}
134132

135133
@Specialization(guards = {
136-
"!isDictUnsetOrSameAsStorage(object, dictClassProfile)"
134+
"!isDictUnsetOrSameAsStorage(object)"
137135
}, replaces = "writeToDictCached")
138136
protected boolean writeToDict(PythonObject object, Object key, Object value,
139137
@Cached("create()") HashingStorageNodes.SetItemNode setItemNode) {

0 commit comments

Comments
 (0)