Skip to content

Commit

Permalink
Merge pull request #113 from Wasm-DSL/exn
Browse files Browse the repository at this point in the history
Merge/spec exception handling
  • Loading branch information
f52985 authored Aug 20, 2024
2 parents 690e379 + 75f435c commit 5c8b747
Show file tree
Hide file tree
Showing 194 changed files with 26,381 additions and 6,938 deletions.
83 changes: 76 additions & 7 deletions .github/workflows/ci-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
# - name: Setup Bikeshed
# run: pip install bikeshed && bikeshed update
- name: Setup Bikeshed
run: pip install bikeshed && bikeshed update
- name: Setup TexLive
run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
- name: Setup Sphinx
Expand All @@ -40,8 +40,8 @@ jobs:
run: cd spectec && opam exec make
- name: Build main spec
run: cd document/core && opam exec make main
# - name: Run Bikeshed
# run: cd document/core && opam exec make bikeshed
- name: Run Bikeshed
# run: cd document/core && opam exec make bikeshed
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -56,7 +56,7 @@ jobs:
- name: Setup Bikeshed
run: pip install bikeshed && bikeshed update
- name: Run Bikeshed
run: bikeshed spec "document/js-api/index.bs" "document/js-api/index.html"
# run: bikeshed spec "document/js-api/index.bs" "document/js-api/index.html"
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
Expand All @@ -71,16 +71,70 @@ jobs:
- name: Setup Bikeshed
run: pip install bikeshed && bikeshed update
- name: Run Bikeshed
run: bikeshed spec "document/web-api/index.bs" "document/web-api/index.html"
# run: bikeshed spec "document/web-api/index.bs" "document/web-api/index.html"
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: web-api-rendered
path: document/web-api/index.html

build-code-metadata-spec:
runs-on: ubuntu-latest
needs: [build-core-spec]
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Setup TexLive
run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
- name: Setup Sphinx
run: pip install six && pip install sphinx==5.1.0
- name: Build main spec
run: cd document/metadata/code && make main
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: code-metadata-rendered
path: document/metadata/code/_build/html

build-legacy-exceptions-core-spec:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Setup TexLive
run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
- name: Setup Sphinx
run: pip install six && pip install sphinx==5.1.0
- name: Build main spec
run: cd document/legacy/exceptions/core && make main
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: legacy-exceptions-core-rendered
path: document/legacy/exceptions/core/_build/html

build-legacy-exceptions-js-api-spec:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Bikeshed
run: pip install bikeshed && bikeshed update
- name: Run Bikeshed
# run: bikeshed spec "document/legacy/exceptions/js-api/index.bs" "document/legacy/exceptions/js-api/index.html"
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: legacy-exceptions-js-api-rendered
path: document/legacy/exceptions/js-api/index.html

publish-spec:
runs-on: ubuntu-latest
needs: [build-core-spec, build-js-api-spec, build-web-api-spec]
needs: [build-core-spec, build-js-api-spec, build-web-api-spec, build-code-metadata-spec, build-legacy-exceptions-core-spec, build-legacy-exceptions-js-api-spec]
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand All @@ -101,6 +155,21 @@ jobs:
with:
name: web-api-rendered
path: _output/web-api
- name: Download code metadata spec artifact
uses: actions/download-artifact@v2
with:
name: code-metadata-rendered
path: _output/metadata/code
- name: Download legacy exceptions core spec artifact
uses: actions/download-artifact@v2
with:
name: legacy-exceptions-core-rendered
path: _output/legacy/exceptions/core
- name: Download legacy exceptions JS API spec artifact
uses: actions/download-artifact@v2
with:
name: legacy-exceptions-js-api-rendered
path: _output/legacy/exceptions/js-api
- name: Publish to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
Expand Down
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,11 @@ Original `README` from upstream repository follows...

# spec

This repository holds a prototypical reference implementation for WebAssembly,
which is currently serving as the official specification. Eventually, we expect
to produce a specification either written in human-readable prose or in a formal
specification language.
This repository holds the sources for the WebAssembly specification,
a reference implementation, and the official test suite.

It also holds the WebAssembly testsuite, which tests numerous aspects of
conformance to the spec.

View the work-in-progress spec at [webassembly.github.io/spec](https://webassembly.github.io/spec/).

At this time, the contents of this repository are under development and known
to be "incomplet and inkorrect".
A formatted version of the spec is available here:
[webassembly.github.io/spec](https://webassembly.github.io/spec/),

Participation is welcome. Discussions about new features, significant semantic
changes, or any specification change likely to generate substantial discussion
Expand Down
49 changes: 0 additions & 49 deletions deploy_key

This file was deleted.

1 change: 0 additions & 1 deletion deploy_key.pub

This file was deleted.

2 changes: 1 addition & 1 deletion document/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DIRS = js-api web-api core
DIRS = core js-api web-api metadata/code legacy/exceptions
FILES = index.html
BUILDDIR = _build
TAR = tar
Expand Down
24 changes: 23 additions & 1 deletion document/core/appendix/algorithm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Value types are representable as sets of enumerations:
type vec_type = V128
type heap_type =
Any | Eq | I31 | Struct | Array | None |
Func | Nofunc | Extern | Noextern | Bot |
Func | Nofunc | Exn | Noexn | Extern | Noextern | Bot |
Def(def : def_type)
type ref_type = Ref(heap : heap_type, null : bool)
type val_type = num_type | vec_type | ref_type | Bot
Expand Down Expand Up @@ -445,6 +445,28 @@ Other instructions are checked in a similar manner.
pop_val(Ref(Def(types[x])))
pop_val(unpack_field(st.fields[n]))
case (throw x)
pop_vals(tags[x].type.params)
unreachable()
case (try_table t1*->t2* handler*)
pop_vals([t1*])
foreach (handler in handler*)
error_if(ctrls.size() < handler.label)
push_ctrl(catch, [], label_types(ctrls[handler.label]))
switch (handler.clause)
case (catch x)
push_vals(tags[x].type.params)
case (catch_ref x)
push_vals(tags[x].type.params)
push_val(Exnref)
case (catch_all)
skip
case (catch_all_ref)
push_val(Exnref)
pop_ctrl()
push_ctrl(try_table, [t1*], [t2*])
.. note::
It is an invariant under the current WebAssembly instruction set that an operand of :code:`Bot` type is never duplicated on the stack.
This would change if the language were extended with stack instructions like :code:`dup`.
Expand Down
Loading

0 comments on commit 5c8b747

Please sign in to comment.