Skip to content

Commit f3fcabd

Browse files
committed
Use PythonLanaguage#isSingleContext in MRO slots lookup
1 parent 4cbf78e commit f3fcabd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ static Object doBuiltinTypeCached(@SuppressWarnings("unused") PythonBuiltinClass
9696

9797
// Single-context
9898

99-
@Specialization(guards = "klass == cachedKlass", //
100-
assumptions = {"singleContextAssumption()", "cachedKlass.getSlotsFinalAssumption()"}, //
99+
@Specialization(guards = {"isSingleContext()", "klass == cachedKlass"}, //
100+
assumptions = "cachedKlass.getSlotsFinalAssumption()", //
101101
limit = "getAttributeAccessInlineCacheMaxDepth()")
102102
static Object doSlotCachedSingleCtx(@SuppressWarnings("unused") PythonClass klass,
103103
@SuppressWarnings("unused") @Cached(value = "klass", weak = true) PythonClass cachedKlass,
104104
@Cached(value = "slot.getValue(klass)", weak = true) Object result) {
105105
return result;
106106
}
107107

108-
@Specialization(guards = "klass == cachedKlass", assumptions = {"singleContextAssumption()"}, limit = "getAttributeAccessInlineCacheMaxDepth()")
108+
@Specialization(guards = {"isSingleContext()", "klass == cachedKlass"}, limit = "getAttributeAccessInlineCacheMaxDepth()")
109109
static Object doBuiltinCachedSingleCtx(@SuppressWarnings("unused") PythonBuiltinClass klass,
110110
@SuppressWarnings("unused") @Cached("klass") PythonBuiltinClass cachedKlass,
111111
@Cached("slot.getValue(klass)") Object result) {
@@ -115,8 +115,8 @@ static Object doBuiltinCachedSingleCtx(@SuppressWarnings("unused") PythonBuiltin
115115
// PythonBuiltinClassType: if the value of the slot is not node factory or None, we must
116116
// read
117117
// the slot from the resolved builtin class
118-
@Specialization(guards = {"klassType == cachedKlassType", "slot.getValue(cachedKlassType) == null"}, //
119-
assumptions = {"singleContextAssumption()"}, limit = "getAttributeAccessInlineCacheMaxDepth()")
118+
@Specialization(guards = {"isSingleContext()", "klassType == cachedKlassType", "slot.getValue(cachedKlassType) == null"}, //
119+
limit = "getAttributeAccessInlineCacheMaxDepth()")
120120
static Object doBuiltinTypeCachedSingleCtx(@SuppressWarnings("unused") PythonBuiltinClassType klassType,
121121
@SuppressWarnings("unused") @Cached("klassType") PythonBuiltinClassType cachedKlassType,
122122
@Cached("slot.getValue(getContext().lookupType(cachedKlassType))") Object value) {
@@ -125,7 +125,8 @@ static Object doBuiltinTypeCachedSingleCtx(@SuppressWarnings("unused") PythonBui
125125

126126
// Multi-context:
127127

128-
@Specialization(replaces = "doSlotCachedSingleCtx", guards = {"slot.getValue(klass) == result", "isCacheable(result)"}, limit = "getAttributeAccessInlineCacheMaxDepth()")
128+
@Specialization(replaces = "doSlotCachedSingleCtx", guards = {"slot.getValue(klass) == result", "isCacheable(result)"}, //
129+
limit = "getAttributeAccessInlineCacheMaxDepth()")
129130
static Object doSlotCachedMultiCtx(@SuppressWarnings("unused") PythonClass klass,
130131
@Cached("slot.getValue(klass)") Object result) {
131132
// in multi-context we can still cache primitives and BuiltinMethodDescriptor instances

0 commit comments

Comments
 (0)