Skip to content

Commit 8304ec2

Browse files
committed
Add new section heading for 'Canonical ABI' and add introductory blurb for 'Canonical Definitions'
1 parent 20e98fd commit 8304ec2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

design/mvp/Explainer.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ native JavaScript runtimes.
1111
* [Type definitions](#type-definitions)
1212
* [Type checking](#type-checking)
1313
* [Canonical definitions](#canonical-definitions)
14+
* [Canonical ABI](#canonical-built-ins)
1415
* [Canonical built-ins](#canonical-built-ins)
1516
* [Start definitions](#start-definitions)
1617
* [Import and export definitions](#import-and-export-definitions)
@@ -1026,6 +1027,18 @@ isolation than otherwise achievable with a shared global namespace.
10261027

10271028
### Canonical Definitions
10281029

1030+
From the perspective of Core WebAssembly running inside a component, the
1031+
Component Model is an [Embedding]. As such, the Component Model defines the
1032+
Core WebAssembly imports passed to [`module_instantiate`] and how Core
1033+
WebAssembly exports are called via [`func_invoke`]. This allows the Component
1034+
Model to specify how core modules are linked together (as shown above) but it
1035+
also allows the Component Model to arbitrarily synthesize Core WebAssembly
1036+
functions (via [`func_alloc`]) that are imported by Core WebAssembly. These
1037+
synthetic core functions are created via one of several *canonical definitions*
1038+
defined below.
1039+
1040+
#### Canonical ABI
1041+
10291042
To implement or call a component-level function, we need to cross a
10301043
shared-nothing boundary. Traditionally, this problem is solved by defining a
10311044
serialization format. The Component Model MVP uses roughly this same approach,
@@ -1791,6 +1804,11 @@ and will be added over the coming months to complete the MVP proposal:
17911804
[func-import-abbrev]: https://webassembly.github.io/spec/core/text/modules.html#text-func-abbrev
17921805
[`core:version`]: https://webassembly.github.io/spec/core/binary/modules.html#binary-version
17931806

1807+
[Embedding]: https://webassembly.github.io/spec/core/appendix/embedding.html
1808+
[`module_instantiate`]: https://webassembly.github.io/spec/core/appendix/embedding.html#mathrm-module-instantiate-xref-exec-runtime-syntax-store-mathit-store-xref-syntax-modules-syntax-module-mathit-module-xref-exec-runtime-syntax-externval-mathit-externval-ast-xref-exec-runtime-syntax-store-mathit-store-xref-exec-runtime-syntax-moduleinst-mathit-moduleinst-xref-appendix-embedding-embed-error-mathit-error
1809+
[`func_invoke`]: https://webassembly.github.io/spec/core/appendix/embedding.html#mathrm-func-invoke-xref-exec-runtime-syntax-store-mathit-store-xref-exec-runtime-syntax-funcaddr-mathit-funcaddr-xref-exec-runtime-syntax-val-mathit-val-ast-xref-exec-runtime-syntax-store-mathit-store-xref-exec-runtime-syntax-val-mathit-val-ast-xref-appendix-embedding-embed-error-mathit-error
1810+
[`func_alloc`]: https://webassembly.github.io/spec/core/appendix/embedding.html#mathrm-func-alloc-xref-exec-runtime-syntax-store-mathit-store-xref-syntax-types-syntax-functype-mathit-functype-xref-exec-runtime-syntax-hostfunc-mathit-hostfunc-xref-exec-runtime-syntax-store-mathit-store-xref-exec-runtime-syntax-funcaddr-mathit-funcaddr
1811+
17941812
[`WebAssembly.instantiate()`]: https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/instantiate
17951813
[`FinalizationRegistry`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/FinalizationRegistry
17961814

0 commit comments

Comments
 (0)