Skip to content

Commit 8546739

Browse files
authored
Merge upstream (WebAssembly#157)
1 parent 736bda2 commit 8546739

24 files changed

+1270
-281
lines changed

document/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ You will also need `npm` and `yarn` for all the LaTeX goodness. `npm` might alre
8888

8989
```
9090
npm install -g yarn
91-
cd document/core
91+
cd document
9292
make -C core bikeshed
9393
```
9494

document/core/Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,12 @@ bikeshed-keep:
8989
echo Downloaded Bikeshed.
9090

9191

92+
.PHONY: index
93+
index:
94+
(cd appendix; ./gen-index-instructions.py)
95+
9296
.PHONY: pdf
93-
pdf: latexpdf
97+
pdf: index latexpdf
9498
mkdir -p $(BUILDDIR)/html/$(DOWNLOADDIR)
9599
ln -f $(BUILDDIR)/latex/$(NAME).pdf $(BUILDDIR)/html/$(DOWNLOADDIR)/$(NAME).pdf
96100

@@ -101,7 +105,7 @@ clean:
101105
rm -rf $(STATICDIR)
102106

103107
.PHONY: html
104-
html:
108+
html: index
105109
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
106110
for file in `ls $(BUILDDIR)/html/*.html`; \
107111
do \

document/core/appendix/gen-index-instructions.py

Lines changed: 346 additions & 0 deletions
Large diffs are not rendered by default.

document/core/appendix/index-instructions.rst

Lines changed: 266 additions & 216 deletions
Large diffs are not rendered by default.

document/core/exec/instructions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ Memory Instructions
424424

425425
a. Let :math:`n` be the integer for which :math:`\bytes_{\iN}(n) = b^\ast`.
426426

427-
b. Let :math:`c` be the result of computing :math:`\extend\F{\_}\sx_{N,|t|}(n)`.
427+
b. Let :math:`c` be the result of computing :math:`\extend^{\sx}_{N,|t|}(n)`.
428428

429429
13. Else:
430430

@@ -447,7 +447,7 @@ Memory Instructions
447447
\\[1ex]
448448
\begin{array}{lcl@{\qquad}l}
449449
S; F; (\I32.\CONST~i)~(t.\LOAD{N}\K{\_}\sx~\memarg) &\stepto&
450-
S; F; (t.\CONST~\extend\F{\_}\sx_{N,|t|}(n))
450+
S; F; (t.\CONST~\extend^{\sx}_{N,|t|}(n))
451451
\end{array}
452452
\\ \qquad
453453
\begin{array}[t]{@{}r@{~}l@{}}

document/core/exec/numerics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ Conversions
16031603

16041604
.. math::
16051605
\begin{array}{lll@{\qquad}l}
1606-
\convertu_{M,N}(i) &=& \ieee_N(\signed_M(i)) \\
1606+
\converts_{M,N}(i) &=& \ieee_N(\signed_M(i)) \\
16071607
\end{array}
16081608
16091609

document/core/text/instructions.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -430,20 +430,20 @@ Numeric Instructions
430430
\text{i32.trunc\_f32\_u} &\Rightarrow& \I32.\TRUNC\K{\_}\F32\K{\_u} \\ &&|&
431431
\text{i32.trunc\_f64\_s} &\Rightarrow& \I32.\TRUNC\K{\_}\F64\K{\_s} \\ &&|&
432432
\text{i32.trunc\_f64\_u} &\Rightarrow& \I32.\TRUNC\K{\_}\F64\K{\_u} \\ &&|&
433-
\text{i32.trunc\_sat_f32\_s} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F32\K{\_s} \\ &&|&
434-
\text{i32.trunc\_sat_f32\_u} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F32\K{\_u} \\ &&|&
435-
\text{i32.trunc\_sat_f64\_s} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F64\K{\_s} \\ &&|&
436-
\text{i32.trunc\_sat_f64\_u} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F64\K{\_u} \\ &&|&
433+
\text{i32.trunc\_sat\_f32\_s} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F32\K{\_s} \\ &&|&
434+
\text{i32.trunc\_sat\_f32\_u} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F32\K{\_u} \\ &&|&
435+
\text{i32.trunc\_sat\_f64\_s} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F64\K{\_s} \\ &&|&
436+
\text{i32.trunc\_sat\_f64\_u} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F64\K{\_u} \\ &&|&
437437
\text{i64.extend\_i32\_s} &\Rightarrow& \I64.\EXTEND\K{\_}\I32\K{\_s} \\ &&|&
438438
\text{i64.extend\_i32\_u} &\Rightarrow& \I64.\EXTEND\K{\_}\I32\K{\_u} \\ &&|&
439439
\text{i64.trunc\_f32\_s} &\Rightarrow& \I64.\TRUNC\K{\_}\F32\K{\_s} \\ &&|&
440440
\text{i64.trunc\_f32\_u} &\Rightarrow& \I64.\TRUNC\K{\_}\F32\K{\_u} \\ &&|&
441441
\text{i64.trunc\_f64\_s} &\Rightarrow& \I64.\TRUNC\K{\_}\F64\K{\_s} \\ &&|&
442442
\text{i64.trunc\_f64\_u} &\Rightarrow& \I64.\TRUNC\K{\_}\F64\K{\_u} \\ &&|&
443-
\text{i64.trunc\_sat_f32\_s} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F32\K{\_s} \\ &&|&
444-
\text{i64.trunc\_sat_f32\_u} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F32\K{\_u} \\ &&|&
445-
\text{i64.trunc\_sat_f64\_s} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F64\K{\_s} \\ &&|&
446-
\text{i64.trunc\_sat_f64\_u} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F64\K{\_u} \\ &&|&
443+
\text{i64.trunc\_sat\_f32\_s} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F32\K{\_s} \\ &&|&
444+
\text{i64.trunc\_sat\_f32\_u} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F32\K{\_u} \\ &&|&
445+
\text{i64.trunc\_sat\_f64\_s} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F64\K{\_s} \\ &&|&
446+
\text{i64.trunc\_sat\_f64\_u} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F64\K{\_u} \\ &&|&
447447
\text{f32.convert\_i32\_s} &\Rightarrow& \F32.\CONVERT\K{\_}\I32\K{\_s} \\ &&|&
448448
\text{f32.convert\_i32\_u} &\Rightarrow& \F32.\CONVERT\K{\_}\I32\K{\_u} \\ &&|&
449449
\text{f32.convert\_i64\_s} &\Rightarrow& \F32.\CONVERT\K{\_}\I64\K{\_s} \\ &&|&

document/js-api/index.bs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,14 +792,15 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
792792
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
793793
1. Let |result| be [=table_read=](|store|, |tableaddr|, |index|).
794794
1. If |result| is [=error=], throw a {{RangeError}} exception.
795+
1. If |result| is ε, return null.
795796
1. Let |function| be the result of creating [=a new Exported Function=] from |result|.
796797
1. Return |function|.
797798
</div>
798799

799800
<div algorithm>
800801
The <dfn method for="Table">set(|index|, |value|)</dfn> method, when invoked, performs the following steps:
801802
1. Let |tableaddr| be **this**.\[[Table]].
802-
1. If |value| is null, let |funcaddr| be an empty [=function element=].
803+
1. If |value| is null, let |funcaddr| be ε.
803804
1. Otherwise,
804805
1. If |value| does not have a \[[FunctionAddress]] internal slot, throw a {{TypeError}} exception.
805806
1. Let |funcaddr| be |value|.\[[FunctionAddress]].

document/web-api/index.bs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,27 @@ application/wasm
253253
<dt>Encoding Considerations:</dt>
254254
<dd>binary</dd>
255255
<dt>Security Considerations:</dt>
256-
<dd>See see WebAssembly Core Security Considerations<br/>
257-
https://www.w3.org/TR/wasm-core/#security-considerations%E2%91%A0</dd>
256+
<dd>
257+
<p>WebAssembly is a standard, a safe, portable, low-level code format. The
258+
security considerations associated with executing WebAssembly code are
259+
described in https://www.w3.org/TR/wasm-core/#security-considerations.</p>
260+
<p>The WebAssembly format includes no integrity or privacy protection. If
261+
such protection is needed it must be provided externally, e.g., through
262+
the use of HTTPS.</p>
263+
</dd>
258264
<dt>Interoperability Considerations:</dt>
259-
<dd>See see WebAssembly Core Conformance<br/>
265+
<dd>See WebAssembly Core Conformance<br/>
260266
https://www.w3.org/TR/wasm-core/#conformance</dd>
261267
<dt>Published specification:</dt>
262-
https://www.w3.org/TR/wasm-core-1/
268+
<dd>https://www.w3.org/TR/wasm-core-1/
263269
https://www.w3.org/TR/wasm-js-api-1/
264-
https://www.w3.org/TR/wasm-web-api-1/
270+
https://www.w3.org/TR/wasm-web-api-1/</dd>
265271
<dt>Application Usage:</dt>
266-
<dd>The application/wasm media type is already in use as the type used to describe WebAssembly files when sent over HTTP to be executed by browsers, which is a common scenario. Additionally, several WebAssembly runtimes that take advantage of the safety and portability while targeting efficient execution and compact representation.</dd>
272+
<dd>The application/wasm media type is intended for use as the type used to
273+
describe WebAssembly files when sent over HTTP to be executed by browsers,
274+
which is a common scenario. Additionally, the type is used by several
275+
WebAssembly runtimes that take advantage of the safety and portability
276+
while targeting efficient execution and compact representation.</dd>
267277
<dt>Fragment Identifier Considerations:</dt>
268278
<dd>None</dd>
269279
<dt>Restrictions on usage:</dt>

interpreter/Makefile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,36 @@ $(WINMAKE): clean
112112
113113
# Executing test suite
114114
115-
.PHONY: test debugtest
115+
TESTDIR = ../test/core
116+
TESTFILES = $(shell cd $(TESTDIR); ls *.wast)
117+
TESTS = $(TESTFILES:%.wast=%)
118+
119+
.PHONY: test debugtest partest
116120
117121
test: $(OPT)
118-
../test/core/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',)
122+
$(TESTDIR)/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',)
119123
debugtest: $(UNOPT)
120-
../test/core/run.py --wasm `pwd`/$(UNOPT) $(if $(JS),--js '$(JS)',)
124+
$(TESTDIR)/run.py --wasm `pwd`/$(UNOPT) $(if $(JS),--js '$(JS)',)
121125
122126
test/%: $(OPT)
123-
../test/core/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',) $(@:test/%=../test/core/%.wast)
127+
$(TESTDIR)/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',) $(TESTDIR)/$(@F).wast
124128
debugtest/%: $(UNOPT)
125-
../test/core/run.py --wasm `pwd`/$(UNOPT) $(if $(JS),--js '$(JS)',) $(@:debugtest/%=../test/core/%.wast)
129+
$(TESTDIR)/run.py --wasm `pwd`/$(UNOPT) $(if $(JS),--js '$(JS)',) $(TESTDIR)/$(@F).wast
126130
127131
run/%: $(OPT)
128-
./$(OPT) $(@:run/%=../test/core/%.wast)
132+
./$(OPT) $(TESTDIR)/$(@F).wast
129133
debug/%: $(UNOPT)
130-
./$(UNOPT) $(@:debug/%=../test/core/%.wast)
134+
./$(UNOPT) $(TESTDIR)/$(@F).wast
135+
136+
partest: $(TESTS:%=quiettest/%)
137+
@echo All tests passed.
138+
139+
quiettest/%: $(OPT)
140+
@ ( \
141+
$(TESTDIR)/run.py 2>$(@F).out --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',) $(@F:%=$(TESTDIR)/%.wast) && \
142+
rm $(@F).out \
143+
) || \
144+
cat $(@F).out || rm $(@F).out || exit 1
131145
132146
133147
# Miscellaneous targets

0 commit comments

Comments
 (0)