45
45
import static com .oracle .graal .python .nodes .BuiltinNames .__IMPORT__ ;
46
46
47
47
import com .oracle .graal .python .builtins .objects .PNone ;
48
- import com .oracle .graal .python .builtins .objects .function .PArguments ;
49
48
import com .oracle .graal .python .builtins .objects .function .PKeyword ;
50
- import com .oracle .graal .python .builtins .objects .function .PythonCallable ;
51
49
import com .oracle .graal .python .builtins .objects .method .PMethod ;
52
50
import com .oracle .graal .python .builtins .objects .module .PythonModule ;
53
- import com .oracle .graal .python .nodes .call .InvokeNode ;
51
+ import com .oracle .graal .python .nodes .call .CallNode ;
54
52
import com .oracle .graal .python .nodes .object .GetDictNode ;
55
53
import com .oracle .truffle .api .CompilerDirectives ;
56
54
import com .oracle .truffle .api .instrumentation .StandardTags ;
57
55
import com .oracle .truffle .api .instrumentation .Tag ;
58
56
59
57
public abstract class AbstractImportNode extends StatementNode {
60
58
61
- @ Child private InvokeNode invokeNode ;
59
+ @ Child private CallNode callNode ;
62
60
@ Child private GetDictNode getDictNode ;
63
61
64
62
public AbstractImportNode () {
@@ -69,12 +67,12 @@ protected Object importModule(String name) {
69
67
return importModule (name , PNone .NONE , new String [0 ], 0 );
70
68
}
71
69
72
- InvokeNode getInvokeNode ( PythonCallable callable ) {
73
- if (invokeNode == null ) {
70
+ CallNode getCallNode ( ) {
71
+ if (callNode == null ) {
74
72
CompilerDirectives .transferToInterpreterAndInvalidate ();
75
- invokeNode = insert (InvokeNode .create (callable ));
73
+ callNode = insert (CallNode .create ());
76
74
}
77
- return invokeNode ;
75
+ return callNode ;
78
76
}
79
77
80
78
private GetDictNode getGetDictNode () {
@@ -98,11 +96,9 @@ protected Object importModule(String name, Object globals, String[] fromList, in
98
96
99
97
Object __import__ (String name , Object globals , String [] fromList , int level ) {
100
98
PMethod builtinImport = (PMethod ) getContext ().getBuiltins ().getAttribute (__IMPORT__ );
101
- Object [] importArguments = PArguments .create (2 );
102
- PArguments .setArgument (importArguments , 1 , name );
103
99
assert fromList != null ;
104
100
assert globals != null ;
105
- return getInvokeNode ( builtinImport ). invoke ( importArguments , new PKeyword []{
101
+ return getCallNode (). execute ( builtinImport , new Object []{ name } , new PKeyword []{
106
102
new PKeyword (GLOBALS , getGetDictNode ().execute (globals )),
107
103
new PKeyword (LOCALS , PNone .NONE ), // the locals argument is ignored so it
108
104
// can always be None
0 commit comments