File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 51
51
import com .oracle .graal .python .runtime .exception .PythonErrorType ;
52
52
import com .oracle .graal .python .runtime .object .PythonObjectFactory ;
53
53
import com .oracle .truffle .api .Assumption ;
54
+ import com .oracle .truffle .api .CompilerAsserts ;
54
55
import com .oracle .truffle .api .CompilerDirectives ;
55
56
import com .oracle .truffle .api .CompilerDirectives .CompilationFinal ;
56
57
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
57
58
import com .oracle .truffle .api .TruffleLanguage .ContextReference ;
58
59
import com .oracle .truffle .api .nodes .Node ;
60
+ import com .oracle .truffle .api .nodes .RootNode ;
59
61
import com .oracle .truffle .api .profiles .ConditionProfile ;
60
62
61
63
public abstract class PNodeWithContext extends Node {
@@ -121,7 +123,14 @@ public final PythonContext getContext() {
121
123
}
122
124
123
125
protected Assumption singleContextAssumption () {
124
- PythonLanguage language = getRootNode ().getLanguage (PythonLanguage .class );
126
+ CompilerAsserts .neverPartOfCompilation ("the singleContextAssumption should only be retrieved in the interpreter" );
127
+ PythonLanguage language = null ;
128
+ RootNode rootNode = getRootNode ();
129
+ if (rootNode != null ) {
130
+ language = rootNode .getLanguage (PythonLanguage .class );
131
+ } else {
132
+ throw new IllegalStateException ("a python node was executed without being adopted!" );
133
+ }
125
134
if (language == null ) {
126
135
language = PythonLanguage .getCurrent ();
127
136
}
You can’t perform that action at this time.
0 commit comments