92
92
import com .oracle .truffle .api .frame .VirtualFrame ;
93
93
import com .oracle .truffle .api .profiles .BranchProfile ;
94
94
import com .oracle .truffle .api .profiles .ConditionProfile ;
95
- import com .oracle .truffle .api .profiles .ValueProfile ;
96
95
97
96
@ CoreFunctions (extendClasses = PythonBuiltinClassType .PythonClass )
98
97
public class TypeBuiltins extends PythonBuiltins {
@@ -232,9 +231,8 @@ public static GetattributeNode create() {
232
231
private final BranchProfile errorProfile = BranchProfile .create ();
233
232
234
233
@ Child private LookupAttributeInMRONode .Dynamic lookup = LookupAttributeInMRONode .Dynamic .create ();
235
- private final ValueProfile typeProfile = ValueProfile . createIdentityProfile ();
234
+ @ Child private GetClassNode getObjectClassNode = GetClassNode . create ();
236
235
@ Child private GetClassNode getDataClassNode ;
237
- @ Child private GetClassNode getObjectClassNode ;
238
236
@ Child private LookupInheritedAttributeNode valueGetLookup ;
239
237
@ Child private LookupAttributeInMRONode lookupGetNode ;
240
238
@ Child private LookupAttributeInMRONode lookupSetNode ;
@@ -245,13 +243,12 @@ public static GetattributeNode create() {
245
243
246
244
@ Specialization
247
245
protected Object doIt (PythonClass object , Object key ) {
248
- PythonClass type = typeProfile . profile ( getObjectClass ( object ) );
246
+ PythonClass type = getObjectClassNode . execute ( object );
249
247
Object descr = lookup .execute (type , key );
250
- PythonClass dataDescClass = null ;
251
248
Object get = null ;
252
249
if (descr != PNone .NO_VALUE ) {
253
250
hasDescProfile .enter ();
254
- dataDescClass = getDataClass (descr );
251
+ PythonClass dataDescClass = getDataClass (descr );
255
252
get = lookupGet (dataDescClass );
256
253
if (get instanceof PythonCallable ) {
257
254
Object delete = PNone .NO_VALUE ;
@@ -347,15 +344,6 @@ private PythonClass getDataClass(Object descr) {
347
344
}
348
345
return getDataClassNode .execute (descr );
349
346
}
350
-
351
- private PythonClass getObjectClass (Object descr ) {
352
- if (getObjectClassNode == null ) {
353
- CompilerDirectives .transferToInterpreterAndInvalidate ();
354
- getObjectClassNode = insert (GetClassNode .create ());
355
- }
356
- return typeProfile .profile (getObjectClassNode .execute (descr ));
357
- }
358
-
359
347
}
360
348
361
349
@ Builtin (name = __PREPARE__ , takesVarArgs = true , takesVarKeywordArgs = true )
0 commit comments