Skip to content

Commit be71e0e

Browse files
committed
[GR-58094] Add missing profiles in SuperBuiltins$Get.
PullRequest: graalpython/3473
2 parents f4e0578 + d05d74b commit be71e0e

File tree

1 file changed

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

1 file changed

+11
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/superobject/SuperBuiltins.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,9 @@ Object get(VirtualFrame frame, SuperObject self, Object attr,
442442
@Cached GetObjectSlotsNode getSlotsNode,
443443
@Cached TruffleString.EqualNode equalNode,
444444
@Cached GetObjectTypeNode getObjectType,
445-
@Cached CastToTruffleStringCheckedNode castToTruffleStringNode) {
445+
@Cached CastToTruffleStringCheckedNode castToTruffleStringNode,
446+
@Cached InlinedConditionProfile hasDescrGetProfile,
447+
@Cached InlinedConditionProfile getObjectIsStartObjectProfile) {
446448
Object startType = getObjectType.execute(inliningTarget, self);
447449
if (startType == null) {
448450
return genericGetAttr(frame, self, attr);
@@ -482,7 +484,7 @@ Object get(VirtualFrame frame, SuperObject self, Object attr,
482484
Object res = readFromDict.execute(tmp, stringAttr);
483485
if (res != PNone.NO_VALUE) {
484486
TpSlots resSlots = getSlotsNode.execute(inliningTarget, res);
485-
if (resSlots.tp_descr_get() != null) {
487+
if (hasDescrGetProfile.profile(inliningTarget, resSlots.tp_descr_get() != null)) {
486488
/*
487489
* Only pass 'obj' param if this is instance-mode super (See SF ID #743627)
488490
*/
@@ -495,7 +497,13 @@ Object get(VirtualFrame frame, SuperObject self, Object attr,
495497
CompilerDirectives.transferToInterpreterAndInvalidate();
496498
getObject = insert(GetObjectNodeGen.create());
497499
}
498-
res = callGetSlotNode.executeCached(frame, resSlots.tp_descr_get(), res, getObject.executeCached(self) == startType ? PNone.NO_VALUE : self.getObject(), startType);
500+
Object obj;
501+
if (getObjectIsStartObjectProfile.profile(inliningTarget, getObject.executeCached(self) == startType)) {
502+
obj = PNone.NO_VALUE;
503+
} else {
504+
obj = self.getObject();
505+
}
506+
res = callGetSlotNode.executeCached(frame, resSlots.tp_descr_get(), res, obj, startType);
499507
}
500508
return res;
501509
}

0 commit comments

Comments
 (0)