Skip to content

Commit ed74ea4

Browse files
committed
Add InlinedIntValueProfile of MRO length to SuperBuiltins#tp_getattro
1 parent 141e0cb commit ed74ea4

File tree

1 file changed

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

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125
import com.oracle.truffle.api.nodes.Node;
126126
import com.oracle.truffle.api.profiles.BranchProfile;
127127
import com.oracle.truffle.api.profiles.InlinedConditionProfile;
128+
import com.oracle.truffle.api.profiles.InlinedIntValueProfile;
128129
import com.oracle.truffle.api.strings.TruffleString;
129130

130131
@CoreFunctions(extendClasses = PythonBuiltinClassType.Super)
@@ -517,6 +518,7 @@ Object get(VirtualFrame frame, SuperObject self, Object attr,
517518
@Cached TruffleString.EqualNode equalNode,
518519
@Cached GetObjectTypeNode getObjectType,
519520
@Cached CastToTruffleStringChecked1Node castToTruffleStringNode,
521+
@Cached InlinedIntValueProfile mroLenProfile,
520522
@Cached InlinedConditionProfile hasDescrGetProfile,
521523
@Cached InlinedConditionProfile getObjectIsStartObjectProfile,
522524
@Cached IsForeignObjectNode isForeignObjectNode,
@@ -545,7 +547,7 @@ Object get(VirtualFrame frame, SuperObject self, Object attr,
545547
PythonAbstractClass[] mro = getMro(startType);
546548
/* No need to check the last one: it's gonna be skipped anyway. */
547549
int i = 0;
548-
int n = mro.length;
550+
int n = mroLenProfile.profile(inliningTarget, mro.length);
549551
for (i = 0; i + 1 < n; i++) {
550552
if (isSameType(type, mro[i])) {
551553
break;

0 commit comments

Comments
 (0)