Skip to content

Commit cdbf5cc

Browse files
authored
Have a single table for resources, waitables, waitable sets and error contexts (#513)
Closes #511
1 parent 317e475 commit cdbf5cc

File tree

5 files changed

+257
-241
lines changed

5 files changed

+257
-241
lines changed

design/mvp/Async.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,10 @@ incremented so that the correct counter can be decremented.
502502

503503
### Cancellation
504504

505-
Once an async call has started, blocked and been added to the caller's table of
506-
waitables, the caller may decide that it no longer needs the results or effects
507-
of the subtask. In this case, the caller may **cancel** the subtask by calling
508-
the [`subtask.cancel`] built-in.
505+
Once an async call has started, blocked and been added to the caller's table,
506+
the caller may decide that it no longer needs the results or effects of the
507+
subtask. In this case, the caller may **cancel** the subtask by calling the
508+
[`subtask.cancel`] built-in.
509509

510510
Once cancellation is requested, since the subtask may have already racily
511511
returned a value, the caller may still receive a return value. However, the
@@ -593,8 +593,8 @@ possibilities indicated by the `(result i32)` value:
593593
* If the returned `i32` is `0`, then the call completed synchronously without
594594
blocking and so `$in` has been read and `$out` has been written.
595595
* Otherwise, the high 28 bits of the `i32` are the index of a new `Subtask`
596-
in the current component instance's `waitables` table. The low 4 bits
597-
indicate how far the callee made it before blocking:
596+
in the current component instance's table. The low 4 bits indicate how far
597+
the callee made it before blocking:
598598
* If `1`, the callee didn't even start (due to backpressure), and thus
599599
neither `$in` nor `$out` have been accessed yet.
600600
* If `2`, the callee started by reading `$in`, but blocked before writing
@@ -624,7 +624,7 @@ func(s1: stream<future<string>>, s2: list<stream<string>>) -> result<stream<stri
624624
```
625625
In *both* the sync and async ABIs, a `future` or `stream` in the WIT-level type
626626
translates to a single `i32` in the ABI. This `i32` is an index into the
627-
component instance's `waitables` table. For example, for the WIT function type:
627+
current component instance's table. For example, for the WIT function type:
628628
```wit
629629
func(f: future<string>) -> future<u32>
630630
```
@@ -637,8 +637,8 @@ and the asynchronous ABI has the signature:
637637
(func (param $in i32) (param $out i32) (result i32))
638638
```
639639
where, according to the above rules, `$in` is the index of a future in the
640-
`waitables` table (not a pointer to one) while `$out` is a pointer to a linear
641-
memory location that will receive an `i32` index.
640+
current component instance's table (not a pointer to one) while `$out` is a
641+
pointer to a linear memory location that will receive an `i32` index.
642642

643643
For the runtime semantics of this `i32` index, see `lift_stream`,
644644
`lift_future`, `lower_stream` and `lower_future` in the [Canonical ABI

0 commit comments

Comments
 (0)