Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 5a8a2d9

Browse files
authored
Merge pull request #26 from WebAssembly/merge-upstream
2 parents 5527fd9 + 6711650 commit 5a8a2d9

File tree

220 files changed

+102133
-1762
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

+102133
-1762
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 & 42 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/multi-memory.svg?branch=master)](https://travis-ci.org/WebAssembly/multi-memory)
1+
![Build Status](https://github.com/WebAssembly/multi-memory/actions/workflows/main.yml/badge.svg)
22

33
# Multi Memory 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: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ 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 =
31-
return t = I32 || t = I64 || t = F32 || t = F64 || t = Unknown
31+
return t = I32 || t = I64 || t = F32 || t = F64 || t = V128 || t = Unknown
3232
3333
func is_ref(t : val_type | Unknown) : bool =
3434
return t = Funcref || t = Externref || t = Unknown
@@ -75,15 +75,13 @@ However, these variables are not manipulated directly by the main checking funct
7575
7676
func pop_val(expect : val_type | Unknown) : val_type | Unknown =
7777
let actual = pop_val()
78-
if (actual = Unknown) return expect
79-
if (expect = Unknown) return actual
80-
error_if(actual =/= expect)
78+
error_if(actual =/= expect && actual =/= Unknown && expect =/= Unknown)
8179
return actual
8280
8381
func push_vals(types : list(val_type)) = foreach (t in types) push_val(t)
8482
func pop_vals(types : list(val_type)) : list(val_type) =
8583
var popped := []
86-
foreach (t in reverse(types)) popped.append(pop_val(t))
84+
foreach (t in reverse(types)) popped.prepend(pop_val(t))
8785
return popped
8886
8987
Pushing an operand value simply pushes the respective type to the value stack.
@@ -109,24 +107,24 @@ The control stack is likewise manipulated through auxiliary functions:
109107
.. code-block:: pseudo
110108
111109
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)
110+
let frame = ctrl_frame(opcode, in, out, vals.size(), false)
111+
ctrls.push(frame)
114112
push_vals(in)
115113
116114
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)
115+
error_if(ctrls.is_empty())
116+
let frame = ctrls[0]
117+
pop_vals(frame.end_types)
118+
error_if(vals.size() =/= frame.height)
121119
ctrls.pop()
122-
  return frame
120+
return frame
123121
124122
func label_types(frame : ctrl_frame) : list(val_types) =
125123
return (if frame.opcode == loop then frame.start_types else frame.end_types)
126124
127125
func unreachable() =
128-
  vals.resize(ctrls[0].height)
129-
  ctrls[0].unreachable := true
126+
vals.resize(ctrls[0].height)
127+
ctrls[0].unreachable := true
130128
131129
Pushing a control frame takes the types of the label and result values.
132130
It allocates a new frame record recording them along with the current height of the operand stack and marks the block as reachable.
@@ -184,8 +182,8 @@ Other instructions are checked in a similar manner.
184182
pop_val(t)
185183
push_val(t)
186184
187-
   case (unreachable)
188-
      unreachable()
185+
case (unreachable)
186+
unreachable()
189187
190188
case (block t1*->t2*)
191189
pop_vals([t1*])
@@ -210,26 +208,26 @@ Other instructions are checked in a similar manner.
210208
push_ctrl(else, frame.start_types, frame.end_types)
211209
212210
case (br n)
213-
     error_if(ctrls.size() < n)
214-
      pop_vals(label_types(ctrls[n]))
215-
      unreachable()
211+
error_if(ctrls.size() < n)
212+
pop_vals(label_types(ctrls[n]))
213+
unreachable()
216214
217215
case (br_if n)
218-
     error_if(ctrls.size() < n)
216+
error_if(ctrls.size() < n)
219217
pop_val(I32)
220-
      pop_vals(label_types(ctrls[n]))
221-
      push_vals(label_types(ctrls[n]))
218+
pop_vals(label_types(ctrls[n]))
219+
push_vals(label_types(ctrls[n]))
222220
223-
   case (br_table n* m)
221+
case (br_table n* m)
224222
pop_val(I32)
225-
      error_if(ctrls.size() < m)
223+
error_if(ctrls.size() < m)
226224
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)
225+
foreach (n in n*)
226+
error_if(ctrls.size() < n)
227+
error_if(label_types(ctrls[n]).size() =/= arity)
230228
push_vals(pop_vals(label_types(ctrls[n])))
231229
pop_vals(label_types(ctrls[m]))
232-
      unreachable()
230+
unreachable()
233231
234232
235233
.. 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)