Skip to content

Commit 2576e5a

Browse files
authored
Update README.md and other docs based on WASI 0.3 release (#667)
1 parent 5e48eb8 commit 2576e5a

5 files changed

Lines changed: 77 additions & 60 deletions

File tree

README.md

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
11
# Component Model design and specification
22

3-
This repository is where the component model is being standardized. For a more
3+
This repository is where the Component Model is being standardized. For a more
44
user-focused explanation, take a look at the **[Component Model Documentation]**.
55

6-
This repository contains the high-level [goals], [use cases], [design choices]
7-
and [FAQ] of the Component Model as well as more-detailed, low-level explainer
8-
docs describing the [IDL], [text format], [binary format], [concurrency model]
9-
and [Canonical ABI].
6+
This repository contains:
7+
* high-level [goals], [use cases], [design choices] and [FAQ] docs
8+
* low-level [WIT], [text format], [binary format], [concurrency] and [ABI] docs
9+
* a growing [WAST test suite]
1010

11-
In the future, this repository will additionally contain a [formal spec],
12-
reference interpreter and test suite.
11+
In the future, this repository will additionally contain a [formal spec] and a
12+
reference interpreter.
1313

1414
## Milestones
1515

16-
The Component Model is currently being incrementally developed and stabilized
17-
as part of [WASI Preview 2]. The subsequent [WASI Preview 3] milestone will be
18-
primarily concerned with the addition of [async and thread support][Concurrency
19-
Model].
16+
The Component Model is currently being developed incrementally as part of [WASI]
17+
"Developer Preview" releases. The Component Model features enabled as part of a
18+
WASI Developer Preview release are kept stable by producer and consumer tools so
19+
that they can be used outside the browser in production settings to collect
20+
real-world feedback.
21+
22+
The current WASI Developer Preview releases are:
23+
* 0.2.0: the first release based on the Component Model; includes
24+
shared-nothing and shared-everything [linking], a variety of high-level
25+
value types, `resource` types with handles, and [WIT].
26+
* 0.3.0: the first release with native [concurrency] support in the Component
27+
Model and [WIT]; adds `async` functions, `stream`s and `future`s as
28+
well as new [ABI] built-in functions (additions are marked by the 🔀
29+
emoji throughout the repo).
30+
31+
Subsequent WASI Developer Preview releases will include other emoji-[gated
32+
features] such as cooperative threads (🧵).
2033

2134
## Contributing
2235

@@ -30,13 +43,15 @@ To contribute to any of these repositories, see the Community Group's
3043
[Use Cases]: design/high-level/UseCases.md
3144
[Design Choices]: design/high-level/Choices.md
3245
[FAQ]: design/high-level/FAQ.md
33-
[IDL]: design/mvp/WIT.md
46+
[WIT]: design/mvp/WIT.md
3447
[Text Format]: design/mvp/Explainer.md
3548
[Binary Format]: design/mvp/Binary.md
36-
[Concurrency Model]: design/mvp/Concurrency.md
37-
[Canonical ABI]: design/mvp/CanonicalABI.md
49+
[Concurrency]: design/mvp/Concurrency.md
50+
[ABI]: design/mvp/CanonicalABI.md
51+
[WAST test suite]: test/
3852
[formal spec]: spec/
53+
[Linking]: design/mvp/Linking.md
54+
[Gated Features]: design/mvp/Explainer.md#gated-features
3955
[W3C WebAssembly Community Group]: https://www.w3.org/community/webassembly/
4056
[Contributing Guidelines]: https://webassembly.org/community/contributing/
41-
[WASI Preview 2]: https://github.com/WebAssembly/WASI/blob/main/docs/Preview2.md
42-
[WASI Preview 3]: https://github.com/WebAssembly/WASI/blob/main/docs/Preview2.md#looking-forward-to-preview-3
57+
[WASI]: https://github.com/WebAssembly/WASI

design/mvp/Concurrency.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Concurrency Explainer
22

3-
This document contains a high-level summary of the native concurrency support
4-
added as part of [WASI Preview 3], providing background for understanding the
5-
definitions in the [WIT], [AST explainer], [binary format] and [Canonical ABI
6-
explainer] documents that are gated by the 🔀 (async) and 🧵 (threading) emojis.
3+
This document contains a high-level summary of the native concurrency support,
4+
providing background for understanding the definitions in the [WIT], [AST
5+
explainer], [binary format] and [Canonical ABI explainer] documents that are
6+
gated by the 🔀 (async) and 🧵 (threading) emojis.
77

88
* [Goals](#goals)
99
* [Summary](#summary)
@@ -34,9 +34,9 @@ explainer] documents that are gated by the 🔀 (async) and 🧵 (threading) emo
3434

3535
## Goals
3636

37-
Refining the Component Model's high-level [goals](../high-level/Goals.md) and
38-
[use cases](../high-level/UseCases.md), [WASI Preview 3] adds the following
39-
concurrency-specific goals and use cases:
37+
With the release of [WASI] 0.3, the following concurrency-specific goals and
38+
use cases are added, refining the Component Model's high-level
39+
[goals](../high-level/Goals.md) and [use cases](../high-level/UseCases.md):
4040

4141
* Integrate with idiomatic source-language concurrency features including:
4242
* `async` functions in languages like C#, JS, Python, Rust and Swift
@@ -92,7 +92,7 @@ invariant is necessary to allow non-`async` component exports to be called in
9292
synchronous contexts (like event listeners, callbacks, getters, setters and
9393
constructors).
9494

95-
The new async ABI can be used alongside or instead of the existing Preview 2
95+
The new async ABI can be used alongside or instead of the existing [WASI] 0.2
9696
"sync ABI" to call or implement any `async`-typed functions. When *calling* an
9797
imported function via the async ABI, if the `async` callee [blocks](#blocking),
9898
control flow is returned immediately to the caller, and the callee continues
@@ -108,7 +108,7 @@ can compile directly to components exporting `async` functions without having
108108
to be rewritten to use source-language concurrency mechanisms (like callbacks,
109109
`async`/`wait`, coroutines, etc). For example, traditional C programs with a
110110
`main()` and calls to `read()`, `write()` and `select()` can run without change
111-
in the Preview 3 `wasi:cli/command` world, which exports `run: async func() ->
111+
in the [WASI] 0.3 `wasi:cli/command` world, which exports `run: async func() ->
112112
result`. Thus, `async` in WIT does not require the same kind of transitive
113113
source-code changes as source-level `async` in languages like C#, Python, JS,
114114
Rust and Dart.
@@ -911,9 +911,10 @@ the Component Model has [Component Invariant] #2. This is enforced by the
911911
[Canonical ABI](CanonicalABI.md#embedding) using strategically placed traps and
912912
boolean flags on component instances.
913913

914-
With Preview 3, a desirable outcome is that if our component imports `imp` and
915-
exports `exp` as `async` functions, then the following JS code could run the
916-
two `exp` calls concurrently just like if they were JS `async` functions:
914+
With native concurrency support, what we'd naturally expect is that if our
915+
component imports `imp` and exports `exp` as `async` functions, then the
916+
following JS code could run the two `exp` calls concurrently, as if they were JS
917+
`async` functions:
917918
```js
918919
import source component from './component.wasm';
919920
async function imp() {
@@ -1003,7 +1004,7 @@ task" to which work can be dispatched (e.g., via the `setInterval()` or
10031004
concurrency], these background tasks are new task tree roots (siblings to the
10041005
roots created when component exports are called by the host).
10051006

1006-
As a Preview 3 follow-up [TODO](#TODO), component type definitions should be
1007+
As a post-0.3.0 follow-up [TODO](#TODO), component type definitions should be
10071008
extended to allow an `async` effect that declares that component instantiation
10081009
is allowed to [block](#blocking). This would be necessary to implement, e.g.,
10091010
JS [top-level `await`] or I/O in C++ constructors executing during `start`.
@@ -1013,7 +1014,7 @@ JS [top-level `await`] or I/O in C++ constructors executing during `start`.
10131014

10141015
At an ABI level, native async in the Component Model defines for every
10151016
`async`-typed function a non-blocking core function signature that can be
1016-
used instead of or in addition to the existing (Preview-2-defined) synchronous
1017+
used instead of or in addition to the existing ([WASI] 0.2) synchronous
10171018
core function signature. This non-blocking core function signature is intended
10181019
to be called or implemented by generated bindings which then map the low-level
10191020
core async protocol to the languages' higher-level native concurrency features.
@@ -1406,7 +1407,7 @@ instance lifetimes are flexible in this manner and don't have an obvious end
14061407
conventionally ends right after `main()` returns), the host still needs to
14071408
understand the expectations of component authors to enable portability.
14081409

1409-
Before the addition of native concurrency support in Preview 3, a natural
1410+
Before the addition of native concurrency support in [WASI] 0.3, a natural
14101411
expectation is that, in the absence of atypical scenarios like timeouts or quota
14111412
exhaustion, a component author can expect that their component instance will not
14121413
be abruptly terminated during the execution of contained Core WebAssembly code.
@@ -1462,16 +1463,16 @@ waiting on `async` operations to complete.
14621463

14631464
To resolve this tension, threads are implicitly distinguished by a "keep-alive"
14641465
flag that determines whether the expectation is that the existence of the thread
1465-
is intended to keep the containing component instance alive. In the initial
1466-
release of Preview 3, this "keep-alive" flag is default *set* for the [implicit
1467-
thread](#summary) created for a task and default *cleared* for the explicit
1468-
threads created by `thread.new-indirect`. In particular, this means that an
1466+
is intended to keep the containing component instance alive. In [WASI] 0.3,
1467+
this "keep-alive" flag is default *set* for the [implicit thread](#summary)
1468+
created for a task and default *cleared* for the explicit threads created by
1469+
`thread.new-indirect`. In particular, this means that an
14691470
`async callback`-lifted function will keep its containing component instance
14701471
alive until it returns the `EXIT` code (`0`).
14711472

14721473
As an example, in JavaScript, the Service Worker API's [`waitUntil`] method
1473-
would delay returning the `EXIT` code. In the initial 0.3.0 release without
1474-
cooperative threads (🧵), [`setInterval`] would also unfortunately delay
1474+
would delay returning the `EXIT` code. In 0.3.0, without cooperative threads
1475+
(🧵), [`setInterval`] would also unfortunately delay
14751476
returning the `EXIT` code and thus, without guest code intervention, would keep
14761477
component instances alive until timeout limits were hit. The release of
14771478
cooperative threads would offer a solution to this problem, but an awkward one.
@@ -1494,10 +1495,9 @@ the whole tree would be kept alive.
14941495

14951496
## TODO
14961497

1497-
Native async support is being proposed incrementally. The following features
1498-
will be added in future chunks roughly in the order listed to complete the full
1499-
"async" story, with a TBD cutoff between what's in [WASI Preview 3] and what
1500-
comes after:
1498+
Native async support is being added incrementally. Beyond what's currently
1499+
specified, the following features are being considered for addition to complete
1500+
the concurrency story:
15011501
* remove the temporary trap mentioned above that occurs when a `read` and
15021502
`write` of a stream/future happen from within the same component instance
15031503
* zero-copy forwarding/splicing
@@ -1613,7 +1613,7 @@ comes after:
16131613
[wasm-gc]: https://github.com/WebAssembly/gc/blob/main/proposals/gc/MVP.md
16141614
[wasi-libc]: https://github.com/WebAssembly/wasi-libc
16151615

1616-
[WASI Preview 3]: https://github.com/WebAssembly/WASI/tree/main/wasip2#looking-forward-to-preview-3
1616+
[WASI]: https://github.com/WebAssembly/WASI
16171617
[Runtime Instantiation]: https://github.com/WebAssembly/component-model/issues/423
16181618

16191619
[Top-level `await`]: https://github.com/tc39/proposal-top-level-await

design/mvp/Explainer.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,27 @@ more user-focused explanation, take a look at the
3939
* [ESM-integration](#ESM-integration)
4040
* [Examples](#examples)
4141

42+
(Based on the previous [scoping and layering] proposal to the WebAssembly CG,
43+
this repo merges and supersedes the [module-linking] and [interface-types]
44+
proposals, pushing some of their original features into the post-MVP [future
45+
feature](FutureFeatures.md) backlog.)
46+
47+
4248
## Gated Features
4349

4450
By default, the features described in this explainer (as well as the supporting
4551
[Binary.md](Binary.md), [WIT.md](WIT.md) and [CanonicalABI.md](CanonicalABI.md))
46-
have been implemented and are included in the [WASI Preview 2] stability
47-
milestone. Features that are not part of Preview 2 are demarcated by one of the
48-
emoji symbols listed below; these emojis will be removed once they are
49-
implemented, considered stable and included in a future milestone:
52+
have been implemented and are included in the [WASI] 0.2 Developer Preview
53+
release. The WASI 0.3 Developer Preview release additionally includes the
54+
features gated by 🔀.
55+
56+
The other features, in various stages of implementation, polish and release,
57+
are gated by the following emojis and, when ready, may be included in
58+
subsequent WASI Developer Preview minor releases:
5059
* 🪙: value imports/exports and component-level start function
5160
* 🪺: nested namespaces and packages in import/export names
52-
* 🔀: async
53-
* 🚝: enabling more canonical ABI options on more async-related builtins
54-
* 🚟: using `async` with `canon lift` without `callback` (stackful lift)
61+
* 🚝: enabling more canonical ABI options on more async-related builtins
62+
* 🚟: using `async` with `canon lift` without `callback` (stackful lift)
5563
* 🧵: threading built-ins
5664
* 🧵②: [shared-everything-threads]-based threading built-ins
5765
* 🔧: fixed-length lists
@@ -61,11 +69,6 @@ implemented, considered stable and included in a future milestone:
6169
* 🗺️: the `map` type
6270
* 🏷️: `implements` annotations for plain-named interface imports/exports
6371

64-
(Based on the previous [scoping and layering] proposal to the WebAssembly CG,
65-
this repo merges and supersedes the [module-linking] and [interface-types]
66-
proposals, pushing some of their original features into the post-MVP [future
67-
feature](FutureFeatures.md) backlog.)
68-
6972

7073
## Grammar
7174

@@ -2945,7 +2948,7 @@ have a `canonversion`, and the concatenation of the `canonversion` and
29452948
For compatibility with older versions of this spec, non-canonical
29462949
`interfacename`s (with `interfaceversion`s matching any `valid semver`) are
29472950
temporarily permitted. These non-canonical names may trigger warnings and will
2948-
start being rejected some time after after [WASI Preview 3] is released.
2951+
be rejected at some point in the future.
29492952

29502953

29512954
## Component Invariants
@@ -3319,8 +3322,7 @@ For some use-case-focused, worked examples, see:
33193322
[memory64]: https://github.com/webAssembly/memory64
33203323
[`rectype`]: https://webassembly.github.io/gc/core/text/types.html#text-rectype
33213324
[shared-everything-threads]: https://github.com/WebAssembly/shared-everything-threads
3322-
[WASI Preview 2]: https://github.com/WebAssembly/WASI/tree/main/wasip2#readme
3323-
[WASI Preview 3]: https://github.com/WebAssembly/WASI/tree/main/wasip2#looking-forward-to-preview-3
3325+
[WASI]: https://github.com/WebAssembly/WASI
33243326
[reference types]: https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md
33253327
[GC ABI Option]: https://github.com/WebAssembly/component-model/issues/525
33263328

design/mvp/Linking.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ address this use case *above* the Component Model, using an interface defined
290290
in [WIT] and allowing different platforms and applications to tailor the
291291
interface to their needs.
292292

293-
For example, using the Preview 2 feature set of Component Model, a simple
293+
For example, using the current feature set of the Component Model, a simple
294294
dynamic plugin interface might look like the following:
295295
```wit
296296
interface plugin-loader {
@@ -314,7 +314,7 @@ plugins (e.g., on upload to the store or registry) into a native shared object
314314
or DLL that can be efficiently loaded at runtime.
315315

316316
(There are a number of ways to improve upon this basic design with additional
317-
post-Preview 2 features of WIT and the Component Model.)
317+
future features of WIT and the Component Model.)
318318

319319

320320
[Canonical ABI]: CanonicalABI.md

design/mvp/WIT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The `wit` format
1+
# The WIT text format
22

33
The Wasm Interface Type (WIT) format is an [IDL] to provide tooling for the
44
[WebAssembly Component Model][components] in two primary ways:

0 commit comments

Comments
 (0)