Skip to content

Commit 06cc296

Browse files
authored
Merge pull request #23 from WebAssembly/canonical-abi
Fill in CanonicalABI.md
2 parents 85a2b00 + bf73065 commit 06cc296

File tree

10 files changed

+2770
-123
lines changed

10 files changed

+2770
-123
lines changed

.github/workflows/main.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
canonical_abi:
9+
name: Run Canonical ABI Tests
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v3
14+
with:
15+
python-version: '>= 3.10.0'
16+
- run: python design/mvp/canonical-abi/run_tests.py

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Component Model design and specification
22

33
This repository describes the high-level [goals], [use cases], [design choices]
4-
and [FAQ] of the component model as well as a more-detailed [explainer] and
5-
[binary format] covering the initial Minimum Viable Product (MVP) release.
4+
and [FAQ] of the component model as well as a more-detailed [explainer],
5+
[binary format] and [ABI] covering the initial Minimum Viable Product (MVP)
6+
release.
67

78
In the future, this repository will additionally contain a [formal spec],
89
reference interpreter and test suite.
@@ -20,6 +21,7 @@ To contribute to any of these repositories, see the Community Group's
2021
[FAQ]: design/high-level/FAQ.md
2122
[explainer]: design/mvp/Explainer.md
2223
[binary format]: design/mvp/Binary.md
24+
[ABI]: design/mvp/CanonicalABI.md
2325
[formal spec]: spec/
2426
[W3C WebAssembly Community Group]: https://www.w3.org/community/webassembly/
2527
[Contributing Guidelines]: https://webassembly.org/community/contributing/

design/mvp/Binary.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,26 @@ Notes:
188188
func ::= body:<funcbody> => (func body)
189189
funcbody ::= 0x00 ft:<typeidx> opt*:vec(<canonopt>) f:<funcidx> => (canon.lift ft opt* f)
190190
| 0x01 opt*:<canonopt>* f:<funcidx> => (canon.lower opt* f)
191-
canonopt ::= 0x00 => string=utf8
192-
| 0x01 => string=utf16
193-
| 0x02 => string=latin1+utf16
194-
| 0x03 i:<instanceidx> => (into i)
191+
canonopt ::= 0x00 => string-encoding=utf8
192+
| 0x01 => string-encoding=utf16
193+
| 0x02 => string-encoding=latin1+utf16
194+
| 0x03 m:<memidx> => (memory m)
195+
| 0x04 f:<funcidx> => (realloc f)
196+
| 0x05 f:<funcidx> => (post-return f)
195197
```
196198
Notes:
197199
* Validation prevents duplicate or conflicting options.
198-
* Validation of `canon.lift` requires `f` to have a `core:functype` that matches
199-
the canonical-ABI-defined lowering of `ft`. The function defined by
200-
`canon.lift` has type `ft`.
201-
* Validation of `canon.lower` requires `f` to have a `functype`. The function
202-
defined by `canon.lower` has a `core:functype` defined by the canonical ABI
203-
lowering of `f`'s type.
200+
* Validation of `canon.lift` requires `f` to have type `flatten(ft)` (defined
201+
by the [Canonical ABI](CanonicalABI.md#flattening)). The function being
202+
defined is given type `ft`.
203+
* Validation of `canon.lower` requires `f` to be a component function. The
204+
function being defined is given core function type `flatten(ft)` where `ft`
205+
is the `functype` of `f`.
204206
* If the lifting/lowering operations implied by `canon.lift` or `canon.lower`
205-
require access to `memory`, `realloc` or `free`, then validation will require
206-
the `(into i)` `canonopt` be present and the corresponding export be present
207-
in `i`'s `instancetype`.
207+
require access to `memory` or `realloc`, then validation requires these
208+
options to be present. If present, `realloc` must have type
209+
`(func (param i32 i32 i32 i32) (result i32))`.
210+
* `post-return` is always optional, but, if present, must have type `(func)`.
208211

209212

210213
## Start Definitions

0 commit comments

Comments
 (0)