57
57
import com .oracle .graal .python .builtins .objects .function .PBuiltinFunction ;
58
58
import com .oracle .graal .python .builtins .objects .function .PKeyword ;
59
59
import com .oracle .graal .python .builtins .objects .function .PythonCallable ;
60
- import com .oracle .graal .python .builtins .objects .mappingproxy .PMappingproxy ;
61
60
import com .oracle .graal .python .builtins .objects .type .PythonClass ;
62
61
import com .oracle .graal .python .nodes .SpecialMethodNames ;
63
62
import com .oracle .graal .python .nodes .attributes .LookupAttributeInMRONode ;
87
86
import com .oracle .truffle .api .nodes .UnexpectedResultException ;
88
87
import com .oracle .truffle .api .profiles .BranchProfile ;
89
88
import com .oracle .truffle .api .profiles .ConditionProfile ;
90
- import com .oracle .truffle .api .profiles .ValueProfile ;
91
89
92
90
@ CoreFunctions (extendClasses = PythonObject .class )
93
91
public class ObjectBuiltins extends PythonBuiltins {
@@ -224,16 +222,15 @@ private LookupAndCallBinaryNode getCallEqNode() {
224
222
225
223
@ Builtin (name = __GETATTRIBUTE__ , fixedNumOfArguments = 2 )
226
224
@ GenerateNodeFactory
227
- public abstract static class GetattributeNode extends PythonBinaryBuiltinNode {
225
+ public abstract static class GetAttributeNode extends PythonBinaryBuiltinNode {
228
226
private final BranchProfile hasDescProfile = BranchProfile .create ();
229
227
private final BranchProfile isDescProfile = BranchProfile .create ();
230
228
private final BranchProfile hasValueProfile = BranchProfile .create ();
231
229
private final BranchProfile errorProfile = BranchProfile .create ();
232
230
private final ConditionProfile typeIsObjectProfile = ConditionProfile .createBinaryProfile ();
233
231
234
232
@ Child private LookupAttributeInMRONode .Dynamic lookup = LookupAttributeInMRONode .Dynamic .create ();
235
- private final ValueProfile typeProfile = ValueProfile .createIdentityProfile ();
236
- @ Child private GetClassNode getObjectClassNode ;
233
+ @ Child private GetClassNode getObjectClassNode = GetClassNode .create ();
237
234
@ Child private GetClassNode getDataClassNode ;
238
235
@ Child private LookupAttributeInMRONode lookupGetNode ;
239
236
@ Child private LookupAttributeInMRONode lookupSetNode ;
@@ -244,7 +241,7 @@ public abstract static class GetattributeNode extends PythonBinaryBuiltinNode {
244
241
245
242
@ Specialization
246
243
protected Object doIt (Object object , Object key ) {
247
- PythonClass type = getObjectClass (object );
244
+ PythonClass type = getObjectClassNode . execute (object );
248
245
Object descr = lookup .execute (type , key );
249
246
PythonClass dataDescClass = null ;
250
247
if (descr != PNone .NO_VALUE ) {
@@ -338,14 +335,6 @@ private Object lookupSet(PythonClass dataDescClass) {
338
335
return lookupSetNode .execute (dataDescClass );
339
336
}
340
337
341
- private PythonClass getObjectClass (Object object ) {
342
- if (getObjectClassNode == null ) {
343
- CompilerDirectives .transferToInterpreterAndInvalidate ();
344
- getObjectClassNode = insert (GetClassNode .create ());
345
- }
346
- return typeProfile .profile (getObjectClassNode .execute (object ));
347
- }
348
-
349
338
private PythonClass getDataClass (Object descr ) {
350
339
if (getDataClassNode == null ) {
351
340
CompilerDirectives .transferToInterpreterAndInvalidate ();
0 commit comments