Skip to content

Commit 6b2ef5b

Browse files
committed
[GR-10755] Remove unnecessary profile in TypeBuiltins.
PullRequest: graalpython/202
2 parents 870e9e7 + 198b7e1 commit 6b2ef5b

File tree

1 file changed

+3
-15
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type

1 file changed

+3
-15
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/TypeBuiltins.java

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292
import com.oracle.truffle.api.frame.VirtualFrame;
9393
import com.oracle.truffle.api.profiles.BranchProfile;
9494
import com.oracle.truffle.api.profiles.ConditionProfile;
95-
import com.oracle.truffle.api.profiles.ValueProfile;
9695

9796
@CoreFunctions(extendClasses = PythonBuiltinClassType.PythonClass)
9897
public class TypeBuiltins extends PythonBuiltins {
@@ -232,9 +231,8 @@ public static GetattributeNode create() {
232231
private final BranchProfile errorProfile = BranchProfile.create();
233232

234233
@Child private LookupAttributeInMRONode.Dynamic lookup = LookupAttributeInMRONode.Dynamic.create();
235-
private final ValueProfile typeProfile = ValueProfile.createIdentityProfile();
234+
@Child private GetClassNode getObjectClassNode = GetClassNode.create();
236235
@Child private GetClassNode getDataClassNode;
237-
@Child private GetClassNode getObjectClassNode;
238236
@Child private LookupInheritedAttributeNode valueGetLookup;
239237
@Child private LookupAttributeInMRONode lookupGetNode;
240238
@Child private LookupAttributeInMRONode lookupSetNode;
@@ -245,13 +243,12 @@ public static GetattributeNode create() {
245243

246244
@Specialization
247245
protected Object doIt(PythonClass object, Object key) {
248-
PythonClass type = typeProfile.profile(getObjectClass(object));
246+
PythonClass type = getObjectClassNode.execute(object);
249247
Object descr = lookup.execute(type, key);
250-
PythonClass dataDescClass = null;
251248
Object get = null;
252249
if (descr != PNone.NO_VALUE) {
253250
hasDescProfile.enter();
254-
dataDescClass = getDataClass(descr);
251+
PythonClass dataDescClass = getDataClass(descr);
255252
get = lookupGet(dataDescClass);
256253
if (get instanceof PythonCallable) {
257254
Object delete = PNone.NO_VALUE;
@@ -347,15 +344,6 @@ private PythonClass getDataClass(Object descr) {
347344
}
348345
return getDataClassNode.execute(descr);
349346
}
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-
359347
}
360348

361349
@Builtin(name = __PREPARE__, takesVarArgs = true, takesVarKeywordArgs = true)

0 commit comments

Comments
 (0)