Skip to content

Commit 8c51e58

Browse files
committed
Merge remote-tracking branch 'gc/main' into wasm-3.0
2 parents 5b85658 + 9ce923e commit 8c51e58

File tree

13 files changed

+312
-46
lines changed

13 files changed

+312
-46
lines changed

document/core/appendix/embedding.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -630,11 +630,12 @@ Globals
630630
\end{array}
631631
632632
633-
.. index:: reference, reference type
633+
.. index:: reference, reference type, value type, value
634634
.. _embed-ref-type:
635+
.. _embed-val-default:
635636

636-
References
637-
~~~~~~~~~~
637+
Values
638+
~~~~~~
638639

639640
:math:`\F{ref\_type}(\store, \reff) : \reftype`
640641
...............................................
@@ -656,6 +657,20 @@ References
656657
In such cases, this function may return a less precise supertype.
657658

658659

660+
:math:`\F{val\_default}(\valtype) : \val`
661+
...............................................
662+
663+
1. If :math:`\default_{valtype}` is not defined, then return :math:`\ERROR`.
664+
665+
1. Else, return the :ref:`value <syntax-val>` :math:`\default_{valtype}`.
666+
667+
.. math::
668+
\begin{array}{lclll}
669+
\F{val\_default}(t) &=& v && (\iff \default_t = v) \\
670+
\F{val\_default}(t) &=& \ERROR && (\iff \default_t = \epsilon) \\
671+
\end{array}
672+
673+
659674
.. index:: value type, external type, subtyping
660675
.. _embed-match-valtype:
661676
.. _embed-match-externtype:
@@ -674,7 +689,7 @@ Matching
674689

675690
.. math::
676691
\begin{array}{lclll}
677-
\F{match\_reftype}(t_1, t_2) &=& \TRUE && (\iff \vdashvaltypematch t_1 \matchesvaltype t_2) \\
692+
\F{match\_reftype}(t_1, t_2) &=& \TRUE && (\iff {} \vdashvaltypematch t_1 \matchesvaltype t_2) \\
678693
\F{match\_reftype}(t_1, t_2) &=& \FALSE && (\otherwise) \\
679694
\end{array}
680695
@@ -690,6 +705,6 @@ Matching
690705

691706
.. math::
692707
\begin{array}{lclll}
693-
\F{match\_externtype}(\X{et}_1, \X{et}_2) &=& \TRUE && (\iff \vdashexterntypematch \X{et}_1 \matchesexterntype \X{et}_2) \\
708+
\F{match\_externtype}(\X{et}_1, \X{et}_2) &=& \TRUE && (\iff {} \vdashexterntypematch \X{et}_1 \matchesexterntype \X{et}_2) \\
694709
\F{match\_externtype}(\X{et}_1, \X{et}_2) &=& \FALSE && (\otherwise) \\
695710
\end{array}

document/core/appendix/index-instructions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
347347
Instruction(r'\BRONCASTFAIL~t_1~t_2', r'\hex{FB}~\hex{19}', r'[t_1] \to [t_2]', r'valid-br_on_cast_fail', r'exec-br_on_cast_fail'),
348348
Instruction(r'\ANYCONVERTEXTERN', r'\hex{FB}~\hex{1A}', r'[(\REF~\NULL~\EXTERN)] \to [(\REF~\NULL~\ANY)]', r'valid-any.convert_extern', r'exec-any.convert_extern'),
349349
Instruction(r'\EXTERNCONVERTANY', r'\hex{FB}~\hex{1B}', r'[(\REF~\NULL~\ANY)] \to [(\REF~\NULL~\EXTERN)]', r'valid-extern.convert_any', r'exec-extern.convert_any'),
350-
Instruction(r'\REFI31', r'\hex{FB}~\hex{1C}', r'[\I32] \to [\I31REF]', r'valid-ref.i31', r'exec-ref.i31'),
350+
Instruction(r'\REFI31', r'\hex{FB}~\hex{1C}', r'[\I32] \to [(\REF~\I31)]', r'valid-ref.i31', r'exec-ref.i31'),
351351
Instruction(r'\I31GETS', r'\hex{FB}~\hex{1D}', r'[\I31REF] \to [\I32]', r'valid-i31.get_sx', r'exec-i31.get_sx'),
352352
Instruction(r'\I31GETU', r'\hex{FB}~\hex{1E}', r'[\I31REF] \to [\I32]', r'valid-i31.get_sx', r'exec-i31.get_sx'),
353353
Instruction(None, r'\hex{FB}~\hex{1E} \dots'),

document/core/binary/modules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
344344
\production{element segment} & \Belem &::=&
345345
0{:}\Bu32~~e{:}\Bexpr~~y^\ast{:}\Bvec(\Bfuncidx)
346346
&\Rightarrow& \\&&&\quad
347-
\{ \ETYPE~(\REF~\NULL~\FUNC), \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
347+
\{ \ETYPE~(\REF~\FUNC), \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
348348
1{:}\Bu32~~\X{et}:\Belemkind~~y^\ast{:}\Bvec(\Bfuncidx)
349349
&\Rightarrow& \\&&&\quad
350350
\{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EPASSIVE \} \\ &&|&
@@ -356,7 +356,7 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
356356
\{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EDECLARATIVE \} \\ &&|&
357357
4{:}\Bu32~~e{:}\Bexpr~~\X{el}^\ast{:}\Bvec(\Bexpr)
358358
&\Rightarrow& \\&&&\quad
359-
\{ \ETYPE~(\REF~\NULL~\FUNC), \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
359+
\{ \ETYPE~(\REF~\FUNC), \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
360360
5{:}\Bu32~~\X{et}:\Breftype~~\X{el}^\ast{:}\Bvec(\Bexpr)
361361
&\Rightarrow& \\&&&\quad
362362
\{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EPASSIVE \} \\ &&|&

document/core/exec/instructions.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -819,14 +819,14 @@ Reference Instructions
819819
S; F; (\I32.\CONST~s)~(\I32.\CONST~n)~(\ARRAYNEWDATA~x~y) &\stepto& \TRAP
820820
\\&&
821821
\begin{array}[t]{@{}r@{~}l@{}}
822-
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft}^n \\
822+
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft} \\
823823
\land & s + n\cdot|\X{ft}|/8 > |S.\SDATAS[F.\AMODULE.\MIDATAS[y]].\DIDATA|)
824824
\end{array} \\
825825
\\[1ex]
826826
S; F; (\I32.\CONST~s)~(\I32.\CONST~n)~(\ARRAYNEWDATA~x~y) &\stepto& (t.\CONST~c)^n~(\ARRAYNEWFIXED~x~n)
827827
\\&&
828828
\begin{array}[t]{@{}r@{~}l@{}}
829-
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft}^n \\
829+
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft} \\
830830
\land & t = \unpacktype(\X{ft}) \\
831831
\land & \concat((\bytes_{\X{ft}}(c))^n) = S.\SDATAS[F.\AMODULE.\MIDATAS[y]].\DIDATA[s \slice n\cdot|\X{ft}|/8] \\
832832
\end{array} \\
@@ -1065,7 +1065,7 @@ Reference Instructions
10651065

10661066
12. Assert: due to :ref:`validation <valid-array.fill>`, the :ref:`array instance <syntax-arrayinst>` :math:`S.\SARRAYS[a]` exists.
10671067

1068-
13. If :math:`d + n` is larger than or equal to the length of :math:`S.\SARRAYS[a].\AIFIELDS`, then:
1068+
13. If :math:`d + n` is larger than the length of :math:`S.\SARRAYS[a].\AIFIELDS`, then:
10691069

10701070
a. Trap.
10711071

@@ -1102,13 +1102,13 @@ Reference Instructions
11021102
(\iff d + n > |S.\SARRAYS[a].\AIFIELDS|)
11031103
\\[1ex]
11041104
S; (\REFARRAYADDR~a)~(\I32.\CONST~d)~\val~(\I32.\CONST~0)~(\ARRAYFILL~x)
1105-
\quad\stepto\quad S; \epsilon
1105+
\quad\stepto\quad \epsilon
11061106
\\ \qquad
11071107
(\otherwise)
11081108
\\[1ex]
11091109
S; (\REFARRAYADDR~a)~(\I32.\CONST~d)~\val~(\I32.\CONST~n+1)~(\ARRAYFILL~x)
11101110
\quad\stepto
1111-
\\ \quad S;
1111+
\\ \quad
11121112
\begin{array}[t]{@{}l@{}}
11131113
(\REFARRAYADDR~a)~(\I32.\CONST~d)~\val~(\ARRAYSET~x) \\
11141114
(\REFARRAYADDR~a)~(\I32.\CONST~d+1)~\val~(\I32.\CONST~n)~(\ARRAYFILL~x) \\
@@ -1175,11 +1175,11 @@ Reference Instructions
11751175

11761176
23. Assert: due to :ref:`validation <valid-array.copy>`, the :ref:`array instance <syntax-arrayinst>` :math:`S.\SARRAYS[a_2]` exists.
11771177

1178-
24. If :math:`d + n` is larger than or equal to the length of :math:`S.\SARRAYS[a_1].\AIFIELDS`, then:
1178+
24. If :math:`d + n` is larger than the length of :math:`S.\SARRAYS[a_1].\AIFIELDS`, then:
11791179

11801180
a. Trap.
11811181

1182-
25. If :math:`s + n` is larger than or equal to the length of :math:`S.\SARRAYS[a_2].\AIFIELDS`, then:
1182+
25. If :math:`s + n` is larger than the length of :math:`S.\SARRAYS[a_2].\AIFIELDS`, then:
11831183

11841184
a. Trap.
11851185

@@ -1252,7 +1252,7 @@ Reference Instructions
12521252
(\iff d + n > |S.\SARRAYS[a_1].\AIFIELDS| \vee s + n > |S.\SARRAYS[a_2].\AIFIELDS|)
12531253
\\[1ex]
12541254
S; F; (\REFARRAYADDR~a_1)~(\I32.\CONST~d)~(\REFARRAYADDR~a_2)~(\I32.\CONST~s)~(\I32.\CONST~0)~(\ARRAYCOPY~x~y)
1255-
\quad\stepto\quad S; \epsilon
1255+
\quad\stepto\quad \epsilon
12561256
\\ \qquad
12571257
(\otherwise)
12581258
\\[1ex]
@@ -1391,13 +1391,13 @@ Where:
13911391
\end{array}
13921392
\\[1ex]
13931393
S; F; (\REFARRAYADDR~a)~(\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~0)~(\ARRAYINITDATA~x~y)
1394-
\quad\stepto\quad S; F; \epsilon
1394+
\quad\stepto\quad \epsilon
13951395
\\ \qquad
13961396
(\otherwise)
13971397
\\[1ex]
13981398
S; F; (\REFARRAYADDR~a)~(\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n+1)~(\ARRAYINITDATA~x~y)
13991399
\quad\stepto
1400-
\\ \quad S; F;
1400+
\\ \quad
14011401
\begin{array}[t]{@{}l@{}}
14021402
(\REFARRAYADDR~a)~(\I32.\CONST~d)~(t.\CONST~c)~(\ARRAYSET~x) \\
14031403
(\REFARRAYADDR~a)~(\I32.\CONST~d+1)~(\I32.\CONST~s+|\X{ft}|/8)~(\I32.\CONST~n)~(\ARRAYINITDATA~x~y) \\
@@ -1497,13 +1497,13 @@ Where:
14971497
\end{array}
14981498
\\[1ex]
14991499
S; F; (\REFARRAYADDR~a)~(\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~0)~(\ARRAYINITELEM~x~y)
1500-
\quad\stepto\quad S; F; \epsilon
1500+
\quad\stepto\quad \epsilon
15011501
\\ \qquad
15021502
(\otherwise)
15031503
\\[1ex]
15041504
S; F; (\REFARRAYADDR~a)~(\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n+1)~(\ARRAYINITELEM~x~y)
15051505
\quad\stepto
1506-
\\ \quad S; F;
1506+
\\ \quad
15071507
\begin{array}[t]{@{}l@{}}
15081508
(\REFARRAYADDR~a)~(\I32.\CONST~d)~\REF~(\ARRAYSET~x) \\
15091509
(\REFARRAYADDR~a)~(\I32.\CONST~d+1)~(\I32.\CONST~s+1)~(\I32.\CONST~n)~(\ARRAYINITELEM~x~y) \\
@@ -1538,7 +1538,7 @@ Where:
15381538

15391539
.. math::
15401540
\begin{array}{lcl@{\qquad}l}
1541-
(\REFNULL \X{ht})~\ANYCONVERTEXTERN &\stepto& (\REFNULL~\ANY) \\
1541+
(\REFNULL~\X{ht})~\ANYCONVERTEXTERN &\stepto& (\REFNULL~\ANY) \\
15421542
(\REFEXTERN~\reff)~\ANYCONVERTEXTERN &\stepto& \reff \\
15431543
\end{array}
15441544
@@ -1564,8 +1564,8 @@ Where:
15641564

15651565
.. math::
15661566
\begin{array}{lcl@{\qquad}l}
1567-
(\REFNULL \X{ht})~\EXTERNCONVERTANY &\stepto& (\REFNULL~\EXTERN) \\
1568-
\reff~\EXTERNCONVERTANY &\stepto& (\REFEXTERN~\reff) & (\iff \reff \neq (\REFNULL \X{ht})) \\
1567+
(\REFNULL~\X{ht})~\EXTERNCONVERTANY &\stepto& (\REFNULL~\EXTERN) \\
1568+
\reff~\EXTERNCONVERTANY &\stepto& (\REFEXTERN~\reff) & (\iff \reff \neq (\REFNULL~\X{ht})) \\
15691569
\end{array}
15701570
15711571
@@ -4195,8 +4195,8 @@ Control Instructions
41954195
.. math::
41964196
\begin{array}{lcl@{\qquad}l}
41974197
S; F; \reff~(\BRONCAST~l~\X{rt}_1~\X{rt}_2) &\stepto& \reff~(\BR~l)
4198-
& (\iff S \vdashval \reff : \X{rt}
4199-
\land \vdashreftypematch \X{rt} \matchesreftype \insttype_{F.\AMODULE}(\X{rt}_2)) \\
4198+
& (\iff S \vdashval \reff : \X{rt}}
4199+
\land {} \vdashreftypematch \X{rt} \matchesreftype \insttype_{F.\AMODULE}(\X{rt}_2)) \\
42004200
S; F; \reff~(\BRONCAST~l~\X{rt}_1~\X{rt}_2) &\stepto& \reff
42014201
& (\otherwise) \\
42024202
\end{array}
@@ -4231,7 +4231,7 @@ Control Instructions
42314231
\begin{array}{lcl@{\qquad}l}
42324232
S; F; \reff~(\BRONCASTFAIL~l~\X{rt}_1~\X{rt}_2) &\stepto& \reff
42334233
& (\iff S \vdashval \reff : \X{rt}
4234-
\land \vdashreftypematch \X{rt} \matchesreftype \insttype_{F.\AMODULE}(\X{rt}_2)) \\
4234+
\land {} \vdashreftypematch \X{rt} \matchesreftype \insttype_{F.\AMODULE}(\X{rt}_2)) \\
42354235
S; F; \reff~(\BRONCASTFAIL~l~\X{rt}_1~\X{rt}_2) &\stepto& \reff~(\BR~l)
42364236
& (\otherwise) \\
42374237
\end{array}

document/core/exec/values.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The following auxiliary typing rules specify this typing relation relative to a
4848

4949
* The :ref:`heap type <syntax-heaptype>` must be :ref:`valid <valid-heaptype>` under the empty :ref:`context <context>`.
5050

51-
* Then value is valid with :ref:`reference type <syntax-reftype>` :math:`(\REF~\NULL~t')`, where the :ref:`heap type <syntax-heaptype>` :math:`t'` that is the least type that :ref:`matches <match-heaptype>` :math:`t`.
51+
* Then the value is valid with :ref:`reference type <syntax-reftype>` :math:`(\REF~\NULL~t')`, where the :ref:`heap type <syntax-heaptype>` :math:`t'` is the least type that :ref:`matches <match-heaptype>` :math:`t`.
5252

5353
.. math::
5454
\frac{

document/core/valid/instructions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ Aggregate Reference Instructions
379379
\qquad
380380
\X{ft}^\ast[y] = \mut~\X{st}
381381
\qquad
382-
\sx = \epsilon \Leftrightarrow \X{st} = \unpacktype(\X{st})
382+
\sx^? = \epsilon \Leftrightarrow \X{st} = \unpacktype(\X{st})
383383
}{
384384
C \vdashinstr \STRUCTGET\K{\_}\sx^?~x~y : [(\REF~\NULL~x)] \to [\unpacktype(\X{st})]
385385
}
@@ -508,7 +508,7 @@ Aggregate Reference Instructions
508508
\qquad
509509
C \vdashreftypematch C.\CELEMS[y] \matchesreftype \X{rt}
510510
}{
511-
C \vdashinstr \ARRAYNEWELEM~x~n : [\I32~\I32] \to [(\REF~x)]
511+
C \vdashinstr \ARRAYNEWELEM~x~y : [\I32~\I32] \to [(\REF~x)]
512512
}
513513
514514
@@ -539,7 +539,7 @@ Aggregate Reference Instructions
539539
\qquad
540540
C.\CDATAS[y] = {\ok}
541541
}{
542-
C \vdashinstr \ARRAYNEWDATA~x~n : [\I32~\I32] \to [(\REF~x)]
542+
C \vdashinstr \ARRAYNEWDATA~x~y : [\I32~\I32] \to [(\REF~x)]
543543
}
544544
545545
@@ -566,7 +566,7 @@ Aggregate Reference Instructions
566566
\frac{
567567
\expanddt(C.\CTYPES[x]) = \TARRAY~(\mut~\X{st})
568568
\qquad
569-
\sx = \epsilon \Leftrightarrow \X{st} = \unpacktype(\X{st})
569+
\sx^? = \epsilon \Leftrightarrow \X{st} = \unpacktype(\X{st})
570570
}{
571571
C \vdashinstr \ARRAYGET\K{\_}\sx^?~x : [(\REF~\NULL~x)~\I32] \to [\unpacktype(\X{st})]
572572
}

document/js-api/index.bs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df
118118
text: global_read; url: appendix/embedding.html#embed-global-read
119119
text: global_write; url: appendix/embedding.html#embed-global-write
120120
text: ref_type; url: appendix/embedding.html#embed-ref-type
121+
text: val_default; url: appendix/embedding.html#embed-val-default
121122
text: match_valtype; url: appendix/embedding.html#embed-match-valtype
122123
text: error; url: appendix/embedding.html#embed-error
123124
text: store; url: exec/runtime.html#syntax-store
@@ -380,7 +381,7 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
380381
1. Throw a {{LinkError}} exception.
381382
1. If |valtype| is [=v128=],
382383
1. Throw a {{LinkError}} exception.
383-
1. Let |value| be [=ToWebAssemblyValue=](|v|, |valtype|).
384+
1. Let |value| be [=ToWebAssemblyValue=](|v|, |valtype|). If this operation throws a {{TypeError}}, catch it, and throw a {{LinkError}} exception.
384385
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
385386
1. Let (|store|, |globaladdr|) be [=global_alloc=](|store|, [=const=] |valtype|, |value|).
386387
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
@@ -853,6 +854,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
853854
1. If |maximum| is not empty and |maximum| &lt; |initial|, throw a {{RangeError}} exception.
854855
1. If |value| is missing,
855856
1. Let |ref| be [=DefaultValue=](|elementType|).
857+
1. Assert: |ref| is not [=error=].
856858
1. Otherwise,
857859
1. Let |ref| be [=?=] [=ToWebAssemblyValue=](|value|, |elementType|).
858860
1. Let |type| be the [=table type=] {[=table type|min=] |initial|, [=table type|max=] |maximum|} |elementType|.
@@ -870,6 +872,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
870872
1. Let (<var ignore>limits</var>, |elementType|) be [=table_type=](|tableaddr|).
871873
1. If |value| is missing,
872874
1. Let |ref| be [=DefaultValue=](|elementType|).
875+
1. If |ref| is [=error=], throw a {{TypeError}} exception.
873876
1. Otherwise,
874877
1. Let |ref| be [=?=] [=ToWebAssemblyValue=](|value|, |elementType|).
875878
1. Let |result| be [=table_grow=](|store|, |tableaddr|, |delta|, |ref|).
@@ -903,6 +906,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
903906
1. Let (<var ignore>limits</var>, |elementType|) be [=table_type=](|tableaddr|).
904907
1. If |value| is missing,
905908
1. Let |ref| be [=DefaultValue=](|elementType|).
909+
1. If |ref| is [=error=], throw a {{TypeError}} exception.
906910
1. Otherwise,
907911
1. Let |ref| be [=?=] [=ToWebAssemblyValue=](|value|, |elementType|).
908912
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
@@ -979,13 +983,8 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
979983

980984
<div algorithm>
981985
The algorithm <dfn>DefaultValue</dfn>(|valuetype|) performs the following steps:
982-
1. If |valuetype| equals [=i32=], return [=i32.const=] 0.
983-
1. If |valuetype| equals [=i64=], return [=i64.const=] 0.
984-
1. If |valuetype| equals [=f32=], return [=f32.const=] 0.
985-
1. If |valuetype| equals [=f64=], return [=f64.const=] 0.
986-
1. If |valuetype| equals [=funcref=], return [=ref.null=] [=funcref=].
987986
1. If |valuetype| equals [=externref=], return [=ToWebAssemblyValue=](undefined, |valuetype|).
988-
1. Assert: This step is not reached.
987+
1. Return [=val_default=](|valuetype|).
989988
</div>
990989

991990
<div algorithm>
@@ -996,6 +995,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
996995
1. Throw a {{TypeError}} exception.
997996
1. If |v| is missing,
998997
1. Let |value| be [=DefaultValue=](|valuetype|).
998+
1. Assert: |value| is not [=error=].
999999
1. Otherwise,
10001000
1. Let |value| be [=ToWebAssemblyValue=](|v|, |valuetype|).
10011001
1. If |mutable| is true, let |globaltype| be [=var=] |valuetype|; otherwise, let |globaltype| be [=const=] |valuetype|.

proposals/gc/MVP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ Then, `$rttA` would carry supertype vector `[$rttA]`, `$rttB` has `[$rttA, $rttB
466466
Now consider a function that casts a `$B` to a `$C`:
467467
```
468468
(func $castBtoC (param $x (ref $B)) (result (ref $C))
469-
(ref.cast $C (local.get $x))
469+
(ref.cast (ref $C) (local.get $x))
470470
)
471471
```
472472
This can compile to machine code that (1) reads the RTT from `$x`, (2) checks that the length of its supertype table is >= 3, and (3) pointer-compares table[2] against `$rttC`.

0 commit comments

Comments
 (0)