34
34
import com .oracle .graal .python .builtins .objects .object .PythonObjectLibrary ;
35
35
import com .oracle .graal .python .nodes .PRaiseNode ;
36
36
import com .oracle .graal .python .nodes .SpecialAttributeNames ;
37
- import com .oracle .graal .python .nodes .SpecialMethodNames ;
38
37
import com .oracle .graal .python .nodes .attributes .GetAttributeNode ;
39
38
import com .oracle .graal .python .nodes .attributes .GetAttributeNode .GetAnyAttributeNode ;
40
39
import com .oracle .graal .python .nodes .attributes .SetAttributeNode ;
41
- import com .oracle .graal .python .nodes .call .special .LookupAndCallUnaryNode ;
42
40
import com .oracle .graal .python .nodes .object .IsBuiltinClassProfile ;
43
41
import com .oracle .graal .python .nodes .subscript .GetItemNode ;
44
42
import com .oracle .graal .python .nodes .subscript .SetItemNode ;
@@ -61,9 +59,8 @@ public class ImportStarNode extends AbstractImportNode {
61
59
62
60
@ Child private SetItemNode dictWriteNode ;
63
61
@ Child private SetAttributeNode .Dynamic setAttributeNode ;
64
- @ Child private LookupAndCallUnaryNode callLenNode ;
65
62
@ Child private GetItemNode getItemNode ;
66
- @ Child private PythonObjectLibrary castToIndexNode ;
63
+ @ Child private PythonObjectLibrary pythonLibrary ;
67
64
@ Child private CastToJavaStringNode castToStringNode ;
68
65
@ Child private GetAnyAttributeNode readNode ;
69
66
@ Child private PRaiseNode raiseNode ;
@@ -127,7 +124,7 @@ public void executeVoid(VirtualFrame frame) {
127
124
} else {
128
125
try {
129
126
Object attrAll = readAttribute (frame , importedModule , SpecialAttributeNames .__ALL__ );
130
- int n = ensureCastToIndexNode ().asSizeWithState ( ensureCallLenNode (). executeObject ( frame , attrAll ) , PArguments .getThreadState (frame ));
127
+ int n = ensurePythonLibrary ().lengthWithState ( attrAll , PArguments .getThreadState (frame ));
131
128
for (int i = 0 ; i < n ; i ++) {
132
129
Object attrNameObj = ensureGetItemNode ().executeWith (frame , attrAll , i );
133
130
String attrName = ensureCastToStringNode ().execute (attrNameObj );
@@ -155,20 +152,12 @@ public void executeVoid(VirtualFrame frame) {
155
152
}
156
153
}
157
154
158
- private LookupAndCallUnaryNode ensureCallLenNode () {
159
- if (callLenNode == null ) {
155
+ private PythonObjectLibrary ensurePythonLibrary () {
156
+ if (pythonLibrary == null ) {
160
157
CompilerDirectives .transferToInterpreterAndInvalidate ();
161
- callLenNode = insert (LookupAndCallUnaryNode . create ( SpecialMethodNames . __LEN__ ));
158
+ pythonLibrary = insert (PythonObjectLibrary . getFactory (). createDispatched ( PythonOptions . getCallSiteInlineCacheMaxDepth () ));
162
159
}
163
- return callLenNode ;
164
- }
165
-
166
- private PythonObjectLibrary ensureCastToIndexNode () {
167
- if (castToIndexNode == null ) {
168
- CompilerDirectives .transferToInterpreterAndInvalidate ();
169
- castToIndexNode = insert (PythonObjectLibrary .getFactory ().createDispatched (PythonOptions .getCallSiteInlineCacheMaxDepth ()));
170
- }
171
- return castToIndexNode ;
160
+ return pythonLibrary ;
172
161
}
173
162
174
163
private GetItemNode ensureGetItemNode () {
0 commit comments