Skip to content

Commit 2377e5b

Browse files
committed
don't cache in SuperBuiltins for multi-context (likely no point)
1 parent 0ecee61 commit 2377e5b

File tree

1 file changed

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

1 file changed

+17
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/superobject/SuperBuiltins.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
import java.util.List;
4444

45+
import com.oracle.graal.python.PythonLanguage;
4546
import com.oracle.graal.python.builtins.Builtin;
4647
import com.oracle.graal.python.builtins.CoreFunctions;
4748
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
@@ -88,6 +89,7 @@
8889
import com.oracle.graal.python.nodes.object.GetClassNode;
8990
import com.oracle.graal.python.runtime.exception.PException;
9091
import com.oracle.graal.python.runtime.exception.PythonErrorType;
92+
import com.oracle.truffle.api.Assumption;
9193
import com.oracle.truffle.api.CompilerDirectives;
9294
import com.oracle.truffle.api.dsl.Cached;
9395
import com.oracle.truffle.api.dsl.Fallback;
@@ -108,9 +110,13 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
108110
}
109111

110112
abstract static class GetTypeNode extends Node {
113+
static final Assumption singleContextAssumption() {
114+
return PythonLanguage.getCurrent().singleContextAssumption;
115+
}
116+
111117
abstract Object execute(SuperObject self);
112118

113-
@Specialization(guards = "self == cachedSelf", assumptions = "cachedSelf.getNeverReinitializedAssumption()", limit = "1")
119+
@Specialization(guards = "self == cachedSelf", assumptions = {"cachedSelf.getNeverReinitializedAssumption()", "singleContextAssumption()"}, limit = "1")
114120
Object cached(@SuppressWarnings("unused") SuperObject self,
115121
@SuppressWarnings("unused") @Cached("self") SuperObject cachedSelf,
116122
@Cached("self.getType()") Object type) {
@@ -124,9 +130,13 @@ Object uncached(SuperObject self) {
124130
}
125131

126132
abstract static class GetObjectTypeNode extends Node {
133+
static final Assumption singleContextAssumption() {
134+
return PythonLanguage.getCurrent().singleContextAssumption;
135+
}
136+
127137
abstract Object execute(SuperObject self);
128138

129-
@Specialization(guards = "self == cachedSelf", assumptions = "cachedSelf.getNeverReinitializedAssumption()", limit = "1")
139+
@Specialization(guards = "self == cachedSelf", assumptions = {"cachedSelf.getNeverReinitializedAssumption()", "singleContextAssumption()"}, limit = "1")
130140
Object cached(@SuppressWarnings("unused") SuperObject self,
131141
@SuppressWarnings("unused") @Cached("self") SuperObject cachedSelf,
132142
@Cached("self.getObjectType()") Object type) {
@@ -140,9 +150,13 @@ Object uncached(SuperObject self) {
140150
}
141151

142152
abstract static class GetObjectNode extends Node {
153+
static final Assumption singleContextAssumption() {
154+
return PythonLanguage.getCurrent().singleContextAssumption;
155+
}
156+
143157
abstract Object execute(SuperObject self);
144158

145-
@Specialization(guards = "self == cachedSelf", assumptions = "cachedSelf.getNeverReinitializedAssumption()", limit = "1")
159+
@Specialization(guards = "self == cachedSelf", assumptions = {"cachedSelf.getNeverReinitializedAssumption()", "singleContextAssumption()"}, limit = "1")
146160
Object cached(@SuppressWarnings("unused") SuperObject self,
147161
@SuppressWarnings("unused") @Cached("self") SuperObject cachedSelf,
148162
@Cached("self.getObject()") Object object) {

0 commit comments

Comments
 (0)