39
39
import com .oracle .graal .python .nodes .attributes .GetAttributeNode ;
40
40
import com .oracle .graal .python .nodes .attributes .GetAttributeNode .GetAnyAttributeNode ;
41
41
import com .oracle .graal .python .nodes .attributes .SetAttributeNode ;
42
- import com .oracle .graal .python .nodes .frame .MaterializeFrameNode ;
43
- import com .oracle .graal .python .nodes .frame .ReadLocalsNode ;
44
42
import com .oracle .graal .python .nodes .object .IsBuiltinClassProfile ;
45
43
import com .oracle .graal .python .nodes .subscript .GetItemNode ;
46
44
import com .oracle .graal .python .nodes .subscript .SetItemNode ;
60
58
61
59
public class ImportStarNode extends AbstractImportNode {
62
60
private final ConditionProfile javaImport = ConditionProfile .createBinaryProfile ();
61
+ private final ConditionProfile haveCustomLocals = ConditionProfile .createBinaryProfile ();
63
62
64
63
@ Child private SetItemNode dictWriteNode ;
65
64
@ Child private SetAttributeNode .Dynamic setAttributeNode ;
@@ -68,8 +67,6 @@ public class ImportStarNode extends AbstractImportNode {
68
67
@ Child private CastToJavaStringNode castToStringNode ;
69
68
@ Child private GetAnyAttributeNode readNode ;
70
69
@ Child private PRaiseNode raiseNode ;
71
- @ Child private MaterializeFrameNode getPFrameNode ;
72
- @ Child private ReadLocalsNode getLocalsNode ;
73
70
74
71
@ Child private IsBuiltinClassProfile isAttributeErrorProfile ;
75
72
@@ -109,9 +106,15 @@ public ImportStarNode(String moduleName, int level) {
109
106
110
107
@ Override
111
108
public void executeVoid (VirtualFrame frame ) {
112
- Object importedModule = importModule (frame , moduleName , PArguments .getGlobals (frame ), new String []{"*" }, level );
113
- PFrame pFrame = ensureGetPFrameNode ().execute (frame , this , true , true );
114
- PythonObject locals = (PythonObject ) ensureGetLocalsNode ().execute (frame , pFrame );
109
+ PythonObject globals = PArguments .getGlobals (frame );
110
+ Object importedModule = importModule (frame , moduleName , globals , new String []{"*" }, level );
111
+ PythonObject locals = globals ;
112
+
113
+ Object customLocals = PArguments .getCustomLocals (frame );
114
+ if (haveCustomLocals .profile (customLocals != null )) {
115
+ assert customLocals instanceof PFrame .Reference ;
116
+ locals = (PythonObject ) ((PFrame .Reference ) customLocals ).getPyFrame ().getLocals (factory ());
117
+ }
115
118
116
119
if (javaImport .profile (emulateJython () && getContext ().getEnv ().isHostObject (importedModule ))) {
117
120
try {
@@ -185,22 +188,6 @@ private CastToJavaStringNode ensureCastToStringNode() {
185
188
return castToStringNode ;
186
189
}
187
190
188
- private MaterializeFrameNode ensureGetPFrameNode () {
189
- if (getPFrameNode == null ) {
190
- CompilerDirectives .transferToInterpreterAndInvalidate ();
191
- getPFrameNode = insert (MaterializeFrameNode .create ());
192
- }
193
- return getPFrameNode ;
194
- }
195
-
196
- private ReadLocalsNode ensureGetLocalsNode () {
197
- if (getLocalsNode == null ) {
198
- CompilerDirectives .transferToInterpreterAndInvalidate ();
199
- getLocalsNode = insert (ReadLocalsNode .create ());
200
- }
201
- return getLocalsNode ;
202
- }
203
-
204
191
private IsBuiltinClassProfile ensureIsAttributeErrorProfile () {
205
192
if (isAttributeErrorProfile == null ) {
206
193
CompilerDirectives .transferToInterpreterAndInvalidate ();
0 commit comments