Skip to content

Commit d8b286c

Browse files
authored
Describe a primitive reactor ABI. (#256)
* Describe a primitive reactor ABI. This adds a new reactor ABI, indicated by exporting the function "_activate". For now, a reactor is just a module which doesn't have a lifetime scoped by a "_start" or "main" function, though it may evolve to include other semantics in the future. * Mention that command and reactor kinds are mutually exclusive. * Rename `_activate` to `_initialize`.
1 parent ef3c605 commit d8b286c

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

design/application-abi.md

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,29 @@ include.
1212
Current Unstable ABI
1313
--------------------
1414

15-
The current WASI unstable ABI specifies only two exports from a WASI
16-
application:
15+
There are two kinds of modules:
1716

18-
- `_start` - the program entry point
19-
- `memory` - linear memory used by the program
17+
- A *command* exports a function named `_start`, with no arguments and no return
18+
values. Environments shall call this function once, after instantiating the
19+
module and all of its dependencies. After this function exits, the instance
20+
is considered terminated and no further use of any of its exports should be
21+
permitted.
2022

21-
The `_start` export must be WebAssembly function and will be used as the program
22-
entry point. This is the default name used by `lld` when linking WebAssembly
23-
modules. The embedder is expected to call this function once the module is
24-
instantiated.
23+
- A *reactor* exports a function named `_initialize`, with no arguments and no
24+
return values. Environments shall call this function once, after instantiating
25+
the module and all of its dependencies. After this function exits, the instance
26+
remains live, and its exports may be accessed.
2527

26-
Many of the current WASI unstable APIs require sharing of linear memory between
27-
the application and the embedder. In order to use any such APIs the WASI module
28-
is expected to export its linear memory under the name `memory`.
28+
These kinds are mutually exclusive; implementations should report an error if
29+
asked to instantiate a module containing exports which declare it to be of
30+
multiple kinds.
31+
32+
Regardless of the kind, all programs accessing WASI APIs also export a linear
33+
memory with the name `memory`. Pointers in WASI API calls are relative to this
34+
memory's index space.
35+
36+
In the future, as the underlying WebAssembly platform offers more features, we
37+
we hope to eliminate the requirement to export all of linear memory.
2938

3039
Planned Stable ABI
3140
------------------

0 commit comments

Comments
 (0)