Skip to content

Commit 48825bf

Browse files
committed
Profile the loop in map iternext
1 parent 151b459 commit 48825bf

File tree

1 file changed

+4
-2
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/map

1 file changed

+4
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/map/MapBuiltins.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ static Object doNext(VirtualFrame frame, PMap self,
141141
@Bind Node inliningTarget,
142142
@Shared @Cached TpSlots.GetObjectSlotsNode getSlots,
143143
@Shared @Cached TpSlotIterNext.CallSlotTpIterNextNode callTpIternext,
144-
@Shared @Cached CallNode callNode) {
144+
@Shared @Cached CallNode callNode,
145+
@Cached InlinedLoopConditionProfile loopProfile) {
145146
Object[] iterators = self.getIterators();
146147
Object[] arguments = new Object[iterators.length];
147-
for (int i = 0; i < iterators.length; i++) {
148+
loopProfile.profileCounted(inliningTarget, iterators.length);
149+
for (int i = 0; loopProfile.inject(inliningTarget, i < iterators.length); i++) {
148150
Object iterator = iterators[i];
149151
TpSlot iternext = getSlots.execute(inliningTarget, iterator).tp_iternext();
150152
arguments[i] = callTpIternext.execute(frame, inliningTarget, iternext, iterator);

0 commit comments

Comments
 (0)