|
108 | 108 | import com.oracle.graal.python.builtins.objects.tuple.PTuple; |
109 | 109 | import com.oracle.graal.python.builtins.objects.type.TpSlots; |
110 | 110 | import com.oracle.graal.python.builtins.objects.type.TpSlots.GetObjectSlotsNode; |
| 111 | +import com.oracle.graal.python.builtins.objects.type.slots.TpSlotIterNext.CallSlotTpIterNextNode; |
111 | 112 | import com.oracle.graal.python.builtins.objects.typing.PTypeAliasType; |
112 | 113 | import com.oracle.graal.python.compiler.CodeUnit; |
113 | 114 | import com.oracle.graal.python.compiler.OpCodes.MakeTypeParamKind; |
@@ -3377,25 +3378,35 @@ static boolean doGenerator(VirtualFrame virtualFrame, |
3377 | 3378 | } |
3378 | 3379 | } |
3379 | 3380 |
|
3380 | | - @Specialization(guards = "iterCheck.execute(inliningTarget, iter)", limit = "1") |
| 3381 | + static boolean hasIterSlot(TpSlots slots) { |
| 3382 | + return PyIterCheckNode.checkSlots(slots); |
| 3383 | + } |
| 3384 | + |
| 3385 | + @Specialization(guards = "hasIterSlot(slots)", limit = "1") |
3381 | 3386 | static boolean doIterator(VirtualFrame virtualFrame, |
3382 | 3387 | LocalAccessor yieldedValue, |
3383 | 3388 | LocalAccessor returnedValue, |
3384 | 3389 | Object iter, |
3385 | 3390 | @SuppressWarnings("unused") PNone arg, |
3386 | 3391 | @Bind Node inliningTarget, |
3387 | 3392 | @Bind BytecodeNode bytecode, |
3388 | | - @SuppressWarnings("unused") @Cached PyIterCheckNode iterCheck, |
3389 | | - @Cached PyIterNextNode getNextNode, |
| 3393 | + @SuppressWarnings("unused") @Cached GetObjectSlotsNode getSlots, |
| 3394 | + @Bind("getSlots.execute(inliningTarget, iter)") TpSlots slots, |
| 3395 | + @Cached CallSlotTpIterNextNode callIterNext, |
| 3396 | + @Exclusive @Cached InlinedBranchProfile exhaustedNoException, |
3390 | 3397 | @Shared @Cached IsBuiltinObjectProfile stopIterationProfile, |
3391 | 3398 | @Shared @Cached StopIterationBuiltins.StopIterationValueNode getValue) { |
3392 | 3399 | try { |
3393 | | - Object value = getNextNode.execute(virtualFrame, inliningTarget, iter); |
| 3400 | + Object value = callIterNext.execute(virtualFrame, inliningTarget, slots.tp_iternext(), iter); |
3394 | 3401 | yieldedValue.setObject(bytecode, virtualFrame, value); |
3395 | 3402 | return false; |
3396 | 3403 | } catch (IteratorExhausted e) { |
| 3404 | + exhaustedNoException.enter(inliningTarget); |
3397 | 3405 | returnedValue.setObject(bytecode, virtualFrame, PNone.NONE); |
3398 | 3406 | return true; |
| 3407 | + } catch (PException e) { |
| 3408 | + handleException(virtualFrame, e, inliningTarget, bytecode, stopIterationProfile, getValue, returnedValue); |
| 3409 | + return true; |
3399 | 3410 | } |
3400 | 3411 | } |
3401 | 3412 |
|
|
0 commit comments