An iteration's slot comes from its token, not from the loop's cursor - #135
Merged
Merged
Conversation
Inside a parallel scope one activation serves every iteration of a node, with one slot per iteration. The slot was the executor's #index, which points at the newest iteration queued - while an earlier iteration may still be waiting and go on later. Two waits resumed in reverse order wrote both values into the second slot, and the node behind the scope join saw #(nil 'A'). Every iteration scope now knows its #index (FBScope), and a parallel activation reads its slot off its token's iteration scope (FBParallelActivation>>iterationIndex, FBParallelExecutor>>iterationOf:). The executor keeps a #currentIteration for what runs within a step or a resume - the loop variable and a predecessor's value are read for that iteration (#lastValueOf:, #outputFor:). A node resumed after a condition wait gets the parked token put back on its activation, so the slot the value goes into is the resumed iteration's. Tokens without a scope, persisted before iterations had one, fall back to the cursor as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inside a parallel scope one activation serves every iteration of a node, with one slot per iteration. The slot was the executor's #index, which points at the newest iteration queued - while an earlier iteration may still be waiting and go on later. Two waits resumed in reverse order wrote both values into the second slot, and the node behind the scope join saw #(nil 'A').
Every iteration scope now knows its #index (FBScope), and a parallel activation reads its slot off its token's iteration scope (FBParallelActivation>>iterationIndex, FBParallelExecutor>>iterationOf:). The executor keeps a #currentIteration for what runs within a step or a resume - the loop variable and a predecessor's value are read for that iteration (#lastValueOf:, #outputFor:). A node resumed after a condition wait gets the parked token put back on its activation, so the slot the value goes into is the resumed iteration's.
Tokens without a scope, persisted before iterations had one, fall back to the cursor as before.