Skip to content

Commit

Permalink
Move specs to the website (#558)
Browse files Browse the repository at this point in the history
* Vendor in panr/hugo-theme-hello-friend#292 main.js

Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Anuraag Agrawal <[email protected]>
Co-authored-by: Anuraag Agrawal <[email protected]>
  • Loading branch information
codefromthecrypt and anuraaga authored May 13, 2022
1 parent 5f64ce0 commit b50bb93
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 144 deletions.
134 changes: 0 additions & 134 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,133 +178,6 @@ differentiator between wazero and alternatives.
We verify zero dependencies by running tests in Docker's [scratch image][12].
This approach ensures compatibility with any parent image.

## Specifications

wazero understands that while no-one desired to create confusion, confusion
exists both in what is a standard and what in practice is in fact a standard
feature. To help with this, we created some guidance both on the status quo
of WebAssembly portability and what we support.

The WebAssembly Core Specification is the only specification relevant to
wazero, governed by a standards body. Release [1.0][1] is a Web Standard (REC).
Release [2.0][2] is a Working Draft (WD), so not yet a Web Standard.

Many compilers implement system calls using the WebAssembly System Interface,
[WASI][5]. WASI is a WebAssembly community [subgroup][4], but has not published
any working drafts as a result of their work. WASI's last stable point was
[wasi_snapshot_preview1][13], tagged at the end of 2020.

While this seems scary, the confusion caused by pre-standard features is not as
bad as it sounds. The WebAssembly ecosystem is generally responsive regardless
of where things are written down and wazero provides tools, such as built-in
support for WASI, to reduce pain.

The goal of this section isn't to promote a W3C recommendation exclusive
approach, rather to help you understand common language around portable
features and which of those wazero supports at the moment. While we consider
features formalized through W3C recommendation status mandatory, we actively
pursue pre-standard features as well interop with commonly used infrastructure
such as AssemblyScript.

In summary, we hope this section can guide you in terms of what wazero supports
as well as how to classify a request for a feature we don't yet support.

### WebAssembly Core
wazero conforms with [spectests][7] defined alongside WebAssembly Core
Specification [1.0][1]. This is the default [RuntimeConfig][18].

The WebAssembly Core Specification [2.0][2] is in draft form and wazero has
[work in progress][14] towards that. Opt in via the below configuration:
```go
rConfig = wazero.NewRuntimeConfig().WithWasmCore2()
```

One current limitation of wazero is that it doesn't fully implement the Text
Format, yet, e.g. compiling `.wat` files. The intent is to [finish this][15],
and meanwhile users can work around this using tools such as `wat2wasm` to
compile the text format into the binary format. In practice, the text format is
too low level for most users, so delays here have limited impact.

#### Post 2.0 Features
Features regardless of W3C release are inventoried in the [Proposals][16].
repository. wazero implements [Finished Proposals][17] based on user demand,
using [wazero.RuntimeConfig][18] feature flags.

Features not yet assigned to a W3C release are not reliable. Encourage the
[WebAssembly community][19] to formalize features you rely on, so that they
become assigned to a release, and reach the W3C recommendation (REC) phase.

### WebAssembly System Interface (WASI)

Many compilers implement system calls using the WebAssembly System Interface,
[WASI][5]. WASI is a WebAssembly community [subgroup][4], but has not published
any working drafts as a result of their work. WASI's last stable point was
[wasi_snapshot_preview1][13], tagged at the end of 2020.

Some functions in this tag are used in practice while some others are not known
to be used at all. Further confusion exists because some compilers, like
GrainLang, import functions not used. Finally, [wasi_snapshot_preview1][13]
includes features such as "rights" that [will be removed][20].

For all of these reasons, wazero will not implement all WASI features, just to
complete the below chart. If you desire something not yet implemented, please
[raise an issue](https://github.com/tetratelabs/wazero/issues/new) and include
your use case (ex which language you are using to compile, a.k.a. target Wasm).

<details><summary>Click to see the full list of supported WASI functions</summary>
<p>

| Function | Status | Known Usage |
|:-----------------------:|:------:|---------------:|
| args_get || TinyGo |
| args_sizes_get || TinyGo |
| environ_get || TinyGo |
| environ_sizes_get || TinyGo |
| clock_res_get || |
| clock_time_get || TinyGo |
| fd_advise || |
| fd_allocate || |
| fd_close || TinyGo |
| fd_datasync || |
| fd_fdstat_get || TinyGo |
| fd_fdstat_set_flags || |
| fd_fdstat_set_rights || |
| fd_filestat_get || |
| fd_filestat_set_size || |
| fd_filestat_set_times || |
| fd_pread || |
| fd_prestat_get || TinyGo,`fs.FS` |
| fd_prestat_dir_name || TinyGo |
| fd_pwrite || |
| fd_read || TinyGo,`fs.FS` |
| fd_readdir || |
| fd_renumber || |
| fd_seek || TinyGo |
| fd_sync || |
| fd_tell || |
| fd_write || `fs.FS` |
| path_create_directory || |
| path_filestat_get || |
| path_filestat_set_times || |
| path_link || |
| path_open || TinyGo,`fs.FS` |
| path_readlink || |
| path_remove_directory || |
| path_rename || |
| path_symlink || |
| path_unlink_file || |
| poll_oneoff || TinyGo |
| proc_exit || AssemblyScript |
| proc_raise || |
| sched_yield || |
| random_get || |
| sock_recv || |
| sock_send || |
| sock_shutdown || |

</p>
</details>

-----
wazero is a registered trademark of Tetrate.io, Inc. in the United States and/or other countries

Expand All @@ -321,10 +194,3 @@ wazero is a registered trademark of Tetrate.io, Inc. in the United States and/or
[11]: https://github.com/actions/virtual-environments
[12]: https://docs.docker.com/develop/develop-images/baseimages/#create-a-simple-parent-image-using-scratch
[13]: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md
[14]: https://github.com/tetratelabs/wazero/issues/484
[15]: https://github.com/tetratelabs/wazero/issues/59
[16]: https://github.com/WebAssembly/proposals
[17]: https://github.com/WebAssembly/proposals/blob/main/finished-proposals.md
[18]: https://pkg.go.dev/github.com/tetratelabs/wazero#RuntimeConfig
[19]: https://www.w3.org/community/webassembly/
[20]: https://github.com/WebAssembly/WASI/issues/469#issuecomment-1045251844
30 changes: 20 additions & 10 deletions site/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,24 @@ theme = "hello-friend"
identifier = "community"
name = "Community"
weight = 3
[[languages.en.menu.main]]
parent = "community"
url = "https://github.com/tetratelabs/wazero"
name = "GitHub"
weight = 1
[[languages.en.menu.main]]
parent = "community"
url = "/history/"
identifier = "history"
name = "History"
weight = 2
[[languages.en.menu.main]]
parent = "community"
url = "https://github.com/tetratelabs/wazero"
name = "GitHub"
weight = 1
[[languages.en.menu.main]]
parent = "community"
url = "/history/"
identifier = "history"
name = "History"
weight = 2
identifier = "appendix"
name = "Appendix"
weight = 4
[[languages.en.menu.main]]
parent = "appendix"
url = "/specs/"
identifier = "specs"
name = "Specifications"
weight = 1
142 changes: 142 additions & 0 deletions site/content/specs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
+++
title = "Specifications"
+++

wazero understands that while no-one desired to create confusion, confusion
exists both in what is a standard and what in practice is in fact a standard
feature. To help with this, we created some guidance both on the status quo
of WebAssembly portability and what we support.

The WebAssembly Core Specification is the only specification relevant to
wazero, governed by a standards body. Release [1.0][1] is a Web Standard (REC).
Release [2.0][2] is a Working Draft (WD), so not yet a Web Standard.

Many compilers implement system calls using the WebAssembly System Interface,
[WASI][5]. WASI is a WebAssembly community [subgroup][3], but has not published
any working drafts as a result of their work. WASI's last stable point was
[wasi_snapshot_preview1][4], tagged at the end of 2020.

While this seems scary, the confusion caused by pre-standard features is not as
bad as it sounds. The WebAssembly ecosystem is generally responsive regardless
of where things are written down and wazero provides tools, such as built-in
support for WASI, to reduce pain.

The goal of this section isn't to promote a W3C recommendation exclusive
approach, rather to help you understand common language around portable
features and which of those wazero supports at the moment. While we consider
features formalized through W3C recommendation status mandatory, we actively
pursue pre-standard features as well interop with commonly used infrastructure
such as AssemblyScript.

In summary, we hope this section can guide you in terms of what wazero supports
as well as how to classify a request for a feature we don't yet support.

### WebAssembly Core
wazero conforms with [spectests][6] defined alongside WebAssembly Core
Specification [1.0][1]. This is the default [RuntimeConfig][7].

The WebAssembly Core Specification [2.0][2] is in draft form and wazero has
[work in progress][8] towards that. Opt in via the below configuration:
```go
rConfig = wazero.NewRuntimeConfig().WithWasmCore2()
```

One current limitation of wazero is that it doesn't fully implement the Text
Format, yet, e.g. compiling `.wat` files. The intent is to [finish this][9],
and meanwhile users can work around this using tools such as `wat2wasm` to
compile the text format into the binary format. In practice, the text format is
too low level for most users, so delays here have limited impact.

#### Post 2.0 Features
Features regardless of W3C release are inventoried in the [Proposals][10].
repository. wazero implements [Finished Proposals][11] based on user demand,
using [wazero.RuntimeConfig][7] feature flags.

Features not yet assigned to a W3C release are not reliable. Encourage the
[WebAssembly community][12] to formalize features you rely on, so that they
become assigned to a release, and reach the W3C recommendation (REC) phase.

### WebAssembly System Interface (WASI)

Many compilers implement system calls using the WebAssembly System Interface,
[WASI][5]. WASI is a WebAssembly community [subgroup][3], but has not published
any working drafts as a result of their work. WASI's last stable point was
[wasi_snapshot_preview1][4], tagged at the end of 2020.

Some functions in this tag are used in practice while some others are not known
to be used at all. Further confusion exists because some compilers, like
GrainLang, import functions not used. Finally, [wasi_snapshot_preview1][4]
includes features such as "rights" that [will be removed][13].

For all of these reasons, wazero will not implement all WASI features, just to
complete the below chart. If you desire something not yet implemented, please
[raise an issue](https://github.com/tetratelabs/wazero/issues/new) and include
your use case (ex which language you are using to compile, a.k.a. target Wasm).

<details><summary>Click to see the full list of supported WASI functions</summary>
<p>

| Function | Status | Known Usage |
|:-----------------------:|:------:|---------------:|
| args_get || TinyGo |
| args_sizes_get || TinyGo |
| environ_get || TinyGo |
| environ_sizes_get || TinyGo |
| clock_res_get || |
| clock_time_get || TinyGo |
| fd_advise || |
| fd_allocate || |
| fd_close || TinyGo |
| fd_datasync || |
| fd_fdstat_get || TinyGo |
| fd_fdstat_set_flags || |
| fd_fdstat_set_rights || |
| fd_filestat_get || |
| fd_filestat_set_size || |
| fd_filestat_set_times || |
| fd_pread || |
| fd_prestat_get || TinyGo,`fs.FS` |
| fd_prestat_dir_name || TinyGo |
| fd_pwrite || |
| fd_read || TinyGo,`fs.FS` |
| fd_readdir || |
| fd_renumber || |
| fd_seek || TinyGo |
| fd_sync || |
| fd_tell || |
| fd_write || `fs.FS` |
| path_create_directory || |
| path_filestat_get || |
| path_filestat_set_times || |
| path_link || |
| path_open || TinyGo,`fs.FS` |
| path_readlink || |
| path_remove_directory || |
| path_rename || |
| path_symlink || |
| path_unlink_file || |
| poll_oneoff || TinyGo |
| proc_exit || AssemblyScript |
| proc_raise || |
| sched_yield || |
| random_get || |
| sock_recv || |
| sock_send || |
| sock_shutdown || |

</p>
</details>

[1]: https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/
[2]: https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/
[3]: https://github.com/WebAssembly/meetings/blob/main/process/subgroups.md
[4]: https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md
[5]: https://github.com/WebAssembly/WASI
[6]: https://github.com/WebAssembly/spec/tree/wg-1.0/test/core
[7]: https://pkg.go.dev/github.com/tetratelabs/wazero#RuntimeConfig
[8]: https://github.com/tetratelabs/wazero/issues/484
[9]: https://github.com/tetratelabs/wazero/issues/59
[10]: https://github.com/WebAssembly/proposals
[11]: https://github.com/WebAssembly/proposals/blob/main/finished-proposals.md
[12]: https://www.w3.org/community/webassembly/
[13]: https://github.com/WebAssembly/WASI/issues/469#issuecomment-1045251844
1 change: 1 addition & 0 deletions site/static/assets/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b50bb93

Please sign in to comment.