From f0b8ea0d8c9ce4c972ad2e3ef8a0632c99bccf51 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 11 Mar 2021 11:32:19 +0100 Subject: [PATCH 01/10] [spec] Fix instruction table (#1296) --- .../core/appendix/gen-index-instructions.py | 17 +++++++++-------- document/core/appendix/index-instructions.rst | 16 ++++++++-------- interpreter/Makefile | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/document/core/appendix/gen-index-instructions.py b/document/core/appendix/gen-index-instructions.py index dc3574702..c4e971ff4 100755 --- a/document/core/appendix/gen-index-instructions.py +++ b/document/core/appendix/gen-index-instructions.py @@ -321,18 +321,19 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat Instruction(r'\I64.\TRUNC\K{\_sat\_}\F32\K{\_u}', r'\hex{FC}~\hex{05}', r'[\F32] \to [\I64]', r'valid-cvtop', r'exec-cvtop', r'op-trunc_sat_u'), Instruction(r'\I64.\TRUNC\K{\_sat\_}\F64\K{\_s}', r'\hex{FC}~\hex{06}', r'[\F64] \to [\I64]', r'valid-cvtop', r'exec-cvtop', r'op-trunc_sat_s'), Instruction(r'\I64.\TRUNC\K{\_sat\_}\F64\K{\_u}', r'\hex{FC}~\hex{07}', r'[\F64] \to [\I64]', r'valid-cvtop', r'exec-cvtop', r'op-trunc_sat_u'), - Instruction(r'\MEMORYINIT', r'\hex{FC}~\hex{08}', r'[\I32~\I32~\I32] \to []', r'valid-memory.init', r'exec-memory.init'), - Instruction(r'\DATADROP', r'\hex{FC}~\hex{09}', r'[] \to []', r'valid-data.drop', r'exec-data.drop'), + Instruction(r'\MEMORYINIT~x', r'\hex{FC}~\hex{08}', r'[\I32~\I32~\I32] \to []', r'valid-memory.init', r'exec-memory.init'), + Instruction(r'\DATADROP~x', r'\hex{FC}~\hex{09}', r'[] \to []', r'valid-data.drop', r'exec-data.drop'), Instruction(r'\MEMORYCOPY', r'\hex{FC}~\hex{0A}', r'[\I32~\I32~\I32] \to []', r'valid-memory.copy', r'exec-memory.copy'), Instruction(r'\MEMORYFILL', r'\hex{FC}~\hex{0B}', r'[\I32~\I32~\I32] \to []', r'valid-memory.fill', r'exec-memory.fill'), - Instruction(r'\TABLEINIT', r'\hex{FC}~\hex{0C}', r'[\I32~\I32~\I32] \to []', r'valid-table.init', r'exec-table.init'), - Instruction(r'\ELEMDROP', r'\hex{FC}~\hex{0D}', r'[] \to []', r'valid-elem.drop', r'exec-elem.drop'), - Instruction(r'\TABLECOPY', r'\hex{FC}~\hex{0E}', r'[\I32~\I32~\I32] \to []', r'valid-table.copy', r'exec-table.copy'), - Instruction(r'\TABLEGROW', r'\hex{FC}~\hex{0F}', r'[t~\I32] \to []', r'valid-table.grow', r'exec-table.grow'), - Instruction(r'\TABLESIZE', r'\hex{FC}~\hex{10}', r'[] \to []', r'valid-table.size', r'exec-table.size'), - Instruction(r'\TABLEFILL', r'\hex{FC}~\hex{11}', r'[\I32~t~\I32] \to []', r'valid-table.fill', r'exec-table.fill'), + Instruction(r'\TABLEINIT~x~y', r'\hex{FC}~\hex{0C}', r'[\I32~\I32~\I32] \to []', r'valid-table.init', r'exec-table.init'), + Instruction(r'\ELEMDROP~x', r'\hex{FC}~\hex{0D}', r'[] \to []', r'valid-elem.drop', r'exec-elem.drop'), + Instruction(r'\TABLECOPY~x~y', r'\hex{FC}~\hex{0E}', r'[\I32~\I32~\I32] \to []', r'valid-table.copy', r'exec-table.copy'), + Instruction(r'\TABLEGROW~x', r'\hex{FC}~\hex{0F}', r'[t~\I32] \to []', r'valid-table.grow', r'exec-table.grow'), + Instruction(r'\TABLESIZE~x', r'\hex{FC}~\hex{10}', r'[] \to []', r'valid-table.size', r'exec-table.size'), + Instruction(r'\TABLEFILL~x', r'\hex{FC}~\hex{11}', r'[\I32~t~\I32] \to []', r'valid-table.fill', r'exec-table.fill'), ] + def ColumnWidth(n): return max([len(instr[n]) for instr in INSTRUCTIONS]) diff --git a/document/core/appendix/index-instructions.rst b/document/core/appendix/index-instructions.rst index d2be487a7..e3b3d0bd9 100644 --- a/document/core/appendix/index-instructions.rst +++ b/document/core/appendix/index-instructions.rst @@ -269,14 +269,14 @@ Instruction Binary Opcode Type :math:`\I64.\TRUNC\K{\_sat\_}\F32\K{\_u}` :math:`\hex{FC}~\hex{05}` :math:`[\F32] \to [\I64]` :ref:`validation ` :ref:`execution `, :ref:`operator ` :math:`\I64.\TRUNC\K{\_sat\_}\F64\K{\_s}` :math:`\hex{FC}~\hex{06}` :math:`[\F64] \to [\I64]` :ref:`validation ` :ref:`execution `, :ref:`operator ` :math:`\I64.\TRUNC\K{\_sat\_}\F64\K{\_u}` :math:`\hex{FC}~\hex{07}` :math:`[\F64] \to [\I64]` :ref:`validation ` :ref:`execution `, :ref:`operator ` -:math:`\MEMORYINIT` :math:`\hex{FC}~\hex{08}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation ` :ref:`execution ` -:math:`\DATADROP` :math:`\hex{FC}~\hex{09}` :math:`[] \to []` :ref:`validation ` :ref:`execution ` +:math:`\MEMORYINIT~x` :math:`\hex{FC}~\hex{08}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation ` :ref:`execution ` +:math:`\DATADROP~x` :math:`\hex{FC}~\hex{09}` :math:`[] \to []` :ref:`validation ` :ref:`execution ` :math:`\MEMORYCOPY` :math:`\hex{FC}~\hex{0A}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation ` :ref:`execution ` :math:`\MEMORYFILL` :math:`\hex{FC}~\hex{0B}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation ` :ref:`execution ` -:math:`\TABLEINIT` :math:`\hex{FC}~\hex{0C}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation ` :ref:`execution ` -:math:`\ELEMDROP` :math:`\hex{FC}~\hex{0D}` :math:`[] \to []` :ref:`validation ` :ref:`execution ` -:math:`\TABLECOPY` :math:`\hex{FC}~\hex{0E}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation ` :ref:`execution ` -:math:`\TABLEGROW` :math:`\hex{FC}~\hex{0F}` :math:`[t~\I32] \to []` :ref:`validation ` :ref:`execution ` -:math:`\TABLESIZE` :math:`\hex{FC}~\hex{10}` :math:`[] \to []` :ref:`validation ` :ref:`execution ` -:math:`\TABLEFILL` :math:`\hex{FC}~\hex{11}` :math:`[\I32~t~\I32] \to []` :ref:`validation ` :ref:`execution ` +:math:`\TABLEINIT~x~y` :math:`\hex{FC}~\hex{0C}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation ` :ref:`execution ` +:math:`\ELEMDROP~x` :math:`\hex{FC}~\hex{0D}` :math:`[] \to []` :ref:`validation ` :ref:`execution ` +:math:`\TABLECOPY~x~y` :math:`\hex{FC}~\hex{0E}` :math:`[\I32~\I32~\I32] \to []` :ref:`validation ` :ref:`execution ` +:math:`\TABLEGROW~x` :math:`\hex{FC}~\hex{0F}` :math:`[t~\I32] \to []` :ref:`validation ` :ref:`execution ` +:math:`\TABLESIZE~x` :math:`\hex{FC}~\hex{10}` :math:`[] \to []` :ref:`validation ` :ref:`execution ` +:math:`\TABLEFILL~x` :math:`\hex{FC}~\hex{11}` :math:`[\I32~t~\I32] \to []` :ref:`validation ` :ref:`execution ` ========================================= ========================= ============================================= ======================================= =============================================================== diff --git a/interpreter/Makefile b/interpreter/Makefile index 894c5f837..c163b15aa 100644 --- a/interpreter/Makefile +++ b/interpreter/Makefile @@ -80,7 +80,7 @@ $(LIB).mlpack: $(DIRS) | sort | uniq \ >$@ -.INTERMEDIATE: $(LIB).mllib +.INTERMEDIATE: $(LIB).mllib $(LIB).mllib: echo Wasm >$@ From 025336619f769561abaff795cd376a1dfe7988c5 Mon Sep 17 00:00:00 2001 From: Ng Zhi An Date: Wed, 10 Mar 2021 15:25:50 -0800 Subject: [PATCH 02/10] Small fixes in build instructions, fix warnings Since the build instructions suggest using pipenv, we should consistently use pipenv to install the packages. Also remove some warnings about unavailable static files. Fix a Sphinx deprecation warning. --- document/README.md | 4 ++-- document/core/conf.py | 2 +- document/core/util/bikeshed/conf.py | 4 ++-- document/core/util/mathdef.py | 2 +- document/core/util/mathdefbs.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/document/README.md b/document/README.md index 326fc9a38..340955efd 100644 --- a/document/README.md +++ b/document/README.md @@ -42,7 +42,7 @@ pipenv shell Install Python dependencies: ``` -pip install Sphinx==2.4.4 +pipenv install Sphinx==2.4.4 ``` ### Checking out the repository @@ -80,7 +80,7 @@ To build the [single-page W3C version](https://webassembly.github.io/spec/core/b ``` # cd back to root of git directory git clone https://github.com/tabatkins/bikeshed.git -pip install --editable bikeshed +pipenv install -e bikeshed bikeshed update ``` diff --git a/document/core/conf.py b/document/core/conf.py index 5f85c59ef..452084791 100644 --- a/document/core/conf.py +++ b/document/core/conf.py @@ -186,7 +186,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static', 'static/custom.css'] +html_static_path = ['static/custom.css'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff --git a/document/core/util/bikeshed/conf.py b/document/core/util/bikeshed/conf.py index e38c1a560..175f7ebc4 100644 --- a/document/core/util/bikeshed/conf.py +++ b/document/core/util/bikeshed/conf.py @@ -130,7 +130,7 @@ # a list of builtin themes. # html_theme = 'classic' -html_add_permalinks = None +html_add_permalinks = '' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -176,7 +176,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static', 'static/custom.css'] +# html_static_path = ['_static', 'static/custom.css'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied diff --git a/document/core/util/mathdef.py b/document/core/util/mathdef.py index ec65c47b1..58067964a 100644 --- a/document/core/util/mathdef.py +++ b/document/core/util/mathdef.py @@ -1,5 +1,5 @@ from sphinx.ext.mathbase import math -from sphinx.ext.mathbase import MathDirective +from sphinx.directives.patches import MathDirective from sphinx.util.texescape import tex_replace_map from sphinx.writers.html5 import HTML5Translator from sphinx.writers.latex import LaTeXTranslator diff --git a/document/core/util/mathdefbs.py b/document/core/util/mathdefbs.py index 44184c14d..0012b6512 100644 --- a/document/core/util/mathdefbs.py +++ b/document/core/util/mathdefbs.py @@ -4,7 +4,7 @@ # mathdef.py controlled by buildername. from sphinx.ext.mathbase import math -from sphinx.ext.mathbase import MathDirective +from sphinx.directives.patches import MathDirective from sphinx.ext.mathjax import html_visit_math from sphinx.ext.mathjax import html_visit_displaymath from sphinx.writers.html5 import HTML5Translator From cfc2c3e8479b300624bd534815c7bb7c687c782d Mon Sep 17 00:00:00 2001 From: Ng Zhi An Date: Wed, 10 Mar 2021 16:05:08 -0800 Subject: [PATCH 03/10] Upgrade Sphinx to 3.0.0 It comes with some nice fixes: - genindex.html "abstract syntax" currently points to "https://webassembly.github.io/spec/core/appendix/implementation.html#index-1", which looks incorrect The different files are: $ diff -u -r _build/ _golden/ -q Files _build/core/appendix/index-instructions.html and _golden/core/appendix/index-instructions.html differ Files _build/core/bikeshed/index.html and _golden/core/bikeshed/index.html differ Files _build/core/_download/WebAssembly.pdf and _golden/core/_download/WebAssembly.pdf differ Files _build/core/genindex.html and _golden/core/genindex.html differ Files _build/core/objects.inv and _golden/core/objects.inv differ Files _build/core/search.html and _golden/core/search.html differ Files _build/core/searchindex.js and _golden/core/searchindex.js differ Files _build/core/_static/documentation_options.js and _golden/core/_static/documentation_options.js differ Files _build/core/_static/searchtools.js and _golden/core/_static/searchtools.js differ Files _build/js-api/index.html and _golden/js-api/index.html differ Files _build/web-api/index.html and _golden/web-api/index.html differ Most of the index.html are differences in meta content tag. --- .travis.yml | 2 +- document/README.md | 2 +- document/core/util/mathdef.py | 2 +- document/core/util/mathdefbs.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 403e9dc25..f4c5e9181 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ install: - opam --version - ocaml --version - opam install --yes ocamlbuild.0.14.0 - - pip install Sphinx==2.4.4 + - pip install Sphinx==3.0.0 - git clone https://github.com/tabatkins/bikeshed.git - pip install --editable $PWD/bikeshed - bikeshed update diff --git a/document/README.md b/document/README.md index 340955efd..fad97cac9 100644 --- a/document/README.md +++ b/document/README.md @@ -42,7 +42,7 @@ pipenv shell Install Python dependencies: ``` -pipenv install Sphinx==2.4.4 +pipenv install Sphinx==3.0.0 ``` ### Checking out the repository diff --git a/document/core/util/mathdef.py b/document/core/util/mathdef.py index 58067964a..a10fc458f 100644 --- a/document/core/util/mathdef.py +++ b/document/core/util/mathdef.py @@ -1,9 +1,9 @@ -from sphinx.ext.mathbase import math from sphinx.directives.patches import MathDirective from sphinx.util.texescape import tex_replace_map from sphinx.writers.html5 import HTML5Translator from sphinx.writers.latex import LaTeXTranslator from docutils import nodes +from docutils.nodes import math from docutils.parsers.rst.directives.misc import Replace from six import text_type import re diff --git a/document/core/util/mathdefbs.py b/document/core/util/mathdefbs.py index 0012b6512..b6b0acab9 100644 --- a/document/core/util/mathdefbs.py +++ b/document/core/util/mathdefbs.py @@ -3,12 +3,12 @@ # TODO(bradnelson): Figure out a way to merge this back into # mathdef.py controlled by buildername. -from sphinx.ext.mathbase import math from sphinx.directives.patches import MathDirective from sphinx.ext.mathjax import html_visit_math from sphinx.ext.mathjax import html_visit_displaymath from sphinx.writers.html5 import HTML5Translator from docutils import nodes +from docutils.nodes import math from docutils.parsers.rst.directives.misc import Replace import re From c9ed6580bd944855b1d19bb1567a9547a2596e8b Mon Sep 17 00:00:00 2001 From: Ng Zhi An Date: Thu, 11 Mar 2021 16:01:39 -0800 Subject: [PATCH 04/10] Upgrade Sphinx to 3.5.2 (#1298) * Upgrade Sphinx to 3.5.2 The html_add_permalinks configuration was changed in 3.5 (https://www.sphinx-doc.org/en/3.x/usage/configuration.html#confval-html_add_permalinks), we don't want any permalink for the heading (that's the existing behavior). Fix up bikeshed_fixup.py, we were not correctly replacing the spurious "navigation section" and also the Unicode reference. Most of the changes in the output is: - adding viewport meta tag (in Sphinx#7695, since 3.1.0) - sorting order of css files in html - upgrade mathjax to 2.7.7 * Update bikeshed doc to version 1.1 --- .travis.yml | 2 +- document/README.md | 2 +- document/core/index.bs | 2 +- document/core/util/bikeshed/conf.py | 4 ++-- document/core/util/bikeshed_fixup.py | 7 ++++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4c5e9181..b498e6cef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ install: - opam --version - ocaml --version - opam install --yes ocamlbuild.0.14.0 - - pip install Sphinx==3.0.0 + - pip install Sphinx==3.5.2 - git clone https://github.com/tabatkins/bikeshed.git - pip install --editable $PWD/bikeshed - bikeshed update diff --git a/document/README.md b/document/README.md index fad97cac9..a11196f66 100644 --- a/document/README.md +++ b/document/README.md @@ -42,7 +42,7 @@ pipenv shell Install Python dependencies: ``` -pipenv install Sphinx==3.0.0 +pipenv install Sphinx==3.5.2 ``` ### Checking out the repository diff --git a/document/core/index.bs b/document/core/index.bs index 9e09fbfe0..b99aac3e1 100644 --- a/document/core/index.bs +++ b/document/core/index.bs @@ -9,7 +9,7 @@ ED: https://webassembly.github.io/spec/core/bikeshed/ Editor: Andreas Rossberg (Dfinity Stiftung) Repository: WebAssembly/spec Markup Shorthands: css no, markdown no, algorithm no, idl no -Abstract: This document describes version 1.0 of the core WebAssembly standard, a safe, portable, low-level code format designed for efficient execution and compact representation. +Abstract: This document describes version 1.1 of the core WebAssembly standard, a safe, portable, low-level code format designed for efficient execution and compact representation. Prepare For TR: true diff --git a/document/core/util/bikeshed/conf.py b/document/core/util/bikeshed/conf.py index 175f7ebc4..930d47191 100644 --- a/document/core/util/bikeshed/conf.py +++ b/document/core/util/bikeshed/conf.py @@ -67,7 +67,7 @@ # built documents. # # The short X.Y version. -version = u'1.0' +version = u'1.1' # The full version, including alpha/beta/rc tags. release = version + '' @@ -130,7 +130,7 @@ # a list of builtin themes. # html_theme = 'classic' -html_add_permalinks = '' +html_permalinks = False # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/document/core/util/bikeshed_fixup.py b/document/core/util/bikeshed_fixup.py index 3a44afaf5..dcd4fd070 100755 --- a/document/core/util/bikeshed_fixup.py +++ b/document/core/util/bikeshed_fixup.py @@ -41,13 +41,14 @@ def Main(): """, '') + """, '') # Use bikeshed biblio references for unicode and IEEE754 data = data.replace( - """Unicode""", + """Unicode""", "[[!UNICODE]]" ) From 2ea0c415b88d9e10710780b29aa4f30b01e2719a Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Tue, 6 Apr 2021 11:00:09 +0200 Subject: [PATCH 05/10] [spec] Minor fix to batch file (#1301) --- document/core/make.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/core/make.bat b/document/core/make.bat index 3b2169f58..76d701084 100644 --- a/document/core/make.bat +++ b/document/core/make.bat @@ -21,7 +21,7 @@ if "%1" == "" ( echo. html to make standalone HTML files echo. pdf to make standalone PDF file echo. all to make both - echo. publish to make all and push to gh-pages (changes must be committed) + echo. publish to make all and push to gh-pages ^(changes must be committed^) echo. help to see more options goto end ) From 4a24f9633a6d7e9f4ba32b7fb947bee56929fb59 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Tue, 6 Apr 2021 03:32:49 -0700 Subject: [PATCH 06/10] Remove 'data passive' from bulk-memory examples (#1304) This syntax is outdated. --- proposals/bulk-memory-operations/Overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/bulk-memory-operations/Overview.md b/proposals/bulk-memory-operations/Overview.md index d843f0086..8f9bc6c18 100644 --- a/proposals/bulk-memory-operations/Overview.md +++ b/proposals/bulk-memory-operations/Overview.md @@ -371,7 +371,7 @@ implemented as follows: (import "a" "global" (global i32)) ;; global 0 (memory 1) (data (i32.const 0) "hello") ;; data segment 0, is active so always copied -(data passive "goodbye") ;; data segment 1, is passive +(data "goodbye") ;; data segment 1, is passive (func $start (if (global.get 0) From c2ec899f676922afd5ce41c36d34102e3cb0574e Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 8 Apr 2021 08:28:48 +0200 Subject: [PATCH 07/10] [spec] Add change history appendix (#1306) --- document/core/appendix/changes.rst | 120 +++++++++++++++++++++++++++++ document/core/appendix/index.rst | 1 + document/core/conf.py | 3 +- document/core/index.rst | 2 +- document/core/util/macros.def | 4 +- 5 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 document/core/appendix/changes.rst diff --git a/document/core/appendix/changes.rst b/document/core/appendix/changes.rst new file mode 100644 index 000000000..eb4fe14ff --- /dev/null +++ b/document/core/appendix/changes.rst @@ -0,0 +1,120 @@ +.. index:: ! changes +.. _changes: + +Change History +-------------- + +Since the original release 1.0 of the WebAssembly specification, a number of proposals for extensions have been integrated. +The following sections provide an overview of what has changed. + +Release 1.1 +~~~~~~~~~~~ + +.. index:: instruction, integer + +Sign extension instructions +........................... + +Added new numeric instructions for performing sign extension within integer representations [#proposal-signext]_. + +* New :ref:`numeric instructions `: :math:`\K{i}\X{nn}\K{.}\EXTEND\X{N}\K{\_s}` + + +.. index:: instruction, trap, floating-point, integer + +Non-trapping float-to-int conversions +..................................... + +Added new conversion instructions that avoid trapping when converting a floating-point number to an integer [#proposal-cvtsat]_. + +* New :ref:`numeric instructions `: :math:`\K{i}\X{nn}\K{.}\TRUNC\K{\_sat\_f}\X{mm}\K{\_}\sx` + + +.. index:: block, function, value type, result type + +Multiple values +............... + +Generalized the result type of blocks and functions to allow for multiple values; in addition, introduced the ability to have block parameters [#proposal-multivalue]_. + +* :ref:`Function types ` allow more than one result + +* :ref:`Block types ` can be arbitrary function types + + +.. index:: value type, reference, reference type, instruction, element segment + +Reference types +............... + +Added |FUNCREF| and |EXTERNREF| as new value types and respective instructions [#proposal-reftype]_. + +* New :ref:`value types `: :ref:`reference types ` |FUNCREF| and |EXTERNREF| + +* New :ref:`reference instructions `: |REFNULL|, |REFFUNC|, |REFISNULL| + +* Enrich :ref:`parametric instruction `: |SELECT| with optional type immediate + +* New :ref:`declarative ` form of :ref:`element segment ` + + +.. index:: reference, instruction, table, table type + +Table instructions +.................. + +Added instructions to directly access and modify tables [#proposal-reftype]_. + +* :ref:`Table types ` allow any :ref:`reference type ` as element type + +* New :ref:`table instructions `: |TABLEGET|, |TABLESET|, |TABLESIZE|, |TABLEGROW| + + +.. index:: table, instruction, table index, element segment + +Multiple tables +............... + +Added the ability to use multiple tables per module [#proposal-reftype]_. + +* :ref:`Modules ` may :ref:`define `, :ref:`import `, and :ref:`export ` multiple tables + +* :ref:`Table instructions ` take a :ref:`table index ` immediate: |TABLEGET|, |TABLESET|, |TABLESIZE|, |TABLEGROW|, |CALLINDIRECT| + +* :ref:`Element segments ` take a :ref:`table index ` + + +.. index:: instruction, table, memory, data segment, element segment + +Bulk memory and table instructions +.................................. + +Added instructions that modify ranges of memory or table entries [#proposal-reftype]_ [#proposal-bulk]_ + +* New :ref:`memory instructions `: |MEMORYFILL|, |MEMORYINIT|, |MEMORYCOPY|, |DATADROP| + +* New :ref:`table instructions `: |TABLEFILL|, |TABLEINIT|, |TABLECOPY|, |ELEMDROP| + +* New :ref:`passive ` form of :ref:`data segment ` + +* New :ref:`passive ` form of :ref:`element segment ` + +* New :ref:`data count section ` in binary format + +* Active data and element segments boundaries are no longer checked at compile time but may trap instead + + +.. [#proposal-signext] + https://github.com/WebAssembly/spec/tree/master/proposals/sign-extension-ops/ + +.. [#proposal-cvtsat] + https://github.com/WebAssembly/spec/tree/master/proposals/nontrapping-float-to-int-conversion/ + +.. [#proposal-multivalue] + https://github.com/WebAssembly/spec/tree/master/proposals/multi-value/ + +.. [#proposal-reftype] + https://github.com/WebAssembly/spec/tree/master/proposals/reference-types/ + +.. [#proposal-bulk] + https://github.com/WebAssembly/spec/tree/master/proposals/bulk-memory-operations/ diff --git a/document/core/appendix/index.rst b/document/core/appendix/index.rst index 789d2140e..c4173e955 100644 --- a/document/core/appendix/index.rst +++ b/document/core/appendix/index.rst @@ -11,6 +11,7 @@ Appendix algorithm custom properties + changes .. only:: singlehtml diff --git a/document/core/conf.py b/document/core/conf.py index 452084791..b2b090d59 100644 --- a/document/core/conf.py +++ b/document/core/conf.py @@ -17,6 +17,7 @@ # documentation root, use os.path.abspath to make it absolute, like shown here. import os import sys +from datetime import date pwd = os.path.abspath('.') sys.path.insert(0, pwd + '/util') @@ -70,7 +71,7 @@ # The short X.Y version. version = u'1.1' # The full version, including alpha/beta/rc tags. -release = version + '' +release = version + ' (Draft ' + date.today().strftime("%Y-%m-%d") + ')' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/document/core/index.rst b/document/core/index.rst index 1d8d6a4aa..94bd4b218 100644 --- a/document/core/index.rst +++ b/document/core/index.rst @@ -3,7 +3,7 @@ WebAssembly Specification .. only:: html - | Release |release| (Draft, |today|) + | Release |release| | Editor: Andreas Rossberg diff --git a/document/core/util/macros.def b/document/core/util/macros.def index 82928c6f8..999c9d02f 100644 --- a/document/core/util/macros.def +++ b/document/core/util/macros.def @@ -282,8 +282,8 @@ .. |DINIT| mathdef:: \xref{syntax/modules}{syntax-data}{\K{init}} .. |DMODE| mathdef:: \xref{syntax/modules}{syntax-data}{\K{mode}} -.. |DPASSIVE| mathdef:: \xref{syntax/modules}{syntax-data}{\K{passive}} -.. |DACTIVE| mathdef:: \xref{syntax/modules}{syntax-data}{\K{active}} +.. |DPASSIVE| mathdef:: \xref{syntax/modules}{syntax-datamode}{\K{passive}} +.. |DACTIVE| mathdef:: \xref{syntax/modules}{syntax-datamode}{\K{active}} .. |DMEM| mathdef:: \xref{syntax/modules}{syntax-data}{\K{memory}} .. |DOFFSET| mathdef:: \xref{syntax/modules}{syntax-data}{\K{offset}} From 119d3b29ad9275042b82852a2276627479ffc56e Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 8 Apr 2021 08:32:14 +0200 Subject: [PATCH 08/10] [spec] Layout improvements (#1307) --- document/core/appendix/properties.rst | 3 +- document/core/binary/modules.rst | 24 ++++++---- document/core/exec/instructions.rst | 68 +++++++++++++++------------ document/core/exec/modules.rst | 47 ++++++++++-------- document/core/static/custom.css | 4 ++ 5 files changed, 87 insertions(+), 59 deletions(-) diff --git a/document/core/appendix/properties.rst b/document/core/appendix/properties.rst index 30cb620c9..da3658c8f 100644 --- a/document/core/appendix/properties.rst +++ b/document/core/appendix/properties.rst @@ -360,7 +360,8 @@ Module instances are classified by *module contexts*, which are regular :ref:`co * Let :math:`\globaltype^\ast` be the concatenation of all :math:`\globaltype_i` in order. -* Then the module instance is valid with :ref:`context ` :math:`\{\CTYPES~\functype^\ast, \CFUNCS~{\functype'}^\ast, \CTABLES~\tabletype^\ast, \CMEMS~\memtype^\ast, \CGLOBALS~\globaltype^\ast\}`. +* | Then the module instance is valid with :ref:`context ` + | :math:`\{\CTYPES~\functype^\ast, \CFUNCS~{\functype'}^\ast, \CTABLES~\tabletype^\ast, \CMEMS~\memtype^\ast, \CGLOBALS~\globaltype^\ast\}`. .. math:: ~\\[-1ex] diff --git a/document/core/binary/modules.rst b/document/core/binary/modules.rst index 8ff6e9d8b..9e91f6243 100644 --- a/document/core/binary/modules.rst +++ b/document/core/binary/modules.rst @@ -328,21 +328,29 @@ It decodes into a vector of :ref:`element segments ` that represent \X{seg}^\ast{:}\Bsection_9(\Bvec(\Belem)) &\Rightarrow& \X{seg} \\ \production{element segment} & \Belem &::=& \hex{00}~~e{:}\Bexpr~~y^\ast{:}\Bvec(\Bfuncidx) - &\Rightarrow& \{ \ETYPE~\FUNCREF, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|& + &\Rightarrow& \\&&&\quad + \{ \ETYPE~\FUNCREF, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|& \hex{01}~~\X{et}:\Belemkind~~y^\ast{:}\Bvec(\Bfuncidx) - &\Rightarrow& \{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EPASSIVE \} \\ &&|& + &\Rightarrow& \\&&&\quad + \{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EPASSIVE \} \\ &&|& \hex{02}~~x{:}\Btableidx~~e{:}\Bexpr~~\X{et}:\Belemkind~~y^\ast{:}\Bvec(\Bfuncidx) - &\Rightarrow& \{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~x, \EOFFSET~e \} \} \\ &&|& + &\Rightarrow& \\&&&\quad + \{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~x, \EOFFSET~e \} \} \\ &&|& \hex{03}~~\X{et}:\Belemkind~~y^\ast{:}\Bvec(\Bfuncidx) - &\Rightarrow& \{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EDECLARATIVE \} \\ &&|& + &\Rightarrow& \\&&&\quad + \{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EDECLARATIVE \} \\ &&|& \hex{04}~~e{:}\Bexpr~~\X{el}^\ast{:}\Bvec(\Bexpr) - &\Rightarrow& \{ \ETYPE~\FUNCREF, \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|& + &\Rightarrow& \\&&&\quad + \{ \ETYPE~\FUNCREF, \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|& \hex{05}~~\X{et}:\Breftype~~\X{el}^\ast{:}\Bvec(\Bexpr) - &\Rightarrow& \{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EPASSIVE \} \\ &&|& + &\Rightarrow& \\&&&\quad + \{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EPASSIVE \} \\ &&|& \hex{06}~~x{:}\Btableidx~~e{:}\Bexpr~~\X{et}:\Breftype~~\X{el}^\ast{:}\Bvec(\Bexpr) - &\Rightarrow& \{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~x, \EOFFSET~e \} \} \\ &&|& + &\Rightarrow& \\&&&\quad + \{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~x, \EOFFSET~e \} \} \\ &&|& \hex{07}~~\X{et}:\Breftype~~\X{el}^\ast{:}\Bvec(\Bexpr) - &\Rightarrow& \{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EDECLARATIVE \} \\ + &\Rightarrow& \\&&&\quad + \{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EDECLARATIVE \} \\ \production{element kind} & \Belemkind &::=& \hex{00} &\Rightarrow& \FUNCREF \\ \end{array} diff --git a/document/core/exec/instructions.rst b/document/core/exec/instructions.rst index 26f845a66..d73228a12 100644 --- a/document/core/exec/instructions.rst +++ b/document/core/exec/instructions.rst @@ -607,7 +607,7 @@ Table Instructions \begin{array}[t]{@{}r@{~}l@{}} (\iff & F.\AMODULE.\MITABLES[x] = a \\ \wedge & \X{sz} = |S.\STABLES[a].\TIELEM| \\ - \wedge & S' = S \with \STABLES[a] = \growtable(S.\STABLES[a], n, \val)) \\ + \wedge & S' = S \with \STABLES[a] = \growtable(S.\STABLES[a], n, \val)) \\[1ex] \end{array} \\[1ex] \begin{array}{lcl@{\qquad}l} @@ -659,17 +659,17 @@ Table Instructions a. Return. -13. Push the value :math:`\I32.CONST~i` to the stack. +13. Push the value :math:`\I32.\CONST~i` to the stack. 14. Push the value :math:`\val` to the stack. 15. Execute the instruction :math:`\TABLESET~x`. -16. Push the value :math:`\I32.CONST~(i+1)` to the stack. +16. Push the value :math:`\I32.\CONST~(i+1)` to the stack. 17. Push the value :math:`\val` to the stack. -18. Push the value :math:`\I32.CONST~(n-1)` to the stack. +18. Push the value :math:`\I32.\CONST~(n-1)` to the stack. 19. Execute the instruction :math:`\TABLEFILL~x`. @@ -679,7 +679,7 @@ Table Instructions \quad\stepto\quad S; F; \TRAP \\ \qquad \begin{array}[t]{@{}r@{~}l@{}} - (\iff & i + n > |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM|) \\ + (\iff & i + n > |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM|) \\[1ex] \end{array} \\[1ex] S; F; (\I32.\CONST~i)~\val~(\I32.\CONST~0)~(\TABLEFILL~x) @@ -688,7 +688,8 @@ Table Instructions (\otherwise) \\[1ex] S; F; (\I32.\CONST~i)~\val~(\I32.\CONST~n+1)~(\TABLEFILL~x) - \quad\stepto\quad S; F; + \quad\stepto + \\ \qquad S; F; \begin{array}[t]{@{}l@{}} (\I32.\CONST~i)~\val~(\TABLESET~x) \\ (\I32.\CONST~i+1)~\val~(\I32.\CONST~n)~(\TABLEFILL~x) \\ @@ -789,7 +790,7 @@ Table Instructions \\ \qquad \begin{array}[t]{@{}r@{~}l@{}} (\iff & s + n > |S.\STABLES[F.\AMODULE.\MITABLES[y]].\TIELEM| \\ - \vee & d + n > |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM|) \\ + \vee & d + n > |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM|) \\[1ex] \end{array} \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~0)~(\TABLECOPY~x~y) @@ -798,7 +799,8 @@ Table Instructions (\otherwise) \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n+1)~(\TABLECOPY~x~y) - \quad\stepto\quad S; F; + \quad\stepto + \\ \qquad S; F; \begin{array}[t]{@{}l@{}} (\I32.\CONST~d)~(\I32.\CONST~s)~(\TABLEGET~y)~(\TABLESET~x) \\ (\I32.\CONST~d+1)~(\I32.\CONST~s+1)~(\I32.\CONST~n)~(\TABLECOPY~x~y) \\ @@ -807,7 +809,8 @@ Table Instructions (\otherwise, \iff d \leq s) \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n+1)~(\TABLECOPY~x~y) - \quad\stepto\quad S; F; + \quad\stepto + \\ \qquad S; F; \begin{array}[t]{@{}l@{}} (\I32.\CONST~d+n-1)~(\I32.\CONST~s+n-1)~(\TABLEGET~y)~(\TABLESET~x) \\ (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n)~(\TABLECOPY~x~y) \\ @@ -888,7 +891,7 @@ Table Instructions \\ \qquad \begin{array}[t]{@{}r@{~}l@{}} (\iff & s + n > |S.\SELEMS[F.\AMODULE.\MIELEMS[y]].\EIELEM| \\ - \vee & d + n > |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM|) \\ + \vee & d + n > |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM|) \\[1ex] \end{array} \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~0)~(\TABLEINIT~x~y) @@ -897,7 +900,8 @@ Table Instructions (\otherwise) \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n+1)~(\TABLEINIT~x~y) - \quad\stepto\quad S; F; + \quad\stepto + \\ \qquad S; F; \begin{array}[t]{@{}l@{}} (\I32.\CONST~d)~\val~(\TABLESET~x) \\ (\I32.\CONST~d+1)~(\I32.\CONST~s+1)~(\I32.\CONST~n)~(\TABLEINIT~x~y) \\ @@ -1004,7 +1008,7 @@ Memory Instructions \begin{array}[t]{@{}r@{~}l@{}} (\iff & \X{ea} = i + \memarg.\OFFSET \\ \wedge & \X{ea} + |t|/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\ - \wedge & \bytes_t(c) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice |t|/8]) + \wedge & \bytes_t(c) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice |t|/8]) \\[1ex] \end{array} \\[1ex] \begin{array}{lcl@{\qquad}l} @@ -1015,7 +1019,7 @@ Memory Instructions \begin{array}[t]{@{}r@{~}l@{}} (\iff & \X{ea} = i + \memarg.\OFFSET \\ \wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\ - \wedge & \bytes_{\iN}(n) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8]) + \wedge & \bytes_{\iN}(n) = S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8]) \\[1ex] \end{array} \\[1ex] \begin{array}{lcl@{\qquad}l} @@ -1082,7 +1086,7 @@ Memory Instructions \begin{array}[t]{@{}r@{~}l@{}} (\iff & \X{ea} = i + \memarg.\OFFSET \\ \wedge & \X{ea} + |t|/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\ - \wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice |t|/8] = \bytes_t(c)) + \wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice |t|/8] = \bytes_t(c)) \\[1ex] \end{array} \\[1ex] \begin{array}{lcl@{\qquad}l} @@ -1092,7 +1096,7 @@ Memory Instructions \begin{array}[t]{@{}r@{~}l@{}} (\iff & \X{ea} = i + \memarg.\OFFSET \\ \wedge & \X{ea} + N/8 \leq |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\ - \wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\wrap_{|t|,N}(c)) + \wedge & S' = S \with \SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA[\X{ea} \slice N/8] = \bytes_{\iN}(\wrap_{|t|,N}(c)) \\[1ex] \end{array} \\[1ex] \begin{array}{lcl@{\qquad}l} @@ -1173,7 +1177,7 @@ Memory Instructions \begin{array}[t]{@{}r@{~}l@{}} (\iff & F.\AMODULE.\MIMEMS[0] = a \\ \wedge & \X{sz} = |S.\SMEMS[a].\MIDATA|/64\,\F{Ki} \\ - \wedge & S' = S \with \SMEMS[a] = \growmem(S.\SMEMS[a], n)) \\ + \wedge & S' = S \with \SMEMS[a] = \growmem(S.\SMEMS[a], n)) \\[1ex] \end{array} \\[1ex] \begin{array}{lcl@{\qquad}l} @@ -1247,7 +1251,7 @@ Memory Instructions S; F; (\I32.\CONST~d)~\val~(\I32.\CONST~n)~\MEMORYFILL \quad\stepto\quad S; F; \TRAP \\ \qquad - (\iff d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[x]].\MIDATA|) \\ + (\iff d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[x]].\MIDATA|) \\[1ex] S; F; (\I32.\CONST~d)~\val~(\I32.\CONST~0)~\MEMORYFILL \quad\stepto\quad S; F; \epsilon @@ -1255,7 +1259,8 @@ Memory Instructions (\otherwise) \\[1ex] S; F; (\I32.\CONST~d)~\val~(\I32.\CONST~n+1)~\MEMORYFILL - \quad\stepto\quad S; F; + \quad\stepto + \\ \qquad S; F; \begin{array}[t]{@{}l@{}} (\I32.\CONST~d)~\val~(\I32\K{.}\STORE\K{8}~\{ \OFFSET~0, \ALIGN~0 \}) \\ (\I32.\CONST~d+1)~\val~(\I32.\CONST~n)~\MEMORYFILL \\ @@ -1348,7 +1353,7 @@ Memory Instructions \\ \qquad \begin{array}[t]{@{}r@{~}l@{}} (\iff & s + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| \\ - \vee & d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA|) \\ + \vee & d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA|) \\[1ex] \end{array} \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~0)~\MEMORYCOPY @@ -1357,7 +1362,8 @@ Memory Instructions (\otherwise) \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n+1)~\MEMORYCOPY - \quad\stepto\quad S; F; + \quad\stepto + \\ \qquad S; F; \begin{array}[t]{@{}l@{}} (\I32.\CONST~d) \\ (\I32.\CONST~s)~(\I32\K{.}\LOAD\K{8\_u}~\{ \OFFSET~0, \ALIGN~0 \}) \\ @@ -1368,7 +1374,8 @@ Memory Instructions (\otherwise, \iff d \leq s) \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n+1)~\MEMORYCOPY - \quad\stepto\quad S; F; + \quad\stepto + \\ \qquad S; F; \begin{array}[t]{@{}l@{}} (\I32.\CONST~d+n-1) \\ (\I32.\CONST~s+n-1)~(\I32\K{.}\LOAD\K{8\_u}~\{ \OFFSET~0, \ALIGN~0 \}) \\ @@ -1451,7 +1458,7 @@ Memory Instructions \\ \qquad \begin{array}[t]{@{}r@{~}l@{}} (\iff & s + n > |S.\SDATAS[F.\AMODULE.\MIDATAS[x]].\DIDATA| \\ - \vee & d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[x]].\MIDATA|) \\ + \vee & d + n > |S.\SMEMS[F.\AMODULE.\MIMEMS[x]].\MIDATA|) \\[1ex] \end{array} \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~0)~(\MEMORYINIT~x) @@ -1460,7 +1467,8 @@ Memory Instructions (\otherwise) \\[1ex] S; F; (\I32.\CONST~d)~(\I32.\CONST~s)~(\I32.\CONST~n+1)~(\MEMORYINIT~x) - \quad\stepto\quad S; F; + \quad\stepto + \\ \qquad S; F; \begin{array}[t]{@{}l@{}} (\I32.\CONST~d)~(\I32.\CONST~b)~(\I32\K{.}\STORE\K{8}~\{ \OFFSET~0, \ALIGN~0 \}) \\ (\I32.\CONST~d+1)~(\I32.\CONST~s+1)~(\I32.\CONST~n)~(\MEMORYINIT~x) \\ @@ -1550,10 +1558,10 @@ Control Instructions .. math:: ~\\[-1ex] - \begin{array}{lcl@{\qquad}l} + \begin{array}{lcl} F; \val^m~\BLOCK~\X{bt}~\instr^\ast~\END &\stepto& F; \LABEL_n\{\epsilon\}~\val^m~\instr^\ast~\END - & (\iff \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) + \\&&\quad (\iff \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) \end{array} @@ -1576,10 +1584,10 @@ Control Instructions .. math:: ~\\[-1ex] - \begin{array}{lcl@{\qquad}l} + \begin{array}{lcl} F; \val^m~\LOOP~\X{bt}~\instr^\ast~\END &\stepto& F; \LABEL_m\{\LOOP~\X{bt}~\instr^\ast~\END\}~\val^m~\instr^\ast~\END - & (\iff \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) + \\&&\quad (\iff \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) \end{array} @@ -1612,13 +1620,13 @@ Control Instructions .. math:: ~\\[-1ex] - \begin{array}{lcl@{\qquad}l} + \begin{array}{lcl} F; \val^m~(\I32.\CONST~c)~\IF~\X{bt}~\instr_1^\ast~\ELSE~\instr_2^\ast~\END &\stepto& F; \LABEL_n\{\epsilon\}~\val^m~\instr_1^\ast~\END - & (\iff c \neq 0 \wedge \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) \\ + \\&&\quad (\iff c \neq 0 \wedge \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) \\ F; \val^m~(\I32.\CONST~c)~\IF~\X{bt}~\instr_1^\ast~\ELSE~\instr_2^\ast~\END &\stepto& F; \LABEL_n\{\epsilon\}~\val^m~\instr_2^\ast~\END - & (\iff c = 0 \wedge \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) \\ + \\&&\quad (\iff c = 0 \wedge \expand_F(\X{bt}) = [t_1^m] \to [t_2^n]) \\ \end{array} diff --git a/document/core/exec/modules.rst b/document/core/exec/modules.rst index 48d6b03fc..cf0cf0874 100644 --- a/document/core/exec/modules.rst +++ b/document/core/exec/modules.rst @@ -516,7 +516,13 @@ and list of :ref:`reference ` vectors for the module's :ref:`element where: .. math:: - \begin{array}{rlll} + \begin{array}{@{}rlll@{}} + \table^\ast &=& \module.\MTABLES \\ + \mem^\ast &=& \module.\MMEMS \\ + \global^\ast &=& \module.\MGLOBALS \\ + \elem^\ast &=& \module.\MELEMS \\ + \data^\ast &=& \module.\MDATAS \\ + \export^\ast &=& \module.\MEXPORTS \\[1ex] \moduleinst &=& \{~ \begin{array}[t]{@{}l@{}} \MITYPES~\module.\MTYPES, \\ @@ -528,28 +534,29 @@ where: \MIDATAS~\dataaddr^\ast, \\ \MIEXPORTS~\exportinst^\ast ~\} \end{array} \\[1ex] - S_1, \funcaddr^\ast &=& \allocfunc^\ast(S, \module.\MFUNCS, \moduleinst) \\ - S_2, \tableaddr^\ast &=& \alloctable^\ast(S_1, (\table.\TTYPE)^\ast, \REFNULL~t) - \qquad\qquad\qquad~ (\where \table^\ast = \module.\MTABLES \\ && - \qquad\qquad\qquad~~ \wedge (\table.\TTYPE)^\ast = (\limits~t)^\ast) \\ - S_3, \memaddr^\ast &=& \allocmem^\ast(S_2, (\mem.\MTYPE)^\ast) - \qquad\qquad\qquad~ (\where \mem^\ast = \module.\MMEMS) \\ - S_4, \globaladdr^\ast &=& \allocglobal^\ast(S_3, (\global.\GTYPE)^\ast, \val^\ast) - \qquad\quad~ (\where \global^\ast = \module.\MGLOBALS) \\ - S_5, \elemaddr^\ast &=& \allocelem^\ast(S_4, (\elem.\ETYPE)^\ast, (\reff^\ast)^\ast) \\ - \qquad\quad~ (\where \elem^\ast = \module.\MELEMS) \\ - S', \dataaddr^\ast &=& \allocdata^\ast(S_5, (\data.\DINIT)^\ast) - \qquad\qquad\qquad~ (\where \data^\ast = \module.\MDATAS) \\ - \exportinst^\ast &=& \{ \EINAME~(\export.\ENAME), \EIVALUE~\externval_{\F{ex}} \}^\ast - \quad (\where \export^\ast = \module.\MEXPORTS) \\[1ex] + S_1, \funcaddr^\ast &=& + \allocfunc^\ast(S, \module.\MFUNCS, \moduleinst) \\ + S_2, \tableaddr^\ast &=& + \alloctable^\ast(S_1, (\table.\TTYPE)^\ast, (\REFNULL~t)^\ast) + \quad (\where (\table.\TTYPE)^\ast = (\limits~t)^\ast) \\ + S_3, \memaddr^\ast &=& + \allocmem^\ast(S_2, (\mem.\MTYPE)^\ast) \\ + S_4, \globaladdr^\ast &=& + \allocglobal^\ast(S_3, (\global.\GTYPE)^\ast, \val^\ast) \\ + S_5, \elemaddr^\ast &=& + \allocelem^\ast(S_4, (\elem.\ETYPE)^\ast, (\reff^\ast)^\ast) \\ + S', \dataaddr^\ast &=& + \allocdata^\ast(S_5, (\data.\DINIT)^\ast) \\ + \exportinst^\ast &=& + \{ \EINAME~(\export.\ENAME), \EIVALUE~\externval_{\F{ex}} \}^\ast \\[1ex] \evfuncs(\externval_{\F{ex}}^\ast) &=& (\moduleinst.\MIFUNCS[x])^\ast - \qquad~ (\where x^\ast = \edfuncs(\module.\MEXPORTS)) \\ + \qquad~ (\where x^\ast = \edfuncs(\export^\ast)) \\ \evtables(\externval_{\F{ex}}^\ast) &=& (\moduleinst.\MITABLES[x])^\ast - \qquad (\where x^\ast = \edtables(\module.\MEXPORTS)) \\ + \qquad (\where x^\ast = \edtables(\export^\ast)) \\ \evmems(\externval_{\F{ex}}^\ast) &=& (\moduleinst.\MIMEMS[x])^\ast - \qquad (\where x^\ast = \edmems(\module.\MEXPORTS)) \\ + \qquad (\where x^\ast = \edmems(\export^\ast)) \\ \evglobals(\externval_{\F{ex}}^\ast) &=& (\moduleinst.\MIGLOBALS[x])^\ast - \qquad\!\!\! (\where x^\ast = \edglobals(\module.\MEXPORTS)) \\ + \qquad\!\!\! (\where x^\ast = \edglobals(\export^\ast)) \\ \end{array} .. scratch @@ -571,7 +578,7 @@ Here, the notation :math:`\F{allocx}^\ast` is shorthand for multiple :ref:`alloc S_{i+1}, a^n[i] &=& \F{allocx}(S_i, X^n[i], \dots) \end{array} -Moreover, if the dots :math:`\dots` are a sequence :math:`A^n` (as for globals), then the elements of this sequence are passed to the allocation function pointwise. +Moreover, if the dots :math:`\dots` are a sequence :math:`A^n` (as for globals or tables), then the elements of this sequence are passed to the allocation function pointwise. .. note:: The definition of module allocation is mutually recursive with the allocation of its associated functions, because the resulting module instance :math:`\moduleinst` is passed to the function allocator as an argument, in order to form the necessary closures. diff --git a/document/core/static/custom.css b/document/core/static/custom.css index f5112d30e..45838c1e3 100644 --- a/document/core/static/custom.css +++ b/document/core/static/custom.css @@ -41,6 +41,10 @@ div.admonition p.admonition-title { font-weight: bold; } +div.math { + background-color: #F0F0F0; + padding: 3px 0 3px 0; +} div.relations { display: block; From 583d9d256c2a84fa2fd287a2a717cad452655cb3 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 8 Apr 2021 09:00:47 +0200 Subject: [PATCH 09/10] [spec] Try to retrigger build --- document/core/appendix/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/core/appendix/changes.rst b/document/core/appendix/changes.rst index eb4fe14ff..9488c1882 100644 --- a/document/core/appendix/changes.rst +++ b/document/core/appendix/changes.rst @@ -89,7 +89,7 @@ Added the ability to use multiple tables per module [#proposal-reftype]_. Bulk memory and table instructions .................................. -Added instructions that modify ranges of memory or table entries [#proposal-reftype]_ [#proposal-bulk]_ +Added instructions that modify ranges of memory or table entries [#proposal-reftype]_ [#proposal-bulk]_ * New :ref:`memory instructions `: |MEMORYFILL|, |MEMORYINIT|, |MEMORYCOPY|, |DATADROP| From 03c0770478b7c905b1078f9f4bb2e053dd3d2d02 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 8 Apr 2021 21:21:13 +0200 Subject: [PATCH 10/10] [spec] Move all repo-specifics to conf.py (#1308) --- document/core/conf.py | 13 ++++++++++++- document/core/util/macros.def | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/document/core/conf.py b/document/core/conf.py index b2b090d59..c32644b2c 100644 --- a/document/core/conf.py +++ b/document/core/conf.py @@ -64,6 +64,15 @@ editor = u'Andreas Rossberg (editor)' logo = 'static/webassembly.png' +# The name of the GitHub repository this resides in +repo = 'spec' + +# The name of the proposal it represents, if any +proposal = '' + +# The draft version string (clear out for release cuts) +draft = ' (Draft ' + date.today().strftime("%Y-%m-%d") + ')' + # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. @@ -71,7 +80,7 @@ # The short X.Y version. version = u'1.1' # The full version, including alpha/beta/rc tags. -release = version + ' (Draft ' + date.today().strftime("%Y-%m-%d") + ')' +release = version + ('' if proposal == '' else ' + ') + proposal + draft # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -477,6 +486,8 @@ # Macros rst_prolog = """ +.. |issuelink| replace:: https://github.com/webassembly/""" + repo + """/issues/ +.. |pagelink| replace:: https://webassembly.github.io/""" + repo + """/core/ .. include:: /""" + pwd + """/util/macros.def """ diff --git a/document/core/util/macros.def b/document/core/util/macros.def index 999c9d02f..ab28b40a2 100644 --- a/document/core/util/macros.def +++ b/document/core/util/macros.def @@ -3,11 +3,11 @@ .. External Standards .. ------------------ -.. |WasmDraft| replace:: https://webassembly.github.io/spec/core/ -.. _WasmDraft: https://webassembly.github.io/spec/core/ +.. |WasmDraft| replace:: |pagelink| +.. _WasmDraft: |pagelink| -.. |WasmIssues| replace:: https://github.com/webassembly/spec/issues/ -.. _WasmIssues: https://github.com/webassembly/spec/issues/ +.. |WasmIssues| replace:: |issuelink| +.. _WasmIssues: |issuelink| .. |IEEE754| replace:: IEEE 754-2019 .. _IEEE754: https://ieeexplore.ieee.org/document/8766229