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

Commit 3a7d640

Browse files
committed
Merge remote-tracking branch 'spec/main' into merge_spec
2 parents 09e3b45 + 036365a commit 3a7d640

File tree

6 files changed

+38
-30
lines changed

6 files changed

+38
-30
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ jobs:
6464
- uses: actions/checkout@v2
6565
with:
6666
submodules: "recursive"
67+
- uses: actions/setup-node@v3
68+
with:
69+
node-version: 16
6770
- run: pip install bikeshed && bikeshed update
6871
- run: pip install six
6972
- run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended

document/core/exec/instructions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ Table Instructions
13121312
\end{array}
13131313
\\[1ex]
13141314
\begin{array}{lcl@{\qquad}l}
1315-
S; F; (\I32.\CONST~n)~(\TABLEGROW~x) &\stepto& S; F; (\I32.\CONST~\signed_{32}^{-1}(-1))
1315+
S; F; \val~(\I32.\CONST~n)~(\TABLEGROW~x) &\stepto& S; F; (\I32.\CONST~\signed_{32}^{-1}(-1))
13161316
\end{array}
13171317
\end{array}
13181318

document/js-api/index.bs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -496,18 +496,20 @@ The verification of WebAssembly type requirements is deferred to the
496496
1. Let |module| be |moduleObject|.\[[Module]].
497497
1. [=Read the imports=] of |module| with imports |importObject|, and let |imports| be the result.
498498
If this operation throws an exception, catch it, [=reject=] |promise| with the exception, and return |promise|.
499-
1. [=Queue a task=] to perform the following steps:
500-
1. [=Instantiate the core of a WebAssembly module=] |module| with |imports|, and let |instance| be the result.
501-
If this throws an exception, catch it, [=reject=] |promise| with the exception, and terminate these substeps.
502-
1. Let |instanceObject| be a [=/new=] {{Instance}}.
503-
1. [=initialize an instance object|Initialize=] |instanceObject| from |module| and |instance|.
504-
If this throws an exception, catch it, [=reject=] |promise| with the exception, and terminate these substeps.
505-
1. [=Resolve=] |promise| with |instanceObject|.
499+
1. Run the following steps [=in parallel=]:
500+
1. [=Queue a task=] to perform the following steps:
501+
Note: Implementation-specific work may be performed here.
502+
1. [=Instantiate the core of a WebAssembly module=] |module| with |imports|, and let |instance| be the result.
503+
If this throws an exception, catch it, [=reject=] |promise| with the exception, and terminate these substeps.
504+
1. Let |instanceObject| be a [=/new=] {{Instance}}.
505+
1. [=initialize an instance object|Initialize=] |instanceObject| from |module| and |instance|.
506+
If this throws an exception, catch it, [=reject=] |promise| with the exception, and terminate these substeps.
507+
1. [=Resolve=] |promise| with |instanceObject|.
506508
1. Return |promise|.
507509
</div>
508510

509511
<div algorithm="instantiate">
510-
To <dfn>instantiate a WebAssembly module</dfn> from a {{Module}} |moduleObject| and imports |importObject|, perform the following steps:
512+
To <dfn>synchronously instantiate a WebAssembly module</dfn> from a {{Module}} |moduleObject| and imports |importObject|, perform the following steps:
511513
1. Let |module| be |moduleObject|.\[[Module]].
512514
1. [=Read the imports=] of |module| with imports |importObject|, and let |imports| be the result.
513515
1. [=Instantiate the core of a WebAssembly module=] |module| with |imports|, and let |instance| be the result.
@@ -521,14 +523,15 @@ The verification of WebAssembly type requirements is deferred to the
521523

522524
1. Let |promise| be [=a new promise=].
523525
1. [=Upon fulfillment=] of |promiseOfModule| with value |module|:
524-
1. [=instantiate a WebAssembly module|Instantiate the WebAssembly module=] |module| importing |importObject|, and let |instance| be the result. If this throws an exception, catch it, [=reject=] |promise| with the exception, and abort these substeps.
525-
1. Let |result| be the {{WebAssemblyInstantiatedSource}} value «[ "{{WebAssemblyInstantiatedSource/module}}" → |module|, "{{WebAssemblyInstantiatedSource/instance}}" → |instance| ]».
526-
1. [=Resolve=] |promise| with |result|.
526+
1. [=asynchronously instantiate a WebAssembly module|Instantiate the WebAssembly module=] |module| importing |importObject|, and let |innerPromise| be the result.
527+
1. [=Upon fulfillment=] of |innerPromise| with value |instance|.
528+
1. Let |result| be the {{WebAssemblyInstantiatedSource}} value «[ "{{WebAssemblyInstantiatedSource/module}}" → |module|, "{{WebAssemblyInstantiatedSource/instance}}" → |instance| ]».
529+
1. [=Resolve=] |promise| with |result|.
530+
1. [=Upon rejection=] of |innerPromise| with reason |reason|:
531+
1. [=Reject=] |promise| with |reason|.
527532
1. [=Upon rejection=] of |promiseOfModule| with reason |reason|:
528533
1. [=Reject=] |promise| with |reason|.
529534
1. Return |promise|.
530-
531-
Note: It would be valid to perform certain parts of the instantiation [=in parallel=], but several parts need to happen in the event loop, including JavaScript operations to access the |importObject| and execution of the start function.
532535
</div>
533536

534537
<div algorithm>
@@ -628,6 +631,8 @@ interface Module {
628631
1. If |module| is [=error=], throw a {{CompileError}} exception.
629632
1. Set **this**.\[[Module]] to |module|.
630633
1. Set **this**.\[[Bytes]] to |stableBytes|.
634+
635+
Note: Some implementations enforce a size limitation on |bytes|. Use of this API is discouraged, in favor of asynchronous APIs.
631636
</div>
632637

633638
<h3 id="instances">Instances</h3>
@@ -646,6 +651,8 @@ interface Instance {
646651
1. [=Read the imports=] of |module| with imports |importObject|, and let |imports| be the result.
647652
1. [=Instantiate the core of a WebAssembly module=] |module| with |imports|, and let |instance| be the result.
648653
1. [=initialize an instance object|Initialize=] **this** from |module| and |instance|.
654+
655+
Note: The use of this synchronous API is discouraged, as some implementations sometimes do long-running compilation work when instantiating.
649656
</div>
650657

651658
<div algorithm>

test/core/linking.wast

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,6 @@
129129
)
130130

131131

132-
(module
133-
(global (export "g-v128") v128 (v128.const i64x2 0 0))
134-
(global (export "mg-v128") (mut v128) (v128.const i64x2 0 0))
135-
)
136-
(register "Mv128")
137-
138-
(module
139-
;; TODO: Reactivate once the fix for https://bugs.chromium.org/p/v8/issues/detail?id=13732
140-
;; has made it to the downstream node.js that we use on CI.
141-
;; (import "Mv128" "g-v128" (global v128))
142-
(import "Mv128" "mg-v128" (global (mut v128)))
143-
)
144-
145-
146132
;; Tables
147133

148134
(module $Mt

test/core/simd/simd_linking.wast

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(module
2+
(global (export "g-v128") v128 (v128.const i64x2 0 0))
3+
(global (export "mg-v128") (mut v128) (v128.const i64x2 0 0))
4+
)
5+
(register "Mv128")
6+
7+
(module
8+
;; TODO: Reactivate once the fix for https://bugs.chromium.org/p/v8/issues/detail?id=13732
9+
;; has made it to the downstream node.js that we use on CI.
10+
;; (import "Mv128" "g-v128" (global v128))
11+
(import "Mv128" "mg-v128" (global (mut v128)))
12+
)

test/js-api/wasm-module-builder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,9 @@ class WasmModuleBuilder {
754754

755755
addTag(type) {
756756
let type_index = (typeof type) == "number" ? type : this.addType(type);
757-
let except_index = this.tags.length + this.num_imported_tags;
757+
let tag_index = this.tags.length + this.num_imported_tags;
758758
this.tags.push(type_index);
759-
return except_index;
759+
return tag_index;
760760
}
761761

762762
addFunction(name, type) {

0 commit comments

Comments
 (0)