Skip to content

Commit 23a6198

Browse files
authored
Merge pull request #17 from WebAssembly/merge-upstream
Merge upstream
2 parents aa10cd8 + 88ec321 commit 23a6198

File tree

220 files changed

+101967
-1647
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+101967
-1647
lines changed

.github/workflows/main.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
jobs:
13+
ref-interpreter:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Setup OCaml
18+
uses: ocaml/setup-ocaml@v2
19+
with:
20+
ocaml-compiler: 4.12.x
21+
- run: opam install --yes ocamlbuild.0.14.0
22+
- run: cd interpreter && opam exec make all
23+
24+
build-js-api-spec:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- run: pip install bikeshed && bikeshed update
29+
- run: bikeshed spec "document/js-api/index.bs" "document/js-api/index.html"
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
name: js-api-rendered
33+
path: document/js-api/index.html
34+
35+
build-web-api-spec:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v2
39+
- run: pip install bikeshed && bikeshed update
40+
- run: bikeshed spec "document/web-api/index.bs" "document/web-api/index.html"
41+
- uses: actions/upload-artifact@v2
42+
with:
43+
name: web-api-rendered
44+
path: document/web-api/index.html
45+
46+
build-core-spec:
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v2
50+
with:
51+
submodules: "recursive"
52+
- run: pip install bikeshed && bikeshed update
53+
- run: pip install six
54+
- run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
55+
- run: pip install sphinx==4.0.0
56+
- run: cd document/core && make all
57+
- uses: actions/upload-artifact@v2
58+
with:
59+
name: core-api-rendered
60+
path: document/core/_build/html
61+
62+
publish-spec:
63+
runs-on: ubuntu-latest
64+
needs: [build-core-spec, build-js-api-spec, build-web-api-spec]
65+
steps:
66+
- uses: actions/checkout@v2
67+
- run: mkdir _output && cp document/index.html _output/index.html
68+
- uses: actions/download-artifact@v2
69+
with:
70+
name: js-api-rendered
71+
path: _output/js-api
72+
- uses: actions/download-artifact@v2
73+
with:
74+
name: web-api-rendered
75+
path: _output/web-api
76+
- uses: actions/download-artifact@v2
77+
with:
78+
name: core-api-rendered
79+
path: _output/core
80+
- name: Publish HTML to GitHub Pages
81+
if: github.ref == 'refs/heads/main'
82+
uses: peaceiris/actions-gh-pages@v3
83+
with:
84+
publish_dir: ./_output
85+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/mirror.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
on:
2+
push:
3+
branches:
4+
- 'main'
5+
6+
jobs:
7+
mirror_job:
8+
runs-on: ubuntu-latest
9+
name: Mirror main branch to master branch
10+
steps:
11+
- name: Mirror action step
12+
id: mirror
13+
uses: google/[email protected]
14+
with:
15+
github-token: ${{ secrets.GITHUB_TOKEN }}
16+
source: 'main'
17+
dest: 'master'

.travis.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

Contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
Interested in participating? Please follow
44
[the same contributing guidelines as the design repository][].
55

6-
[the same contributing guidelines as the design repository]: https://github.com/WebAssembly/design/blob/master/Contributing.md
6+
[the same contributing guidelines as the design repository]: https://github.com/WebAssembly/design/blob/main/Contributing.md
77

88
Also, please be sure to read [the README.md](README.md) for this repository.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/WebAssembly/tail-call.svg?branch=master)](https://travis-ci.org/WebAssembly/tail-call)
1+
![Build Status](https://github.com/WebAssembly/tail-call/actions/workflows/main.yml/badge.svg)
22

33
# Tail Call Proposal for WebAssembly
44

deploy_key.enc

-3.28 KB
Binary file not shown.

document/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pipenv shell
4242
Install Python dependencies:
4343

4444
```
45-
pipenv install Sphinx==3.5.2
45+
pipenv install Sphinx==4.0.0
4646
```
4747

4848
### Checking out the repository

document/core/appendix/algorithm.rst

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ Types are representable as an enumeration.
2525

2626
.. code-block:: pseudo
2727
28-
type val_type = I32 | I64 | F32 | F64 | Funcref | Externref
28+
type val_type = I32 | I64 | F32 | F64 | V128 | Funcref | Externref
2929
3030
func is_num(t : val_type | Unknown) : bool =
3131
return t = I32 || t = I64 || t = F32 || t = F64 || t = Unknown
3232
33+
func is_vec(t : val_type | Unknown) : bool =
34+
return t = V128 || t = Unknown
35+
3336
func is_ref(t : val_type | Unknown) : bool =
3437
return t = Funcref || t = Externref || t = Unknown
3538
@@ -75,15 +78,13 @@ However, these variables are not manipulated directly by the main checking funct
7578
7679
func pop_val(expect : val_type | Unknown) : val_type | Unknown =
7780
let actual = pop_val()
78-
if (actual = Unknown) return expect
79-
if (expect = Unknown) return actual
80-
error_if(actual =/= expect)
81+
error_if(actual =/= expect && actual =/= Unknown && expect =/= Unknown)
8182
return actual
8283
8384
func push_vals(types : list(val_type)) = foreach (t in types) push_val(t)
8485
func pop_vals(types : list(val_type)) : list(val_type) =
8586
var popped := []
86-
foreach (t in reverse(types)) popped.append(pop_val(t))
87+
foreach (t in reverse(types)) popped.prepend(pop_val(t))
8788
return popped
8889
8990
Pushing an operand value simply pushes the respective type to the value stack.
@@ -109,24 +110,24 @@ The control stack is likewise manipulated through auxiliary functions:
109110
.. code-block:: pseudo
110111
111112
func push_ctrl(opcode : opcode, in : list(val_type), out : list(val_type)) =
112-
 let frame = ctrl_frame(opcode, in, out, vals.size(), false)
113-
  ctrls.push(frame)
113+
let frame = ctrl_frame(opcode, in, out, vals.size(), false)
114+
ctrls.push(frame)
114115
push_vals(in)
115116
116117
func pop_ctrl() : ctrl_frame =
117-
 error_if(ctrls.is_empty())
118-
 let frame = ctrls[0]
119-
  pop_vals(frame.end_types)
120-
  error_if(vals.size() =/= frame.height)
118+
error_if(ctrls.is_empty())
119+
let frame = ctrls[0]
120+
pop_vals(frame.end_types)
121+
error_if(vals.size() =/= frame.height)
121122
ctrls.pop()
122-
  return frame
123+
return frame
123124
124125
func label_types(frame : ctrl_frame) : list(val_types) =
125126
return (if frame.opcode == loop then frame.start_types else frame.end_types)
126127
127128
func unreachable() =
128-
  vals.resize(ctrls[0].height)
129-
  ctrls[0].unreachable := true
129+
vals.resize(ctrls[0].height)
130+
ctrls[0].unreachable := true
130131
131132
Pushing a control frame takes the types of the label and result values.
132133
It allocates a new frame record recording them along with the current height of the operand stack and marks the block as reachable.
@@ -174,7 +175,7 @@ Other instructions are checked in a similar manner.
174175
pop_val(I32)
175176
let t1 = pop_val()
176177
let t2 = pop_val()
177-
error_if(not (is_num(t1) && is_num(t2)))
178+
error_if(not ((is_num(t1) && is_num(t2)) || (is_vec(t1) && is_vec(t2))))
178179
error_if(t1 =/= t2 && t1 =/= Unknown && t2 =/= Unknown)
179180
push_val(if (t1 = Unknown) t2 else t1)
180181
@@ -184,8 +185,8 @@ Other instructions are checked in a similar manner.
184185
pop_val(t)
185186
push_val(t)
186187
187-
   case (unreachable)
188-
      unreachable()
188+
case (unreachable)
189+
unreachable()
189190
190191
case (block t1*->t2*)
191192
pop_vals([t1*])
@@ -210,26 +211,26 @@ Other instructions are checked in a similar manner.
210211
push_ctrl(else, frame.start_types, frame.end_types)
211212
212213
case (br n)
213-
     error_if(ctrls.size() < n)
214-
      pop_vals(label_types(ctrls[n]))
215-
      unreachable()
214+
error_if(ctrls.size() < n)
215+
pop_vals(label_types(ctrls[n]))
216+
unreachable()
216217
217218
case (br_if n)
218-
     error_if(ctrls.size() < n)
219+
error_if(ctrls.size() < n)
219220
pop_val(I32)
220-
      pop_vals(label_types(ctrls[n]))
221-
      push_vals(label_types(ctrls[n]))
221+
pop_vals(label_types(ctrls[n]))
222+
push_vals(label_types(ctrls[n]))
222223
223-
   case (br_table n* m)
224+
case (br_table n* m)
224225
pop_val(I32)
225-
      error_if(ctrls.size() < m)
226+
error_if(ctrls.size() < m)
226227
let arity = label_types(ctrls[m]).size()
227-
      foreach (n in n*)
228-
        error_if(ctrls.size() < n)
229-
        error_if(label_types(ctrls[n]).size() =/= arity)
228+
foreach (n in n*)
229+
error_if(ctrls.size() < n)
230+
error_if(label_types(ctrls[n]).size() =/= arity)
230231
push_vals(pop_vals(label_types(ctrls[n])))
231232
pop_vals(label_types(ctrls[m]))
232-
      unreachable()
233+
unreachable()
233234
234235
235236
.. note::

document/core/appendix/changes.rst

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,54 @@ Added instructions that modify ranges of memory or table entries [#proposal-reft
104104
* Active data and element segments boundaries are no longer checked at compile time but may trap instead
105105

106106

107+
.. index:: instructions, SIMD, value type, vector type
108+
109+
Vector instructions
110+
...................
111+
112+
Added vector type and instructions that manipulate multiple numeric values in parallel (also known as *SIMD*, single instruction multiple data) [#proposal-vectype]_
113+
114+
* New :ref:`value type <syntax-valtype>`: |V128|
115+
116+
* New :ref:`memory instructions <syntax-instr-memory>`: :math:`\K{v128.}\LOAD`, :math:`\K{v128.}\LOAD{}\!N\!\K{x}\!M\!\K{\_}\sx`, :math:`\K{v128.}\LOAD{}N\K{\_zero}`, :math:`\K{v128.}\LOAD{}N\K{\_splat}`, :math:`\K{v128.}\LOAD{}N\K{\_lane}`, :math:`\K{v128.}\STORE`, :math:`\K{v128.}\STORE{}N\K{\_lane}`
117+
118+
* New constant :ref:`vector instruction <syntax-instr-vec>`: :math:`\K{v128.}\VCONST`
119+
120+
* New unary :ref:`vector instructions <syntax-instr-vec>`: :math:`\K{v128.not}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.abs}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.neg}`, :math:`\K{i8x16.popcnt}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.abs}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.neg}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.sqrt}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.ceil}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.floor}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.trunc}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.nearest}`
121+
122+
* New binary :ref:`vector instructions <syntax-instr-vec>`: :math:`\K{v128.and}`, :math:`\K{v128.andnot}`, :math:`\K{v128.or}`, :math:`\K{v128.xor}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.add}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.sub}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.mul}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.add\_sat\_}\sx`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.sub\_sat\_}\sx`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.min\_}\sx`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.max\_}\sx`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.shl}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.shr\_}\sx`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.add}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.extmul\_}\half\K{\_i}\!N'\!\K{x}\!M'\!\K{\_}\sx`, :math:`\K{i16x8.q15mulr\_sat\_s}`, :math:`\K{i32x4.dot\_i16x8\_s}`, :math:`\K{i16x8.extadd\_pairwise\_i8x16\_}\sx`, :math:`\K{i32x4.extadd\_pairwise\_i16x8\_}\sx`, :math:`\K{i8x16.avgr\_u}`, :math:`\K{i16x8.avgr\_u}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.sub}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.mul}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.div}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.min}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.max}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.pmin}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.pmax}`
123+
124+
* New ternary :ref:`vector instruction <syntax-instr-vec>`: :math:`\K{v128.bitselect}`
125+
126+
* New test :ref:`vector instructions <syntax-instr-vec>`: :math:`\K{v128.any\_true}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.all\_true}`
127+
128+
* New relational :ref:`vector instructions <syntax-instr-vec>`: :math:`\K{i}\!N\!\K{x}\!M\!\K{.eq}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.ne}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.lt\_}\sx`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.gt\_}\sx`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.le\_}\sx`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.ge\_}\sx`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.eq}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.ne}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.lt}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.gt}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.le}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.ge}`
129+
130+
* New conversion :ref:`vector instructions <syntax-instr-vec>`::math:`\K{i32x4.trunc\_sat\_f32x4\_}\sx`, :math:`\K{i32x4.trunc\_sat\_f64x2\_}\sx\K{\_zero}`, :math:`\K{f32x4.convert\_i32x4\_}\sx`, :math:`\K{f32x4.demote\_f64x2\_zero}`, :math:`\K{f64x2.convert\_low\_i32x4\_}\sx`, :math:`\K{f64x2.promote\_low\_f32x4}`
131+
132+
* New lane access :ref:`vector instructions <syntax-instr-vec>`: :math:`\K{i}\!N\!\K{x}\!M\!\K{.extract\_lane\_}\sx^?`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.replace\_lane}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.extract\_lane}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.replace\_lane}`
133+
134+
* New lane splitting/combining :ref:`vector instructions <syntax-instr-vec>`: :math:`\K{i}\!N\!\K{x}\!M\!\K{.extend\_}\half\K{\_i}\!N'\!\K{x}\!M'\!\K{\_}\sx`, :math:`\K{i8x16.narrow\_i16x8\_}\sx`, :math:`\K{i16x8.narrow\_i32x4\_}\sx`
135+
136+
* New byte reordering :ref:`vector instructions <syntax-instr-vec>`: :math:`\K{i8x16.shuffle}`, :math:`\K{i8x16.swizzle}`
137+
138+
* New injection/projection :ref:`vector instructions <syntax-instr-vec>`: :math:`\K{i}\!N\!\K{x}\!M\!\K{.splat}`, :math:`\K{f}\!N\!\K{x}\!M\!\K{.splat}`, :math:`\K{i}\!N\!\K{x}\!M\!\K{.bitmask}`
139+
140+
107141
.. [#proposal-signext]
108-
https://github.com/WebAssembly/spec/tree/master/proposals/sign-extension-ops/
142+
https://github.com/WebAssembly/spec/tree/main/proposals/sign-extension-ops/
109143
110144
.. [#proposal-cvtsat]
111-
https://github.com/WebAssembly/spec/tree/master/proposals/nontrapping-float-to-int-conversion/
145+
https://github.com/WebAssembly/spec/tree/main/proposals/nontrapping-float-to-int-conversion/
112146
113147
.. [#proposal-multivalue]
114-
https://github.com/WebAssembly/spec/tree/master/proposals/multi-value/
148+
https://github.com/WebAssembly/spec/tree/main/proposals/multi-value/
115149
116150
.. [#proposal-reftype]
117-
https://github.com/WebAssembly/spec/tree/master/proposals/reference-types/
151+
https://github.com/WebAssembly/spec/tree/main/proposals/reference-types/
118152
119153
.. [#proposal-bulk]
120-
https://github.com/WebAssembly/spec/tree/master/proposals/bulk-memory-operations/
154+
https://github.com/WebAssembly/spec/tree/main/proposals/bulk-memory-operations/
155+
156+
.. [#proposal-vectype]
157+
https://github.com/WebAssembly/spec/tree/main/proposals/simd/

0 commit comments

Comments
 (0)