Skip to content

Commit d29a722

Browse files
committed
Explain gotoifnot a bit more carefully
1 parent 3180c15 commit d29a722

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/copyable_task.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,12 @@ The second component of the transformation is implementing the `produce` mechani
255255
ability to resume computation from where we produced. Roughly speaking, the `IRCode` must be
256256
modified to ensure that whenever a `produce` call in encountered, the `MistyClosure` returns
257257
the argument to `produce`, and that subsequent calls resume computation immediately after
258-
the `produce` statement. Observe that this is also facilitated by the ref mechanism
258+
the `produce` statement. This resumption is achieved by setting the value of a counter
259+
prior to returning following a `produce` statement -- a sequence of comparisons against this
260+
counter, and `goto-if-not` statement are inserted at the top of the IR. These are used to
261+
jump to the point in the code from which computation should resume. These are set up such
262+
that, when the `TapedTask` is first run, computation start froms the first statement.
263+
Observe that this is also facilitated by the ref mechanism
259264
discussed above, as it ensures that the state persists between calls to a `MistyClosure`.
260265
261266
The above gives the broad outline of how `TapedTask`s are implemented. We refer interested

0 commit comments

Comments
 (0)