Skip to content

Commit 6952016

Browse files
timfelcosminbasca
authored andcommitted
workaround DSL problem
1 parent 4742820 commit 6952016

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,26 @@ protected static boolean isBuiltinDict(PHashingCollection globals, IsBuiltinClas
118118
return globals instanceof PDict && profile.profileObject(globals, PythonBuiltinClassType.PDict);
119119
}
120120

121-
protected static HashingStorage getStorage(Object cachedGlobals) {
121+
/**
122+
* @param module Non-cached parameter to help the DSL produce a guard, not an assertion
123+
*/
124+
protected static HashingStorage getStorage(Object module, Object cachedGlobals) {
122125
return ((PDict) cachedGlobals).getDictStorage();
123126
}
124127

125128
// special case for the very common module attribute read from an unchanging PDict
126129
@Specialization(guards = {
127130
"cachedObject == object",
128131
"lib.getDict(cachedObject) == cachedDict",
129-
"getStorage(cachedDict) == cachedStorage",
132+
"getStorage(object, cachedDict) == cachedStorage",
130133
"isBuiltinDict(cachedDict, isBuiltinDict)",
131134
}, assumptions = "singleContextAssumption", limit = "1")
132135
protected Object readFromBuiltinModuleDictUnchanged(@SuppressWarnings("unused") PythonModule object, String key,
133136
@SuppressWarnings("unused") @CachedLibrary("object") PythonObjectLibrary lib,
134137
@SuppressWarnings("unused") @Cached("object") PythonModule cachedObject,
135138
@SuppressWarnings("unused") @Cached("lib.getDict(cachedObject)") PHashingCollection cachedDict,
136139
@SuppressWarnings("unused") @Cached("singleContextAssumption()") Assumption singleContextAssumption,
137-
@Cached("getStorage(cachedDict)") HashingStorage cachedStorage,
140+
@Cached("getStorage(object, cachedDict)") HashingStorage cachedStorage,
138141
@SuppressWarnings("unused") @Cached IsBuiltinClassProfile isBuiltinDict,
139142
@Cached HashingStorageNodes.GetItemNode getItemNode) {
140143
// note that we don't need to pass the state here - string keys are hashable by definition

0 commit comments

Comments
 (0)