Skip to content

Commit c0bbb8f

Browse files
committed
Merge with WebAssembly/spec wasm-3.0 branch
2 parents 74bf019 + efa2158 commit c0bbb8f

Some content is hidden

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

92 files changed

+14797
-1823
lines changed

.github/workflows/ci-interpreter.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: CI for interpreter & tests
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, wasm-3.0 ]
66
paths: [ .github/**, interpreter/**, test/** ]
77

88
pull_request:
9-
branches: [ main ]
9+
branches: [ main, wasm-3.0 ]
1010
paths: [ .github/**, interpreter/**, test/** ]
1111

1212
# Allows you to run this workflow manually from the Actions tab

.github/workflows/ci-spec.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: CI for specs
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, wasm-3.0 ]
66
paths: [ .github/**, document/** ]
77

88
pull_request:
9-
branches: [ main ]
9+
branches: [ main, wasm-3.0 ]
1010
paths: [ .github/**, document/** ]
1111

1212
# Allows you to run this workflow manually from the Actions tab

document/core/appendix/changes.rst

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ Allowed basic numeric computations in constant expressions. [#proposal-extconst]
308308
- |GLOBALGET| for any previously declared immutable :ref:`global <syntax-global>`
309309

310310
.. note::
311-
The :ref:`garbage collection <extension-gc>` added further constant instructions.
311+
The :ref:`garbage collection <extension-gc>` extension added further constant instructions.
312312

313313

314314
.. index:: instruction, function, call
@@ -389,6 +389,44 @@ Added the ability to use multiple memories per module. [#proposal-multimem]_
389389
* :ref:`Data segments <syntax-elem>` take a :ref:`memory index <syntax-memidx>`
390390

391391

392+
.. index:: address type, number type, table, memory, instruction
393+
394+
64-bit Address Space
395+
....................
396+
397+
Added the ability to declare an :math:`\I64` :ref:`address type <syntax-addrtype>` for :ref:`tables <syntax-tabletype>` and :ref:`memories <syntax-memtype>`. [#proposal-addr64]_
398+
399+
* :ref:`Address types <syntax-addrtype>` denote a subset of the integral :ref:`number types <syntax-numtype>`
400+
401+
* :ref:`Table types <syntax-tabletype>` include an :ref:`address type <syntax-addrtype>`
402+
403+
* :ref:`Memory types <syntax-memtype>` include an :ref:`address type <syntax-addrtype>`
404+
405+
* Operand types of :ref:`table <syntax-instr-table>` and :ref:`memory <syntax-instr-memory>` instructions now depend on the subject's declared address type:
406+
407+
- |TABLEGET|
408+
- |TABLESET|
409+
- |TABLESIZE|
410+
- |TABLEGROW|
411+
- |TABLEFILL|
412+
- |TABLECOPY|
413+
- |TABLEINIT|
414+
- |MEMORYSIZE|
415+
- |MEMORYGROW|
416+
- |MEMORYFILL|
417+
- |MEMORYCOPY|
418+
- |MEMORYINIT|
419+
- :math:`t\K{.load}`
420+
- :math:`t\K{.store}`
421+
- :math:`t\K{.load}\!N\!\K{\_}\sx`
422+
- :math:`t\K{.store}\!N`
423+
- :math:`\K{v128.load}\!N\!\K{x}\!M\!\K{\_}\sx`
424+
- :math:`\K{v128.load}\!N\!\K{\_zero}`
425+
- :math:`\K{v128.load}\!N\!\K{\_splat}`
426+
- :math:`\K{v128.load}\!N\!\K{\_lane}`
427+
- :math:`\K{v128.store}\!N\!\K{\_lane}`
428+
429+
392430
.. index:: reference, reference type, heap type, value type, local, local type, instruction, instruction type, table, function, function type, matching, subtyping
393431

394432
Typeful References
@@ -584,7 +622,7 @@ mirroring the role of custom sections in the binary format. [#proposal-annot]_
584622

585623

586624
.. [#proposal-extconst]
587-
https://github.com/WebAssembly/spec/blob/main/proposals/extended-const/
625+
https://github.com/WebAssembly/spec/tree/main/proposals/extended-const/
588626
589627
.. [#proposal-tailcall]
590628
https://github.com/WebAssembly/spec/tree/main/proposals/tail-call/
@@ -593,7 +631,10 @@ mirroring the role of custom sections in the binary format. [#proposal-annot]_
593631
https://github.com/WebAssembly/spec/tree/main/proposals/exception-handling/
594632
595633
.. [#proposal-multimem]
596-
https://github.com/WebAssembly/spec/blob/main/proposals/multi-memory/
634+
https://github.com/WebAssembly/spec/tree/main/proposals/multi-memory/
635+
636+
.. [#proposal-addr64]
637+
https://github.com/WebAssembly/spec/tree/main/proposals/memory64/
597638
598639
.. [#proposal-typedref]
599640
https://github.com/WebAssembly/spec/tree/main/proposals/function-references/

document/core/appendix/embedding.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Types
2121
In the description of the embedder interface, syntactic classes from the :ref:`abstract syntax <syntax>` and the :ref:`runtime's abstract machine <syntax-runtime>` are used as names for variables that range over the possible objects from that class.
2222
Hence, these syntactic classes can also be interpreted as types.
2323

24-
For numeric parameters, notation like :math:`n:\u32` is used to specify a symbolic name in addition to the respective value range.
24+
For numeric parameters, notation like :math:`i:\u64` is used to specify a symbolic name in addition to the respective value range.
2525

2626

2727
.. _embed-bool:
@@ -165,7 +165,7 @@ Modules
165165
.. _embed-module-instantiate:
166166

167167
:math:`\F{module\_instantiate}(\store, \module, \externval^\ast) : (\store, \moduleinst ~|~ \exception ~|~ \error)`
168-
....................................................................................................
168+
...................................................................................................................
169169

170170
1. Try :ref:`instantiating <exec-instantiation>` :math:`\module` in :math:`\store` with :ref:`external values <syntax-externval>` :math:`\externval^\ast` as imports:
171171

@@ -383,7 +383,7 @@ Tables
383383
384384
.. _embed-table-read:
385385

386-
:math:`\F{table\_read}(\store, \tableaddr, i:\u32) : \reff ~|~ \error`
386+
:math:`\F{table\_read}(\store, \tableaddr, i:\u64) : \reff ~|~ \error`
387387
......................................................................
388388

389389
1. Let :math:`\X{ti}` be the :ref:`table instance <syntax-tableinst>` :math:`\store.\STABLES[\tableaddr]`.
@@ -401,7 +401,7 @@ Tables
401401
402402
.. _embed-table-write:
403403

404-
:math:`\F{table\_write}(\store, \tableaddr, i:\u32, \reff) : \store ~|~ \error`
404+
:math:`\F{table\_write}(\store, \tableaddr, i:\u64, \reff) : \store ~|~ \error`
405405
...............................................................................
406406

407407
1. Let :math:`\X{ti}` be the :ref:`table instance <syntax-tableinst>` :math:`\store.\STABLES[\tableaddr]`.
@@ -421,7 +421,7 @@ Tables
421421
422422
.. _embed-table-size:
423423

424-
:math:`\F{table\_size}(\store, \tableaddr) : \u32`
424+
:math:`\F{table\_size}(\store, \tableaddr) : \u64`
425425
..................................................
426426

427427
1. Return the length of :math:`\store.\STABLES[\tableaddr].\TIELEM`.
@@ -437,7 +437,7 @@ Tables
437437
438438
.. _embed-table-grow:
439439

440-
:math:`\F{table\_grow}(\store, \tableaddr, n:\u32, \reff) : \store ~|~ \error`
440+
:math:`\F{table\_grow}(\store, \tableaddr, n:\u64, \reff) : \store ~|~ \error`
441441
..............................................................................
442442

443443
1. Try :ref:`growing <grow-table>` the :ref:`table instance <syntax-tableinst>` :math:`\store.\STABLES[\tableaddr]` by :math:`n` elements with initialization value :math:`\reff`:
@@ -495,7 +495,7 @@ Memories
495495
496496
.. _embed-mem-read:
497497

498-
:math:`\F{mem\_read}(\store, \memaddr, i:\u32) : \byte ~|~ \error`
498+
:math:`\F{mem\_read}(\store, \memaddr, i:\u64) : \byte ~|~ \error`
499499
..................................................................
500500

501501
1. Let :math:`\X{mi}` be the :ref:`memory instance <syntax-meminst>` :math:`\store.\SMEMS[\memaddr]`.
@@ -513,12 +513,12 @@ Memories
513513
514514
.. _embed-mem-write:
515515

516-
:math:`\F{mem\_write}(\store, \memaddr, i:\u32, \byte) : \store ~|~ \error`
516+
:math:`\F{mem\_write}(\store, \memaddr, i:\u64, \byte) : \store ~|~ \error`
517517
...........................................................................
518518

519519
1. Let :math:`\X{mi}` be the :ref:`memory instance <syntax-meminst>` :math:`\store.\SMEMS[\memaddr]`.
520520

521-
2. If :math:`\u32` is larger than or equal to the length of :math:`\X{mi}.\MIDATA`, then return :math:`\ERROR`.
521+
2. If :math:`i` is larger than or equal to the length of :math:`\X{mi}.\MIDATA`, then return :math:`\ERROR`.
522522

523523
3. Replace :math:`\X{mi}.\MIDATA[i]` with :math:`\byte`.
524524

@@ -533,7 +533,7 @@ Memories
533533
534534
.. _embed-mem-size:
535535

536-
:math:`\F{mem\_size}(\store, \memaddr) : \u32`
536+
:math:`\F{mem\_size}(\store, \memaddr) : \u64`
537537
..............................................
538538

539539
1. Return the length of :math:`\store.\SMEMS[\memaddr].\MIDATA` divided by the :ref:`page size <page-size>`.
@@ -549,7 +549,7 @@ Memories
549549
550550
.. _embed-mem-grow:
551551

552-
:math:`\F{mem\_grow}(\store, \memaddr, n:\u32) : \store ~|~ \error`
552+
:math:`\F{mem\_grow}(\store, \memaddr, n:\u64) : \store ~|~ \error`
553553
...................................................................
554554

555555
1. Try :ref:`growing <grow-mem>` the :ref:`memory instance <syntax-meminst>` :math:`\store.\SMEMS[\memaddr]` by :math:`n` :ref:`pages <page-size>`:

document/core/appendix/properties.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,10 @@ where :math:`\val_1 \gg^+_S \val_2` denotes the transitive closure of the follow
513513
.. index:: table type, table instance, limits, function address
514514
.. _valid-tableinst:
515515

516-
:ref:`Table Instances <syntax-tableinst>` :math:`\{ \TITYPE~(\limits~t), \TIELEM~\reff^\ast \}`
517-
...............................................................................................
516+
:ref:`Table Instances <syntax-tableinst>` :math:`\{ \TITYPE~\addrtype~\limits~t, \TIELEM~\reff^\ast \}`
517+
.......................................................................................................
518518

519-
* The :ref:`table type <syntax-tabletype>` :math:`\limits~t` must be :ref:`valid <valid-tabletype>` under the empty :ref:`context <context>`.
519+
* The :ref:`table type <syntax-tabletype>` :math:`\addrtype~\limits~t` must be :ref:`valid <valid-tabletype>` under the empty :ref:`context <context>`.
520520

521521
* The length of :math:`\reff^\ast` must equal :math:`\limits.\LMIN`.
522522

@@ -526,49 +526,49 @@ where :math:`\val_1 \gg^+_S \val_2` denotes the transitive closure of the follow
526526

527527
* The :ref:`reference type <syntax-reftype>` :math:`t'_i` must :ref:`match <match-reftype>` the :ref:`reference type <syntax-reftype>` :math:`t`.
528528

529-
* Then the table instance is valid with :ref:`table type <syntax-tabletype>` :math:`\limits~t`.
529+
* Then the table instance is valid with :ref:`table type <syntax-tabletype>` :math:`\addrtype~\limits~t`.
530530

531531
.. math::
532532
\frac{
533-
\vdashtabletype \limits~t \ok
533+
\vdashtabletype \addrtype~\limits~t \ok
534534
\qquad
535535
n = \limits.\LMIN
536536
\qquad
537537
(S \vdash \reff : t')^n
538538
\qquad
539539
(\vdashreftypematch t' \matchesvaltype t)^n
540540
}{
541-
S \vdashtableinst \{ \TITYPE~(\limits~t), \TIELEM~\reff^n \} : \limits~t
541+
S \vdashtableinst \{ \TITYPE~\addrtype~\limits~t, \TIELEM~\reff^n \} : \addrtype~\limits~t
542542
}
543543
544544
545545
.. index:: memory type, memory instance, limits, byte
546546
.. _valid-meminst:
547547

548-
:ref:`Memory Instances <syntax-meminst>` :math:`\{ \MITYPE~\limits, \MIDATA~b^\ast \}`
549-
......................................................................................
548+
:ref:`Memory Instances <syntax-meminst>` :math:`\{ \MITYPE~\addrtype~\limits, \MIDATA~b^\ast \}`
549+
................................................................................................
550550

551-
* The :ref:`memory type <syntax-memtype>` :math:`\limits` must be :ref:`valid <valid-memtype>` under the empty :ref:`context <context>`.
551+
* The :ref:`memory type <syntax-memtype>` :math:`\addrtype~\limits` must be :ref:`valid <valid-memtype>` under the empty :ref:`context <context>`.
552552

553553
* The length of :math:`b^\ast` must equal :math:`\limits.\LMIN` multiplied by the :ref:`page size <page-size>` :math:`64\,\F{Ki}`.
554554

555-
* Then the memory instance is valid with :ref:`memory type <syntax-memtype>` :math:`\limits`.
555+
* Then the memory instance is valid with :ref:`memory type <syntax-memtype>` :math:`\addrtype~\limits`.
556556

557557
.. math::
558558
\frac{
559-
\vdashmemtype \limits \ok
559+
\vdashmemtype \addrtype~\limits \ok
560560
\qquad
561561
n = \limits.\LMIN \cdot 64\,\F{Ki}
562562
}{
563-
S \vdashmeminst \{ \MITYPE~\limits, \MIDATA~b^n \} : \limits
563+
S \vdashmeminst \{ \MITYPE~\addrtype~\limits, \MIDATA~b^n \} : \addrtype~\limits
564564
}
565565
566566
567567
.. index:: global type, global instance, value, mutability
568568
.. _valid-globalinst:
569569

570-
:ref:`Global Instances <syntax-globalinst>` :math:`\{ \GITYPE~(\mut~t), \GIVALUE~\val \}`
571-
.........................................................................................
570+
:ref:`Global Instances <syntax-globalinst>` :math:`\{ \GITYPE~\mut~t, \GIVALUE~\val \}`
571+
.......................................................................................
572572

573573
* The :ref:`global type <syntax-globaltype>` :math:`\mut~t` must be :ref:`valid <valid-globaltype>` under the empty :ref:`context <context>`.
574574

@@ -586,7 +586,7 @@ where :math:`\val_1 \gg^+_S \val_2` denotes the transitive closure of the follow
586586
\qquad
587587
\vdashvaltypematch t' \matchesvaltype t
588588
}{
589-
S \vdashglobalinst \{ \GITYPE~(\mut~t), \GIVALUE~\val \} : \mut~t
589+
S \vdashglobalinst \{ \GITYPE~\mut~t, \GIVALUE~\val \} : \mut~t
590590
}
591591
592592

document/core/binary/instructions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ Each variant of :ref:`memory instruction <syntax-instr-memory>` is encoded with
290290
.. math::
291291
\begin{array}{llcllll}
292292
\production{memory argument} & \Bmemarg &::=&
293-
a{:}\Bu32~~o{:}\Bu32 &\Rightarrow& 0~\{ \ALIGN~a,~\OFFSET~o \}
293+
a{:}\Bu32~~o{:}\Bu64 &\Rightarrow& 0~\{ \ALIGN~a,~\OFFSET~o \}
294294
& (\iff a < 2^6) \\ &&|&
295-
a{:}\Bu32~~x{:}\memidx~~o{:}\Bu32 &\Rightarrow& x~\{ \ALIGN~(a - 2^6),~\OFFSET~o \}
295+
a{:}\Bu32~~x{:}\memidx~~o{:}\Bu64 &\Rightarrow& x~\{ \ALIGN~(a - 2^6),~\OFFSET~o \}
296296
& (\iff 2^6 \leq a < 2^7) \\
297297
\production{instruction} & \Binstr &::=& \dots \\ &&|&
298298
\hex{28}~~m{:}\Bmemarg &\Rightarrow& \I32.\LOAD~m \\ &&|&

document/core/binary/types.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,15 @@ Additional shorthands are recognized for unary recursions and sub types without
251251
Limits
252252
~~~~~~
253253

254-
:ref:`Limits <syntax-limits>` are encoded with a preceding flag indicating whether a maximum is present.
254+
:ref:`Limits <syntax-limits>` are encoded with a preceding flag indicating whether a maximum is present, and a flag for the :ref:`address type <syntax-addrtype>`.
255255

256256
.. math::
257257
\begin{array}{llclll}
258258
\production{limits} & \Blimits &::=&
259-
\hex{00}~~n{:}\Bu32 &\Rightarrow& \{ \LMIN~n, \LMAX~\epsilon \} \\ &&|&
260-
\hex{01}~~n{:}\Bu32~~m{:}\Bu32 &\Rightarrow& \{ \LMIN~n, \LMAX~m \} \\
259+
\hex{00}~~n{:}\Bu64 &\Rightarrow& (\I32, \{ \LMIN~n, \LMAX~\epsilon \}) \\ &&|&
260+
\hex{01}~~n{:}\Bu64~~m{:}\Bu64 &\Rightarrow& (\I32, \{ \LMIN~n, \LMAX~m \}) \\ &&|&
261+
\hex{04}~~n{:}\Bu64 &\Rightarrow& (\I64, \{ \LMIN~n, \LMAX~\epsilon \}) \\ &&|&
262+
\hex{05}~~n{:}\Bu64~~m{:}\Bu64 &\Rightarrow& (\I64, \{ \LMIN~n, \LMAX~m \})
261263
\end{array}
262264
263265
@@ -273,7 +275,7 @@ Memory Types
273275
.. math::
274276
\begin{array}{llclll@{\qquad\qquad}l}
275277
\production{memory type} & \Bmemtype &::=&
276-
\X{lim}{:}\Blimits &\Rightarrow& \X{lim} \\
278+
(\X{at},\X{lim}){:}\Blimits &\Rightarrow& \X{at}~\X{lim} \\
277279
\end{array}
278280
279281
@@ -289,7 +291,7 @@ Table Types
289291
.. math::
290292
\begin{array}{llclll}
291293
\production{table type} & \Btabletype &::=&
292-
\X{et}{:}\Breftype~~\X{lim}{:}\Blimits &\Rightarrow& \X{lim}~\X{et} \\
294+
\X{et}{:}\Breftype~~(\X{at},\X{lim}){:}\Blimits &\Rightarrow& \X{at}~\X{lim}~\X{et} \\
293295
\end{array}
294296
295297

0 commit comments

Comments
 (0)