Skip to content

Commit e92a0c6

Browse files
committed
Fix some other minor discrepancies between Explainer.md/Binary.md/CanonicalABI.md
1 parent d2cae02 commit e92a0c6

File tree

5 files changed

+66
-67
lines changed

5 files changed

+66
-67
lines changed

design/mvp/Binary.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ section ::= section_0(<core:custom>) => ϵ
3434
| a*:section_6(vec(<alias>)) => a*
3535
| t*:section_7(vec(<type>)) => t*
3636
| c*:section_8(vec(<canon>)) => c*
37-
| s: section_9(<start>) => [s]
37+
| s: section_9(<start>) => [s] 🪙
3838
| i*:section_10(vec(<import>)) => i*
3939
| e*:section_11(vec(<export>)) => e*
4040
| v*:section_12(vec(<value>)) => v* 🪙
@@ -87,7 +87,7 @@ sort ::= 0x00 cs:<core:sort> => co
8787
| 0x03 => type
8888
| 0x04 => component
8989
| 0x05 => instance
90-
inlineexport ::= n:<exportname> si:<sortidx> => (export n si)
90+
inlineexport ::= n:<exportname'> si:<sortidx> => (export n si)
9191
```
9292
Notes:
9393
* Reused Core binary rules: [`core:name`], (variable-length encoded) [`core:u32`]
@@ -301,22 +301,24 @@ canon ::= 0x00 0x00 f:<core:funcidx> opts:<opts> ft:<typeidx> => (canon lift
301301
| 0x09 rs:<resultlist> opts:<opts> => (canon task.return rs opts (core func)) 🔀
302302
| 0x05 => (canon task.cancel (core func)) 🔀
303303
| 0x0a 0x7f i:<u32> => (canon context.get i32 i (core func)) 🔀
304+
| 0x0a 0x7e i:<u32> => (canon context.get i64 i (core func)) 🔀🐘
304305
| 0x0b 0x7f i:<u32> => (canon context.set i32 i (core func)) 🔀
306+
| 0x0b 0x7e i:<u32> => (canon context.set i64 i (core func)) 🔀🐘
305307
| 0x0c cancel?:<cancel?> => (canon thread.yield cancel? (core func)) 🔀
306308
| 0x06 async?:<async?> => (canon subtask.cancel async? (core func)) 🔀
307309
| 0x0d => (canon subtask.drop (core func)) 🔀
308310
| 0x0e t:<typeidx> => (canon stream.new t (core func)) 🔀
309311
| 0x0f t:<typeidx> opts:<opts> => (canon stream.read t opts (core func)) 🔀
310312
| 0x10 t:<typeidx> opts:<opts> => (canon stream.write t opts (core func)) 🔀
311-
| 0x11 t:<typeidx> async?:<async?> => (canon stream.cancel-read async? (core func)) 🔀
312-
| 0x12 t:<typeidx> async?:<async?> => (canon stream.cancel-write async? (core func)) 🔀
313+
| 0x11 t:<typeidx> async?:<async?> => (canon stream.cancel-read t async? (core func)) 🔀
314+
| 0x12 t:<typeidx> async?:<async?> => (canon stream.cancel-write t async? (core func)) 🔀
313315
| 0x13 t:<typeidx> => (canon stream.drop-readable t (core func)) 🔀
314316
| 0x14 t:<typeidx> => (canon stream.drop-writable t (core func)) 🔀
315317
| 0x15 t:<typeidx> => (canon future.new t (core func)) 🔀
316318
| 0x16 t:<typeidx> opts:<opts> => (canon future.read t opts (core func)) 🔀
317319
| 0x17 t:<typeidx> opts:<opts> => (canon future.write t opts (core func)) 🔀
318-
| 0x18 t:<typeidx> async?:<async?> => (canon future.cancel-read async? (core func)) 🔀
319-
| 0x19 t:<typeidx> async?:<async?> => (canon future.cancel-write async? (core func)) 🔀
320+
| 0x18 t:<typeidx> async?:<async?> => (canon future.cancel-read t async? (core func)) 🔀
321+
| 0x19 t:<typeidx> async?:<async?> => (canon future.cancel-write t async? (core func)) 🔀
320322
| 0x1a t:<typeidx> => (canon future.drop-readable t (core func)) 🔀
321323
| 0x1b t:<typeidx> => (canon future.drop-writable t (core func)) 🔀
322324
| 0x1c opts:<opts> => (canon error-context.new opts (core func)) 📝
@@ -339,7 +341,7 @@ canon ::= 0x00 0x00 f:<core:funcidx> opts:<opts> ft:<typeidx> => (canon lift
339341
async? ::= 0x00 =>
340342
| 0x01 => async
341343
cancel? ::= 0x00 =>
342-
| 0x01 => cancellable 🚟
344+
| 0x01 => cancellable
343345
sh? ::= 0x00 =>
344346
| 0x01 => shared 🧵②
345347
opts ::= opt*:vec(<canonopt>) => opt*

design/mvp/CanonicalABI.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ the closure fields directly in the component instance table.
898898
A waitable can belong to at most one "waitable set" (defined next) which is
899899
referred to by the `wset` field. A `Waitable`'s `pending_event` is delivered
900900
(via `get_pending_event`) when core wasm code waits on its waitable set (via
901-
`task.wait` or, when using `callback`, by returning to the event loop).
901+
`waitable-set.wait` or, when using `callback`, by returning to the event loop).
902902
```python
903903
class Waitable:
904904
pending_event: Optional[Callable[[], EventTuple]]
@@ -2384,10 +2384,10 @@ def store_int(cx, v, ptr, nbytes, signed = False):
23842384
```
23852385

23862386
Floats are stored directly into memory, with the sign and payload bits of NaN
2387-
values modified non-deterministically. This reflects the practical reality that
2387+
values modified nondeterministically. This reflects the practical reality that
23882388
different languages, protocols and CPUs have different effects on NaNs.
23892389

2390-
Although this non-determinism is expressed in the Python code below as
2390+
Although this nondeterminism is expressed in the Python code below as
23912391
generating a "random" NaN bit-pattern, native implementations do not need to
23922392
use the same "random" algorithm, or even any random algorithm at all. Hosts
23932393
may instead chose to canonicalize to an arbitrary fixed NaN value, or even to
@@ -4513,7 +4513,7 @@ For canonical definitions:
45134513
(canon future.drop-writable $future_t (core func $f))
45144514
```
45154515
validation specifies:
4516-
* `$f` is given type `(func (param i32 i32))`
4516+
* `$f` is given type `(func (param i32))`
45174517
* `$stream_t`/`$future_t` must be a type of the form `(stream $t?)`/`(future $t?)`
45184518

45194519
Calling `$f` removes the readable or writable end of the stream or future at
@@ -4767,7 +4767,7 @@ validation specifies:
47674767
* `memory` must be present
47684768

47694769
Calling `$f` calls the following function which uses the `$opts` immediate to
4770-
(non-deterministically) lift the debug message, create a new `ErrorContext`
4770+
(nondeterministically) lift the debug message, create a new `ErrorContext`
47714771
value, store it in the current component instance's `handles` table and returns
47724772
its index.
47734773
```python
@@ -4789,7 +4789,7 @@ def canon_error_context_new(opts, thread, ptr, tagged_code_units):
47894789
Supporting the requirement (introduced in the
47904790
[explainer](Explainer.md#error-context-type)) that wasm code does not depend on
47914791
the contents of `error-context` values for behavioral correctness, the debug
4792-
message is completely discarded non-deterministically or, in the deterministic
4792+
message is completely discarded nondeterministically or, in the deterministic
47934793
profile, always. Importantly (for performance), when the debug message is
47944794
discarded, it is not even lifted and thus the O(N) well-formedness conditions
47954795
are not checked. (Note that `host_defined_transformation` is not defined by the
@@ -4812,7 +4812,7 @@ validation specifies:
48124812

48134813
Calling `$f` calls the following function which uses the `$opts` immediate to
48144814
lowers the `ErrorContext`'s debug message. While *producing* an `error-context`
4815-
value may non-deterministically discard or transform the debug message, a
4815+
value may nondeterministically discard or transform the debug message, a
48164816
single `error-context` value must return the same debug message from
48174817
`error.debug-message` over time.
48184818
```python

design/mvp/Concurrency.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ to be rewritten to use source-language concurrency mechanisms (like callbacks,
110110
`main()` and calls to `read()`, `write()` and `select()` can run without change
111111
in the Preview 3 `wasi:cli/command` world, which exports `run: async func() ->
112112
result`. Thus, `async` in WIT does not require the same kind of transitive
113-
source-code changes as source-level `async` in langauges like C#, Python, JS,
113+
source-code changes as source-level `async` in languages like C#, Python, JS,
114114
Rust and Dart.
115115

116116
Because `async` exports impose little to no requirements on the guest
@@ -379,10 +379,10 @@ the following 3 thread built-ins. Once the thread is resumed, the thread can
379379
learn its own index by calling the [`thread.index`] built-in.
380380

381381
A suspended thread (identified by thread-table index) can be resumed at some
382-
non-deterministic point in future via the [`thread.resume-later`] built-in. In
382+
nondeterministic point in future via the [`thread.resume-later`] built-in. In
383383
contrast, the [`thread.yield-to`] built-in switches execution to the given
384384
thread immediately, leaving the *calling* thread to be resumed at some
385-
non-deterministic point in the future. Lastly, the [`thread.switch-to`]
385+
nondeterministic point in the future. Lastly, the [`thread.switch-to`]
386386
built-in switches execution to the given thread immediately, like `yield-to`,
387387
but leaves the calling thread in the "suspended" state. These three functions
388388
can be used to resume both newly-created threads as well as threads that
@@ -658,7 +658,7 @@ component-instance-wide lock is implicitly acquired every time core wasm is
658658
executed. By returning to the event loop after every event (instead of once at
659659
the end of the task), stackless async exports release the lock between every
660660
event, allowing a higher degree of concurrency than synchronous exports.
661-
Stackfull async exports ignore the lock entirely and thus achieve the highest
661+
Stackful async exports ignore the lock entirely and thus achieve the highest
662662
degree of (cooperative) concurrency.
663663

664664
Since non-`async` functions are not allowed to block (including due to
@@ -771,7 +771,7 @@ state and returns which state was reached. If called asynchronously, then if a
771771
cancellable subtask thread is resumed *and* the subtask reaches a resolved
772772
state before suspending itself for whatever reason `subtask.cancel` will return
773773
which state was reached. Otherwise, `subtask.cancel` will return a "blocked"
774-
sentinel value and the caller must [wait][#waitables-and-waitable-sets] via
774+
sentinel value and the caller must [wait](#waitables-and-waitable-sets) via
775775
waitable set until the subtask reaches a resolved state.
776776

777777
The Component Model does not provide a mechanism to force prompt termination of
@@ -836,7 +836,7 @@ Despite the above, the following scenarios do behave deterministically:
836836
deterministically and immediately.
837837
* When both ends of a stream or future are owned by wasm components, the
838838
behavior of all read, write, cancel and drop operations is deterministic
839-
(modulo any nondeterminitic execution that determines the ordering in which
839+
(modulo any nondeterministic execution that determines the ordering in which
840840
the operations are performed).
841841

842842

@@ -939,7 +939,7 @@ Other example asynchronous lowered signatures:
939939
| `async func()` | `(func (result i32))` |
940940
| `async func() -> string` | `(func (param $out-ptr i32) (result i32))` |
941941
| `async func(x: f32) -> f32` | `(func (param $x f32) (param $out-ptr i32) (result i32))` |
942-
| `async func(s: string, t: string)` | `(func (param $s-ptr i32) (param $s-len i32) (result $t-ptr i32) (param $t-len i32) (result i32))` |
942+
| `async func(s: string, t: string)` | `(func (param $s-ptr i32) (param $s-len i32) (param $t-ptr i32) (param $t-len i32) (result i32))` |
943943

944944
`future` and `stream` can appear anywhere in the parameter or result types. For example:
945945
```wit
@@ -1174,8 +1174,8 @@ core wasm code between events, not externally-visible behavior.
11741174
...
11751175
)
11761176
(core module $Main
1177-
(import "libc" "mem" (memory 1))
1178-
(import "libc" "realloc" (func (param i32 i32 i32 i32) (result i32)))
1177+
(import "" "mem" (memory 1))
1178+
(import "" "realloc" (func (param i32 i32 i32 i32) (result i32)))
11791179
(import "" "fetch" (func $fetch (param i32 i32 i32) (result i32)))
11801180
(import "" "waitable-set.new" (func $new_waitable_set (result i32)))
11811181
(import "" "waitable.join" (func $join (param i32 i32)))
@@ -1247,7 +1247,7 @@ It's also possible for `summarize` to call `task.return` called eagerly in the
12471247
initial core `summarize` call.
12481248

12491249
The `$event`, `$p1` and `$p2` parameters passed to `cb` are the same as the
1250-
return values from `task.wait` in the previous example. The precise meaning of
1250+
return values from `waitable-set.wait` in the previous example. The precise meaning of
12511251
these values is defined by the Canonical ABI.
12521252

12531253

@@ -1290,7 +1290,7 @@ comes after:
12901290
[Effect Type]: https://en.wikipedia.org/wiki/Effect_system
12911291
[CPS Transform]: https://en.wikipedia.org/wiki/Continuation-passing_style
12921292
[Asyncify]: https://emscripten.org/docs/porting/asyncify.html
1293-
[Session Types]: https://en.wikipedia.org/wiki/Session_type
1293+
[Session Type]: https://en.wikipedia.org/wiki/Session_type
12941294
[Structured Concurrency]: https://en.wikipedia.org/wiki/Structured_concurrency
12951295
[Unit]: https://en.wikipedia.org/wiki/Unit_type
12961296
[FS or GS Segment Base Address]: https://docs.kernel.org/arch/x86/x86_64/fsgs.html

0 commit comments

Comments
 (0)