42
42
43
43
import java .util .List ;
44
44
45
+ import com .oracle .graal .python .PythonLanguage ;
45
46
import com .oracle .graal .python .builtins .Builtin ;
46
47
import com .oracle .graal .python .builtins .CoreFunctions ;
47
48
import com .oracle .graal .python .builtins .PythonBuiltinClassType ;
88
89
import com .oracle .graal .python .nodes .object .GetClassNode ;
89
90
import com .oracle .graal .python .runtime .exception .PException ;
90
91
import com .oracle .graal .python .runtime .exception .PythonErrorType ;
92
+ import com .oracle .truffle .api .Assumption ;
91
93
import com .oracle .truffle .api .CompilerDirectives ;
92
94
import com .oracle .truffle .api .dsl .Cached ;
93
95
import com .oracle .truffle .api .dsl .Fallback ;
@@ -108,9 +110,13 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
108
110
}
109
111
110
112
abstract static class GetTypeNode extends Node {
113
+ static final Assumption singleContextAssumption () {
114
+ return PythonLanguage .getCurrent ().singleContextAssumption ;
115
+ }
116
+
111
117
abstract Object execute (SuperObject self );
112
118
113
- @ Specialization (guards = "self == cachedSelf" , assumptions = "cachedSelf.getNeverReinitializedAssumption()" , limit = "1" )
119
+ @ Specialization (guards = "self == cachedSelf" , assumptions = { "cachedSelf.getNeverReinitializedAssumption()" , "singleContextAssumption()" } , limit = "1" )
114
120
Object cached (@ SuppressWarnings ("unused" ) SuperObject self ,
115
121
@ SuppressWarnings ("unused" ) @ Cached ("self" ) SuperObject cachedSelf ,
116
122
@ Cached ("self.getType()" ) Object type ) {
@@ -124,9 +130,13 @@ Object uncached(SuperObject self) {
124
130
}
125
131
126
132
abstract static class GetObjectTypeNode extends Node {
133
+ static final Assumption singleContextAssumption () {
134
+ return PythonLanguage .getCurrent ().singleContextAssumption ;
135
+ }
136
+
127
137
abstract Object execute (SuperObject self );
128
138
129
- @ Specialization (guards = "self == cachedSelf" , assumptions = "cachedSelf.getNeverReinitializedAssumption()" , limit = "1" )
139
+ @ Specialization (guards = "self == cachedSelf" , assumptions = { "cachedSelf.getNeverReinitializedAssumption()" , "singleContextAssumption()" } , limit = "1" )
130
140
Object cached (@ SuppressWarnings ("unused" ) SuperObject self ,
131
141
@ SuppressWarnings ("unused" ) @ Cached ("self" ) SuperObject cachedSelf ,
132
142
@ Cached ("self.getObjectType()" ) Object type ) {
@@ -140,9 +150,13 @@ Object uncached(SuperObject self) {
140
150
}
141
151
142
152
abstract static class GetObjectNode extends Node {
153
+ static final Assumption singleContextAssumption () {
154
+ return PythonLanguage .getCurrent ().singleContextAssumption ;
155
+ }
156
+
143
157
abstract Object execute (SuperObject self );
144
158
145
- @ Specialization (guards = "self == cachedSelf" , assumptions = "cachedSelf.getNeverReinitializedAssumption()" , limit = "1" )
159
+ @ Specialization (guards = "self == cachedSelf" , assumptions = { "cachedSelf.getNeverReinitializedAssumption()" , "singleContextAssumption()" } , limit = "1" )
146
160
Object cached (@ SuppressWarnings ("unused" ) SuperObject self ,
147
161
@ SuppressWarnings ("unused" ) @ Cached ("self" ) SuperObject cachedSelf ,
148
162
@ Cached ("self.getObject()" ) Object object ) {
0 commit comments