diff --git a/.github/workflows/ci-interpreter.yml b/.github/workflows/ci-interpreter.yml index 61dfdf936..3ce4327a1 100644 --- a/.github/workflows/ci-interpreter.yml +++ b/.github/workflows/ci-interpreter.yml @@ -24,13 +24,16 @@ jobs: ocaml-compiler: 4.14.x - name: Setup OCaml tools run: opam install --yes ocamlfind.1.9.5 js_of_ocaml.4.0.0 js_of_ocaml-ppx.4.0.0 - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20.x - name: Build interpreter run: cd interpreter && opam exec make + # Neither V8 nor SpiderMonkey can currently handle all 3.0 tests, so we disable checking JS translation for now. + #- name: Setup Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: 25-nightly + #- name: Setup SpiderMonkey + # run: curl -O https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/jsshell-linux-x86_64.zip && unzip jsshell-linux-x86_64.zip - name: Run tests - # TODO: reactivate node once it supports all of Wasm 3.0 - # run: cd interpreter && opam exec make JS=node ci - run: cd interpreter && opam exec make ci + run: cd interpreter && opam exec make ci # don't test JS translation + # run: cd interpreter && opam exec make JS=node ci # test with V8 + # run: cd interpreter && opam exec make JS=../js ci # test with SM diff --git a/.github/workflows/w3c-publish.yml b/.github/workflows/w3c-publish.yml index 475f8a398..044fa88ba 100644 --- a/.github/workflows/w3c-publish.yml +++ b/.github/workflows/w3c-publish.yml @@ -46,6 +46,13 @@ jobs: uses: actions/checkout@v4 with: submodules: "recursive" + - name: Setup OCaml + uses: ocaml/setup-ocaml@v3 + with: + ocaml-compiler: 4.14.x + - name: Setup Dune + if: ${{ matrix.spec == 'core' }} + run: opam install --yes dune menhir mdx zarith && opam exec dune --version - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -57,10 +64,13 @@ jobs: run: sudo apt-get update -y && sudo apt-get install -y latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended - name: Setup Sphinx if: ${{ matrix.spec == 'core' }} - run: pip install six && pip install sphinx==8.0.0 - - name: Publish ${{ matrix.spec }} spec to its https://www.w3.org/TR/ URL + run: pip install six && pip install sphinx==8.1.3 + - name: Build SpecTec + if: ${{ matrix.spec == 'core' }} + run: cd spectec && opam exec make + - name: Publish (or validate) ${{ matrix.spec }} spec to its https://www.w3.org/TR/ URL if: env.W3C_ECHIDNA_TOKEN_CORE - run: cd document && make -e -C ${{ matrix.spec }} WD-echidna-CI + run: cd document/${{ matrix.spec }} && opam exec make W3C_STATUS=${{ env.W3C_STATUS }} ECHIDNA_DRYRUN=${{ env.ECHIDNA_DRYRUN}} WD-echidna-CI env: W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }} W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }} @@ -69,9 +79,9 @@ jobs: ECHIDNA_DRYRUN: |- ${{ !((github.event_name == 'workflow_dispatch' && !inputs.dry-run) || (github.event_name == 'push' && github.repository == 'WebAssembly/spec' && github.ref == 'refs/heads/main')) }} - - name: Validate ${{ matrix.spec }} spec with Echidna + - name: Validate ${{ matrix.spec }} spec with Echidna using personal credentials if: env.W3C_USERNAME - run: cd document && make -e -C ${{ matrix.spec }} WD-echidna + run: cd document/${{ matrix.spec }} && opam exec make W3C_STATUS=${{ env.W3C_STATUS }} WD-echidna env: W3C_USERNAME: ${{ secrets.W3C_USERNAME }} W3C_PASSWORD: ${{ secrets.W3C_PASSWORD }} diff --git a/document/core/Makefile b/document/core/Makefile index 08140f3ae..786935abe 100644 --- a/document/core/Makefile +++ b/document/core/Makefile @@ -250,7 +250,7 @@ WD-echidna: WD-tar -F "tar=@$(BUILDDIR)/WD.tar" \ -F "decision=$(DECISION_URL)" \ -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt - python3 ../util/check-echidna-status.py $(BUILDDIR) + python3 ../util/check-echidna-status.py --ignore-failure $(BUILDDIR) @echo @echo "Uploaded $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" @@ -266,7 +266,7 @@ WD-echidna-CI: WD-tar -F "token=$(W3C_ECHIDNA_TOKEN_CORE)" \ -F "decision=$(DECISION_URL)" \ -F "dry-run=$(ECHIDNA_DRYRUN)" | tee $(BUILDDIR)/WD-echidna-id.txt - python3 ../util/check-echidna-status.py $(BUILDDIR) + python3 ../util/check-echidna-status.py --ignore-failure $(BUILDDIR) @echo @echo "Uploaded $(W3C_STATUS). Check its status at https://labs.w3.org/echidna/api/status?id=`cat $(BUILDDIR)/WD-echidna-id.txt`" diff --git a/document/core/appendix/algorithm.rst b/document/core/appendix/algorithm.rst index 66d2d59ce..3021408ca 100644 --- a/document/core/appendix/algorithm.rst +++ b/document/core/appendix/algorithm.rst @@ -277,7 +277,7 @@ It allocates a new frame record recording them along with the current height of Popping a frame first checks that the control stack is not empty. It then verifies that the operand stack contains the right types of values expected at the end of the exited block and pops them off the operand stack. Afterwards, it checks that the stack has shrunk back to its initial height. -Finally, it undoes all changes to the initialization status of locals that happend inside the block. +Finally, it undoes all changes to the initialization status of locals that happened inside the block. The type of the :ref:`label ` associated with a control frame is either that of the stack at the start or the end of the frame, determined by the opcode that it originates from. diff --git a/document/core/appendix/changes.rst b/document/core/appendix/changes.rst index 14c06079f..61a7a54a7 100644 --- a/document/core/appendix/changes.rst +++ b/document/core/appendix/changes.rst @@ -367,7 +367,7 @@ Added instructions to perform tail calls. [#proposal-tailcall]_ Exception Handling .................. -Added tag definitions, imports, and exports, and instructions to throw and catch exceptions [#proposal-exn]_ +Added tag definitions, imports, and exports, and instructions to throw and catch exceptions. [#proposal-exn]_ * :ref:`Modules ` may @@ -500,7 +500,7 @@ Added more precise types for references. [#proposal-typedref]_ * Refined typing of :ref:`local instructions ` and :ref:`instruction sequences ` to track the :ref:`initialization status ` of :ref:`locals ` with non-defaultable type -* Refined decoding of :ref:`active ` :ref:`element segments ` with implicit element type and plain function indices (opcode :math:`0`) to produce :ref:`non-null ` :ref:`reference type `. +* Refined decoding of :ref:`active ` :ref:`element segments ` with implicit element type and plain function indices (opcode :math:`0`) to produce :ref:`non-null ` :ref:`reference type ` * Extended :ref:`table definitions ` with optional initializer expression diff --git a/document/core/appendix/custom.rst b/document/core/appendix/custom.rst index 7b4116438..320df0d55 100644 --- a/document/core/appendix/custom.rst +++ b/document/core/appendix/custom.rst @@ -178,7 +178,7 @@ It consists of an :ref:`indirect name map ` assigning fi .. math:: \begin{array}{llclll} \production{field name subsection} & \Bfieldnamesubsec &::=& - \Bnamesubsection_10(\Bindirectnamemap) \\ + \Bnamesubsection_{10}(\Bindirectnamemap) \\ \end{array} @@ -194,7 +194,7 @@ It consists of a :ref:`name map ` assigning tag names to :ref:`t .. math:: \begin{array}{llclll} \production{tag name subsection} & \Btagnamesubsec &::=& - \Bnamesubsection_1(\Bnamemap) \\ + \Bnamesubsection_{11}(\Bnamemap) \\ \end{array} diff --git a/document/core/appendix/index-instructions.py b/document/core/appendix/index-instructions.py index 0130ce804..3bd1d1921 100755 --- a/document/core/appendix/index-instructions.py +++ b/document/core/appendix/index-instructions.py @@ -478,7 +478,7 @@ def Instruction(version, name, opcode, type=None, validation=None, execution=Non Instruction(2.0, r'\I8X16.\VABS', r'\hex{FD}~~\hex{60}', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-iabs'), Instruction(2.0, r'\I8X16.\VNEG', r'\hex{FD}~~\hex{61}', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-ineg'), Instruction(2.0, r'\I8X16.\VPOPCNT', r'\hex{FD}~~\hex{62}', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-ipopcnt'), - Instruction(2.0, r'\I8X16.\VALLTRUE', r'\hex{FD}~~\hex{63}', r'[\V128] \to [\I32]', r'valid-vtestop', r'exec-vtestop', r'op-inez'), + Instruction(2.0, r'\I8X16.\VALLTRUE', r'\hex{FD}~~\hex{63}', r'[\V128] \to [\I32]', r'valid-vtestop', r'exec-vtestop'), Instruction(2.0, r'\I8X16.\VBITMASK', r'\hex{FD}~~\hex{64}', r'[\V128] \to [\I32]', r'valid-vbitmask', r'exec-vbitmask', r'op-ivbitmask'), Instruction(2.0, r'\I8X16.\VNARROW\K{\_i16x8\_s}', r'\hex{FD}~~\hex{65}', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vnarrow', r'op-vnarrow'), Instruction(2.0, r'\I8X16.\VNARROW\K{\_i16x8\_u}', r'\hex{FD}~~\hex{66}', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vnarrow', r'op-vnarrow'), @@ -616,6 +616,7 @@ def Instruction(version, name, opcode, type=None, validation=None, execution=Non Instruction(2.0, r'\F32X4.\VPMAX', r'\hex{FD}~~\hex{EB}~~\hex{01}', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fpmax'), Instruction(2.0, r'\F64X2.\VABS', r'\hex{FD}~~\hex{EC}~~\hex{01}', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-fabs'), Instruction(2.0, r'\F64X2.\VNEG', r'\hex{FD}~~\hex{ED}~~\hex{01}', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-fneg'), + Instruction(0.0, None, r'\hex{FD}~\hex{EE}~\hex{01}'), Instruction(2.0, r'\F64X2.\VSQRT', r'\hex{FD}~~\hex{EF}~~\hex{01}', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-fsqrt'), Instruction(2.0, r'\F64X2.\VADD', r'\hex{FD}~~\hex{F0}~~\hex{01}', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fadd'), Instruction(2.0, r'\F64X2.\VSUB', r'\hex{FD}~~\hex{F1}~~\hex{01}', r'[\V128~\V128] \to [\V128]', r'valid-vbinop', r'exec-vbinop', r'op-fsub'), diff --git a/document/core/appendix/properties.rst b/document/core/appendix/properties.rst index 4a010bced..39cb22b82 100644 --- a/document/core/appendix/properties.rst +++ b/document/core/appendix/properties.rst @@ -1087,27 +1087,6 @@ To that end, all previous typing judgements :math:`C \vdash \X{prop}` are genera } -.. index:: function address, extern value, extern type, function type - -:math:`\INVOKE~\funcaddr` -......................... - -* The :ref:`external function address ` :math:`\XAFUNC~\funcaddr` must be :ref:`valid ` with :ref:`external function type ` :math:`\XTFUNC~\deftype'`. - -* The :ref:`expansion ` of the :ref:`defined type ` :math:`\deftype` must be some :ref:`function type ` :math:`\TFUNC~[t_1^\ast] \Tarrow [t_2^\ast])`. - -* Then the instruction is valid with type :math:`[t_1^\ast] \to [t_2^\ast]`. - -.. math:: - \frac{ - S \vdashexternaddr \XAFUNC~\funcaddr : \XTFUNC~\deftype - \qquad - \deftype \approx \TFUNC~[t_1^\ast] \Tarrow [t_2^\ast] - }{ - S; C \vdashadmininstr \INVOKE~\funcaddr : [t_1^\ast] \to [t_2^\ast] - } - - .. index:: label, instruction, result type :math:`\LABEL_n\{\instr_0^\ast\}~\instr^\ast` diff --git a/document/core/exec/instructions.rst b/document/core/exec/instructions.rst index 4072665e9..ecf34f60b 100644 --- a/document/core/exec/instructions.rst +++ b/document/core/exec/instructions.rst @@ -401,7 +401,7 @@ Furthermore, the resulting store must be :ref:`valid `, i.e., all d ~\\[-1ex] \begin{array}{l} \begin{array}{lcl@{\qquad}l} - S; \val^n~(\INVOKE~a) &\stepto& S'; \result + S; \val^n~(\REFFUNCADDR~a)~\CALLREF &\stepto& S'; \result \end{array} \\ \qquad \begin{array}[t]{@{}r@{~}l@{}} @@ -410,7 +410,7 @@ Furthermore, the resulting store must be :ref:`valid `, i.e., all d \wedge & (S'; \result) \in \X{hf}(S; \val^n) \\ \end{array} \\ \begin{array}{lcl@{\qquad}l} - S; \val^n~(\INVOKE~a) &\stepto& S; \val^n~(\INVOKE~a) + S; \val^n~(\REFFUNCADDR~a)~\CALLREF &\stepto& S; \val^n~(\REFFUNCADDR~a)~\CALLREF \end{array} \\ \qquad \begin{array}[t]{@{}r@{~}l@{}} diff --git a/document/core/exec/modules.rst b/document/core/exec/modules.rst index 94dfdb05c..30cbc0a6e 100644 --- a/document/core/exec/modules.rst +++ b/document/core/exec/modules.rst @@ -220,8 +220,6 @@ $${definition: rundata_ runelem_} Invocation ~~~~~~~~~~ -$${definition-prose: invoke} - Once a :ref:`module ` has been :ref:`instantiated `, any exported function can be *invoked* externally via its :ref:`function address ` ${:funcaddr} in the :ref:`store ` ${:s} and an appropriate list ${:val*} of argument :ref:`values `. Invocation may *fail* with an error if the arguments do not fit the :ref:`function type `. @@ -231,42 +229,6 @@ It is up to the :ref:`embedder ` to define how such conditions are rep .. note:: If the :ref:`embedder ` API performs type checks itself, either statically or dynamically, before performing an invocation, then no failure other than traps or exceptions can occur. -The following steps are performed: - -1. Assert: :math:`S.\SFUNCS[\funcaddr]` exists. - -2. Let :math:`\funcinst` be the :ref:`function instance ` :math:`S.\SFUNCS[\funcaddr]`. - -3. Let :math:`\TFUNC~[t_1^n] \Tarrow [t_2^m]` be the :ref:`composite type ` :math:`\expanddt(\funcinst.\FITYPE)`. - -4. If the length :math:`|\val^\ast|` of the provided argument values is different from the number :math:`n` of expected arguments, then: - - a. Fail. - -5. For each :ref:`value type ` :math:`t_i` in :math:`t_1^n` and corresponding :ref:`value ` :math:`val_i` in :math:`\val^\ast`, do: - - a. If :math:`\val_i` is not :ref:`valid ` with value type :math:`t_i`, then: - - i. Fail. - -6. Let :math:`F` be the dummy :ref:`frame ` :math:`\{ \AMODULE~\{\}, \ALOCALS~\epsilon \}`. - -7. Push the frame :math:`F` to the stack. - -8. Push the values :math:`\val^\ast` to the stack. - -9. :ref:`Invoke ` the function instance at address :math:`\funcaddr`. - -Once the function has returned, the following steps are executed: - -1. Assert: due to :ref:`validation `, :math:`m` :ref:`values ` are on the top of the stack. - -2. Pop :math:`\val_{\F{res}}^m` from the stack. - -3. Assert: due to :ref:`validation `, the frame :math:`F` is now on the top of the stack. - -4. Pop the frame :math:`F` from the stack. - -The values ${:val_RES^m} are returned as the results of the invocation. +$${definition-prose: invoke} $${definition: invoke} diff --git a/document/core/exec/numerics.rst b/document/core/exec/numerics.rst index 6e015ae0b..ce0e42fc8 100644 --- a/document/core/exec/numerics.rst +++ b/document/core/exec/numerics.rst @@ -592,7 +592,7 @@ The integer result of predicates -- i.e., :ref:`tests ` and :ref: .. math:: \begin{array}{@{}lcll} - \inez_N(i) &=& \tobool(i =/= 0) + \inez_N(i) &=& \tobool(i \neq 0) \end{array} diff --git a/document/core/exec/runtime.rst b/document/core/exec/runtime.rst index e325e1751..d54d8fa73 100644 --- a/document/core/exec/runtime.rst +++ b/document/core/exec/runtime.rst @@ -378,7 +378,7 @@ It is an invariant of the semantics that all elements of a segment have a type : Data Instances ~~~~~~~~~~~~~~ -An *data instance* is the runtime representation of a :ref:`data segment `. +A *data instance* is the runtime representation of a :ref:`data segment `. It holds a list of :ref:`bytes `. $${syntax: datainst} diff --git a/document/core/exec/types.rst b/document/core/exec/types.rst index 5d4e5109a..a5e60f624 100644 --- a/document/core/exec/types.rst +++ b/document/core/exec/types.rst @@ -10,7 +10,7 @@ It is an invariant of the semantics that all types occurring during execution ar .. note:: Runtime type checks generally involve types from multiple modules or types not defined by a module at all, - such that any module-local :ref:`type indices ` occurring inside them would not geenrally be meaningful. + such that any module-local :ref:`type indices ` occurring inside them would not generally be meaningful. diff --git a/document/core/syntax/instructions.rst b/document/core/syntax/instructions.rst index 478a7199a..fa540049f 100644 --- a/document/core/syntax/instructions.rst +++ b/document/core/syntax/instructions.rst @@ -196,7 +196,7 @@ Instructions in this group are concerned with linear :ref:`memory `. $${syntax: memarg loadop_ storeop_ vloadop_ {instr/memory instr/data}} -Memory is accessed with ${:LOAD} and ${:STORE} instructions for the different :ref:`number types ` and `vector types `. +Memory is accessed with ${:LOAD} and ${:STORE} instructions for the different :ref:`number types ` and :ref:`vector types `. They all take a :ref:`memory index ` and a *memory argument* ${:memarg} that contains an address *offset* and the expected *alignment* (expressed as the exponent of a power of 2). Integer loads and stores can optionally specify a *storage size* ${:sz} that is smaller than the :ref:`bit width ` of the respective value type. @@ -213,8 +213,8 @@ The ${:MEMORY.SIZE} instruction returns the current size of a memory. The ${:MEMORY.GROW} instruction grows a memory by a given delta and returns the previous size, or ${:$(-1)} if enough memory cannot be allocated. Both instructions operate in units of :ref:`page size `. -The ${:MEMORY.FILL} instruction sets all values in a regionof a memory to a given byte. -The ${:MEMORY.COPY} instruction copies data from a source memory region to a possibly overlapping destination region in another or the same memory; the first index denotes the destination +The ${:MEMORY.FILL} instruction sets all values in a region of memory to a given byte. +The ${:MEMORY.COPY} instruction copies data from a source memory region to a possibly overlapping destination region in another or the same memory; the first index denotes the destination. The ${:MEMORY.INIT} instruction copies data from a :ref:`passive data segment ` into a memory. The ${:DATA.DROP} instruction prevents further use of a passive data segment. This instruction is intended to be used as an optimization hint. After a data segment is dropped its data can no longer be retrieved, so the memory used by this segment may be freed. @@ -339,9 +339,9 @@ For each type, several subcategories can be distinguished: * *Constants*: return a static constant. -* *Unary Operations*: consume one operand and produce one result of the respective type. +* *Unary operations*: consume one operand and produce one result of the respective type. -* *Binary Operations*: consume two operands and produce one result of the respective type. +* *Binary operations*: consume two operands and produce one result of the respective type. * *Tests*: consume one operand of the respective type and produce a Boolean integer result. diff --git a/document/core/syntax/types.rst b/document/core/syntax/types.rst index bf40675bf..4b75d6a48 100644 --- a/document/core/syntax/types.rst +++ b/document/core/syntax/types.rst @@ -302,6 +302,8 @@ $${definition-ignore: psize} * The auxiliary function :math:`\unpack` maps a storage type to the :ref:`value type ` obtained when accessing a field: +$${definition: unpack} + .. index:: ! recursive type, ! sub type, composite type, ! final, subtyping, ! roll, ! unroll, recursive type index pair: abstract syntax; recursive type diff --git a/document/core/syntax/values.rst b/document/core/syntax/values.rst index 4bf64221e..9a0293c7a 100644 --- a/document/core/syntax/values.rst +++ b/document/core/syntax/values.rst @@ -125,7 +125,7 @@ Conventions * The meta variable ${:z} ranges over floating-point values where clear from context. -* Where clear from context, shorthands like ${:+1} denote floating point values like ${f64: POS $($(NORM 1 0))}. +* Where clear from context, shorthands like ${:+1} denote floating point values like ${f64: POS $($(NORM 0 0))}. .. index:: ! numeric vector, integer, floating-point, lane, SIMD diff --git a/document/core/text/conventions.rst b/document/core/text/conventions.rst index 0949684dc..5aa3055bc 100644 --- a/document/core/text/conventions.rst +++ b/document/core/text/conventions.rst @@ -112,6 +112,10 @@ which were denoted by the corresponding :ref:`identifiers `. Unnamed indices are associated with empty (${:eps}) entries in these lists. Fields have *dependent* name spaces, and hence a separate list of field identifiers per type. +In addition, the field ${:TYPEDEFS} records the :ref:`defined type ` associated with each :ref:`type index `. +They are needed to look up the number of parameters of :ref:`function types ` when used in a :ref:`function definition `, +in order to produce the correct indices for :ref:`locals `. + An identifier context is *well-formed* if no index space contains duplicate identifiers. For fields, names need only be unique within a single type. diff --git a/document/core/text/instructions.rst b/document/core/text/instructions.rst index 6ccd8f84f..70a9a1141 100644 --- a/document/core/text/instructions.rst +++ b/document/core/text/instructions.rst @@ -1,19 +1,13 @@ .. index:: instruction .. _text-instr: +.. _text-instrs: Instructions ------------ Instructions are syntactically distinguished into *plain* and *structured* instructions. -.. math:: - \begin{array}{llclll} - \production{instruction} & \Tinstr_I &::=& - \X{in}{:}\Tplaininstr_I - &\Rightarrow& \X{in} \\ &&|& - \X{in}{:}\Tblockinstr_I - &\Rightarrow& \X{in} \\ - \end{array} +$${grammar: {Tinstr_ Tinstrs_/unfolded}} In addition, as a syntactic abbreviation, instructions can be written as S-expressions in :ref:`folded ` form, to group them visually. @@ -29,15 +23,7 @@ Labels They are the only :ref:`symbolic identifiers ` that can be bound locally in an instruction sequence. The following grammar handles the corresponding update to the :ref:`identifier context ` by :ref:`composing ` the context with an additional label entry. -.. math:: - \begin{array}{llcllll} - \production{label} & \Tlabel_I &::=& - v{:}\Tid &\Rightarrow& v, \{\ILABELS~v\} \compose I - & (\iff v \notin I.\ILABELS) \\ &&|& - v{:}\Tid &\Rightarrow& v, \{\ILABELS~v\} \compose (I \with \ILABELS[i] = \epsilon) - & (\iff I.\ILABELS[i] = v) \\ &&|& - \epsilon &\Rightarrow& \epsilon, \{\ILABELS~(\epsilon)\} \compose I \\ - \end{array} +$${grammar: Tlabel_} .. note:: The new label entry is inserted at the *beginning* of the label list in the identifier context. @@ -58,12 +44,7 @@ Parametric Instructions .. _text-drop: .. _text-select: -.. math:: - \begin{array}{llclll} - \production{instruction} & \Tplaininstr_I &::=& \dots \\ &&|& - \text{drop} &\Rightarrow& \DROP \\ &&|& - \text{select}~((t{:}\Tresult_I)^\ast)^? &\Rightarrow& \SELECT~(t^\ast)^? \\ - \end{array} +$${grammar: Tplaininstr_/parametric} .. index:: control instructions, structured control, label, block, branch, result type, label index, function index, tag index, type index, list, polymorphism, reference @@ -84,51 +65,15 @@ Control Instructions .. _text-catch: :ref:`Structured control instructions ` can bind an optional symbolic :ref:`label identifier `. -The same label identifier may optionally be repeated after the corresponding :math:`\T{end}` or :math:`\T{else}` keywords, to indicate the matching delimiters. +The same label identifier may optionally be repeated after the corresponding ${grammar-case: "end"} or ${grammar-case: "else"} keywords, to indicate the matching delimiters. Their :ref:`block type ` is given as a :ref:`type use `, analogous to the type of :ref:`functions `. However, the special case of a type use that is syntactically empty or consists of only a single :ref:`result ` is not regarded as an :ref:`abbreviation ` for an inline :ref:`function type `, but is parsed directly into an optional :ref:`value type `. -.. math:: - \begin{array}{llclll} - \production{block type} & \Tblocktype_I & - \begin{array}[t]{@{}c@{}} ::= \\ | \\ \end{array} - & - \begin{array}[t]{@{}lcll@{}} - (t{:}\Tresult_I)^? &\Rightarrow& t^? \\ - x,I'{:}\Ttypeuse_I &\Rightarrow& x & (\iff I' = \{\ILOCALS~(\epsilon)^\ast\}) \\ - \end{array} \\ - \production{block instruction} & \Tblockinstr_I &::=& - \text{block}~~(v^?,I'){:}\Tlabel_I~~\X{bt}{:}\Tblocktype_I~~(\X{in}{:}\Tinstr_{I'})^\ast~~\text{end}~~{v'}^?{:}\Tid^? - \\ &&&\qquad \Rightarrow\quad \BLOCK~\X{bt}~\X{in}^\ast - \qquad\quad~~ (\iff {v'}^? = \epsilon \vee {v'}^? = v^?) \\ &&|& - \text{loop}~~(v^?,I'){:}\Tlabel_I~~\X{bt}{:}\Tblocktype_I~~(\X{in}{:}\Tinstr_{I'})^\ast~~\text{end}~~{v'}^?{:}\Tid^? - \\ &&&\qquad \Rightarrow\quad \LOOP~\X{bt}~\X{in}^\ast - \qquad\qquad (\iff {v'}^? = \epsilon \vee {v'}^? = v^?) \\ &&|& - \text{if}~~(v^?,I'){:}\Tlabel_I~~\X{bt}{:}\Tblocktype_I~~(\X{in}_1{:}\Tinstr_{I'})^\ast~~ - \text{else}~~v_1^?{:}\Tid_1^?~~(\X{in}_2{:}\Tinstr_{I'})^\ast~~\text{end}~~v_2^?{:}\Tid_2^? - \\ &&&\qquad \Rightarrow\quad \IF~\X{bt}~\X{in}_1^\ast~\ELSE~\X{in}_2^\ast - \qquad (\iff v_1^? = \epsilon \vee v_1^? = v^?, v_2^? = \epsilon \vee v_2^? = v^?) \\ &&|& - \text{try\_table}~~I'{:}\Tlabel_I~~\X{bt}{:}\Tblocktype~~(c{:}\Tcatch_I)^\ast~~(\X{in}{:}\Tinstr_{I'})^\ast~~\text{end}~~\Tid^? - \\ &&&\qquad \Rightarrow\quad \TRYTABLE~\X{bt}~c^\ast~\X{in}^\ast - \qquad\qquad (\iff \Tid^? = \epsilon \vee \Tid^? = \Tlabel) \\ - \production{catch clause} & \Tcatch_I & - \begin{array}[t]{@{}c@{}} ::= \\ | \\ | \\ | \\ \end{array} - & - \begin{array}[t]{@{}lcll@{}} - \text{(}~\text{catch}~~x{:}\Ttagidx_I~~l{:}\Tlabelidx_I~\text{)} - &\Rightarrow& \CATCH~x~l \\ - \text{(}~\text{catch\_ref}~~x{:}\Ttagidx_I~~l{:}\Tlabelidx_I~\text{)} - &\Rightarrow& \CATCHREF~x~l \\ - \text{(}~\text{catch\_all}~~l{:}\Tlabelidx_I~\text{)} - &\Rightarrow& \CATCHALL~l \\ - \text{(}~\text{catch\_all\_ref}~~l{:}\Tlabelidx_I~\text{)} - &\Rightarrow& \CATCHALLREF~l \\ - \end{array} \\ - \end{array} +$${grammar: Tblocktype_ Tblockinstr_/plain Tcatch_} .. note:: - The side condition stating that the :ref:`identifier context ` :math:`I'` must only contain unnamed entries in the rule for |Ttypeuse| block types enforces that no identifier can be bound in any |Tparam| declaration for a block type. + The side condition stating that the :ref:`identifier context ` ${idctxt: I'} must only contain unnamed entries in the rule for ${grammar-case: Ttypeuse} block types enforces that no identifier can be bound in any ${grammar-case: Tparam} declaration for a block type. .. _text-nop: @@ -151,62 +96,20 @@ However, the special case of a type use that is syntactically empty or consists All other control instruction are represented verbatim. -.. math:: - \begin{array}{llcllll} - \production{plain instruction} & \Tplaininstr_I &::=& - \text{unreachable} &\Rightarrow& \UNREACHABLE \\ &&|& - \text{nop} &\Rightarrow& \NOP \\ &&|& - \text{br}~~l{:}\Tlabelidx_I &\Rightarrow& \BR~l \\ &&|& - \text{br\_if}~~l{:}\Tlabelidx_I &\Rightarrow& \BRIF~l \\ &&|& - \text{br\_table}~~l^\ast{:}\Tlist(\Tlabelidx_I)~~l_N{:}\Tlabelidx_I - &\Rightarrow& \BRTABLE~l^\ast~l_N \\ &&|& - \text{br\_on\_null}~~l{:}\Tlabelidx_I &\Rightarrow& \BRONNULL~l \\ &&|& - \text{br\_on\_non\_null}~~l{:}\Tlabelidx_I &\Rightarrow& \BRONNONNULL~l \\ &&|& - \text{br\_on\_cast}~~l{:}\Tlabelidx_I~~t_1{:}\Treftype~~t_2{:}\Treftype &\Rightarrow& \BRONCAST~l~t_1~t_2 \\ &&|& - \text{br\_on\_cast\_fail}~~l{:}\Tlabelidx_I~~t_1{:}\Treftype~~t_2{:}\Treftype &\Rightarrow& \BRONCASTFAIL~l~t_1~t_2 \\ &&|& - \text{return} &\Rightarrow& \RETURN \\ &&|& - \text{call}~~x{:}\Tfuncidx_I &\Rightarrow& \CALL~x \\ &&|& - \text{call\_ref}~~x{:}\Ttypeidx &\Rightarrow& \CALLREF~x \\ &&|& - \text{call\_indirect}~~x{:}\Ttableidx~~y,I'{:}\Ttypeuse_I &\Rightarrow& \CALLINDIRECT~x~y - & (\iff I' = \{\ILOCALS~(\epsilon)^\ast\}) \\&&|& - \text{return\_call}~~x{:}\Tfuncidx_I &\Rightarrow& \RETURNCALL~x \\ &&|& - \text{return\_call\_ref}~~x{:}\Ttypeidx &\Rightarrow& \RETURNCALLREF~x \\ &&|& - \text{return\_call\_indirect}~~x{:}\Ttableidx~~y,I'{:}\Ttypeuse_I &\Rightarrow& \RETURNCALLINDIRECT~x~y - & (\iff I' = \{\ILOCALS~(\epsilon)^\ast\}) \\ &&|& - \text{throw}~~x{:}\Ttagidx_I &\Rightarrow& \THROW~x \\ &&|& - \text{throw\_ref} &\Rightarrow& \THROWREF \\ &&|& - \dots - \end{array} - .. note:: - The side condition stating that the :ref:`identifier context ` :math:`I'` must only contain unnamed entries in the rule for |CALLINDIRECT| enforces that no identifier can be bound in any |Tparam| declaration appearing in the type annotation. + The side condition stating that the :ref:`identifier context ` ${idctxt: I'} must only contain unnamed entries in the rule for |CALLINDIRECT| enforces that no identifier can be bound in any |Tparam| declaration appearing in the type annotation. Abbreviations ............. -The :math:`\text{else}` keyword of an :math:`\text{if}` instruction can be omitted if the following instruction sequence is empty. +The ${grammar-case: "else"} keyword of an ${grammar-case: "if"} instruction can be omitted if the following instruction sequence is empty. -.. math:: - \begin{array}{llclll} - \production{block instruction} & - \text{if}~~\Tlabel~~\Tblocktype_I~~\Tinstr^\ast~~\text{end} - &\equiv& - \text{if}~~\Tlabel~~\Tblocktype_I~~\Tinstr^\ast~~\text{else}~~\text{end} - \end{array} +$${grammar: Tblockinstr_/abbrev} -Also, for backwards compatibility, the table index to :math:`\text{call\_indirect}` and :math:`\text{return\_call\_indirect}` can be omitted, defaulting to :math:`0`. +Also, for backwards compatibility, the table index to ${grammar-case: "call_indirect"} and ${grammar-case: "return_call_indirect"} can be omitted, defaulting to ${:0}. -.. math:: - \begin{array}{llclll} - \production{plain instruction} & - \text{call\_indirect}~~\Ttypeuse - &\equiv& - \text{call\_indirect}~~0~~\Ttypeuse \\ & - \text{return\_call\_indirect}~~\Ttypeuse - &\equiv& - \text{return\_call\_indirect}~~0~~\Ttypeuse \\ - \end{array} +$${grammar: Tplaininstr_/func-abbrev} .. index:: variable instructions, local index, global index @@ -222,15 +125,7 @@ Variable Instructions .. _text-global.get: .. _text-global.set: -.. math:: - \begin{array}{llclll} - \production{instruction} & \Tplaininstr_I &::=& \dots \\ &&|& - \text{local.get}~~x{:}\Tlocalidx_I &\Rightarrow& \LOCALGET~x \\ &&|& - \text{local.set}~~x{:}\Tlocalidx_I &\Rightarrow& \LOCALSET~x \\ &&|& - \text{local.tee}~~x{:}\Tlocalidx_I &\Rightarrow& \LOCALTEE~x \\ &&|& - \text{global.get}~~x{:}\Tglobalidx_I &\Rightarrow& \GLOBALGET~x \\ &&|& - \text{global.set}~~x{:}\Tglobalidx_I &\Rightarrow& \GLOBALSET~x \\ - \end{array} +$${grammar: {Tplaininstr_/local Tplaininstr_/global}} .. index:: table instruction, table index @@ -249,36 +144,15 @@ Table Instructions .. _text-table.init: .. _text-elem.drop: -.. math:: - \begin{array}{llclll} - \production{instruction} & \Tplaininstr_I &::=& \dots \\ &&|& - \text{table.get}~~x{:}\Ttableidx_I &\Rightarrow& \TABLEGET~x \\ &&|& - \text{table.set}~~x{:}\Ttableidx_I &\Rightarrow& \TABLESET~x \\ &&|& - \text{table.size}~~x{:}\Ttableidx_I &\Rightarrow& \TABLESIZE~x \\ &&|& - \text{table.grow}~~x{:}\Ttableidx_I &\Rightarrow& \TABLEGROW~x \\ &&|& - \text{table.fill}~~x{:}\Ttableidx_I &\Rightarrow& \TABLEFILL~x \\ &&|& - \text{table.copy}~~x{:}\Ttableidx_I~~y{:}\Ttableidx_I &\Rightarrow& \TABLECOPY~x~y \\ &&|& - \text{table.init}~~x{:}\Ttableidx_I~~y{:}\Telemidx_I &\Rightarrow& \TABLEINIT~x~y \\ &&|& - \text{elem.drop}~~x{:}\Telemidx_I &\Rightarrow& \ELEMDROP~x \\ - \end{array} +$${grammar: {Tplaininstr_/table-plain Tplaininstr_/elem}} Abbreviations ............. -For backwards compatibility, all :ref:`table indices ` may be omitted from table instructions, defaulting to :math:`0`. +For backwards compatibility, all :ref:`table indices ` may be omitted from table instructions, defaulting to ${:0}. -.. math:: - \begin{array}{llcl} - \production{instruction} & - \text{table.get} &\equiv& \text{table.get}~~\text{0} \\ & - \text{table.set} &\equiv& \text{table.set}~~\text{0} \\ & - \text{table.size} &\equiv& \text{table.size}~~\text{0} \\ & - \text{table.grow} &\equiv& \text{table.grow}~~\text{0} \\ & - \text{table.fill} &\equiv& \text{table.fill}~~\text{0} \\ & - \text{table.copy} &\equiv& \text{table.copy}~~\text{0}~~\text{0} \\ & - \text{table.init}~~x{:}\Telemidx_I &\equiv& \text{table.init}~~\text{0}~~x{:}\Telemidx_I \\ - \end{array} +$${grammar: Tplaininstr_/table-abbrev} .. index:: memory instruction, memory index @@ -289,6 +163,7 @@ Memory Instructions ~~~~~~~~~~~~~~~~~~~ .. _text-memarg: +.. _text-laneidx: .. _text-load: .. _text-loadn: .. _text-store: @@ -301,131 +176,18 @@ Memory Instructions .. _text-data.drop: The offset and alignment immediates to memory instructions are optional. -The offset defaults to :math:`\T{0}`, the alignment to the storage size of the respective memory access, which is its *natural alignment*. -Lexically, an |Toffset| or |Talign| phrase is considered a single :ref:`keyword token `, so no :ref:`white space ` is allowed around the :math:`\text{=}`. - -.. math:: - \begin{array}{llcllll} - \production{memory argument} & \Tmemarg_N &::=& - o{:}\Toffset~~a{:}\Talign_N &\Rightarrow& \{ \ALIGN~n,~\OFFSET~o \} & (\iff a = 2^n) \\ - \production{memory offset} & \Toffset &::=& - \text{offset{=}}o{:}\Tu64 &\Rightarrow& o \\ &&|& - \epsilon &\Rightarrow& 0 \\ - \production{memory alignment} & \Talign_N &::=& - \text{align{=}}a{:}\Tu64 &\Rightarrow& a \\ &&|& - \epsilon &\Rightarrow& N \\ - \production{instruction} & \Tplaininstr_I &::=& \dots \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\ &&|& - \text{i32.load}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \I32.\LOAD~x~m \\ &&|& - \text{i64.load}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \I64.\LOAD~x~m \\ &&|& - \text{f32.load}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \F32.\LOAD~x~m \\ &&|& - \text{f64.load}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \F64.\LOAD~x~m \\ &&|& - \text{v128.load}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_{16} &\Rightarrow& \V128.\LOAD~x~m \\ &&|& - \text{i32.load8\_s}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1 &\Rightarrow& \I32.\LOAD\K{8\_s}~x~m \\ &&|& - \text{i32.load8\_u}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1 &\Rightarrow& \I32.\LOAD\K{8\_u}~x~m \\ &&|& - \text{i32.load16\_s}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2 &\Rightarrow& \I32.\LOAD\K{16\_s}~x~m \\ &&|& - \text{i32.load16\_u}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2 &\Rightarrow& \I32.\LOAD\K{16\_u}~x~m \\ &&|& - \text{i64.load8\_s}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1 &\Rightarrow& \I64.\LOAD\K{8\_s}~x~m \\ &&|& - \text{i64.load8\_u}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1 &\Rightarrow& \I64.\LOAD\K{8\_u}~x~m \\ &&|& - \text{i64.load16\_s}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2 &\Rightarrow& \I64.\LOAD\K{16\_s}~x~m \\ &&|& - \text{i64.load16\_u}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2 &\Rightarrow& \I64.\LOAD\K{16\_u}~x~m \\ &&|& - \text{i64.load32\_s}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \I64.\LOAD\K{32\_s}~x~m \\ &&|& - \text{i64.load32\_u}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \I64.\LOAD\K{32\_u}~x~m \\ &&|& - \text{v128.load8x8\_s}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \V128.\LOAD\K{8x8\_s}~x~m \\ &&|& - \text{v128.load8x8\_u}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \V128.\LOAD\K{8x8\_u}~x~m \\ &&|& - \text{v128.load16x4\_s}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \V128.\LOAD\K{16x4\_s}~x~m \\ &&|& - \text{v128.load16x4\_u}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \V128.\LOAD\K{16x4\_u}~x~m \\ &&|& - \text{v128.load32x2\_s}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \V128.\LOAD\K{32x2\_s}~x~m \\ &&|& - \text{v128.load32x2\_u}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \V128.\LOAD\K{32x2\_u}~x~m \\ &&|& - \text{v128.load8\_splat}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1 &\Rightarrow& \V128.\LOAD\K{8\_splat}~x~m \\ &&|& - \text{v128.load16\_splat}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2 &\Rightarrow& \V128.\LOAD\K{16\_splat}~x~m \\ &&|& - \text{v128.load32\_splat}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \V128.\LOAD\K{32\_splat}~x~m \\ &&|& - \text{v128.load64\_splat}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \V128.\LOAD\K{64\_splat}~x~m \\ &&|& - \text{v128.load32\_zero}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \V128.\LOAD\K{32\_zero}~x~m \\ &&|& - \text{v128.load64\_zero}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \V128.\LOAD\K{64\_zero}~x~m \\ &&|& - \text{v128.load8\_lane}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1~~y{:}\Tu8 &\Rightarrow& \V128.\LOAD\K{8\_lane}~x~m~y \\ &&|& - \text{v128.load16\_lane}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2~~y{:}\Tu8 &\Rightarrow& \V128.\LOAD\K{16\_lane}~x~m~y \\ &&|& - \text{v128.load32\_lane}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4~~y{:}\Tu8 &\Rightarrow& \V128.\LOAD\K{32\_lane}~x~m~y \\ &&|& - \text{v128.load64\_lane}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8~~y{:}\Tu8 &\Rightarrow& \V128.\LOAD\K{64\_lane}~x~m~y \\ &&|& - \text{i32.store}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \I32.\STORE~x~m \\ &&|& - \text{i64.store}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \I64.\STORE~x~m \\ &&|& - \text{f32.store}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \F32.\STORE~x~m \\ &&|& - \text{f64.store}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8 &\Rightarrow& \F64.\STORE~x~m \\ &&|& - \text{v128.store}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_{16} &\Rightarrow& \V128.\STORE~x~m \\ &&|& - \text{i32.store8}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1 &\Rightarrow& \I32.\STORE\K{8}~x~m \\ &&|& - \text{i32.store16}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2 &\Rightarrow& \I32.\STORE\K{16}~x~m \\ &&|& - \text{i64.store8}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1 &\Rightarrow& \I64.\STORE\K{8}~x~m \\ &&|& - \text{i64.store16}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2 &\Rightarrow& \I64.\STORE\K{16}~x~m \\ &&|& - \text{i64.store32}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4 &\Rightarrow& \I64.\STORE\K{32}~x~m \\ &&|& - \text{v128.store8\_lane}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_1~~y{:}\Tu8 &\Rightarrow& \V128.\STORE\K{8\_lane}~x~m~y \\ &&|& - \text{v128.store16\_lane}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_2~~y{:}\Tu8 &\Rightarrow& \V128.\STORE\K{16\_lane}~x~m~y \\ &&|& - \text{v128.store32\_lane}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_4~~y{:}\Tu8 &\Rightarrow& \V128.\STORE\K{32\_lane}~x~m~y \\ &&|& - \text{v128.store64\_lane}~~x{:}\Tmemidx_I~~m{:}\Tmemarg_8~~y{:}\Tu8 &\Rightarrow& \V128.\STORE\K{64\_lane}~x~m~y \\ &&|& - \text{memory.size}~~x{:}\Tmemidx_I &\Rightarrow& \MEMORYSIZE~x \\ &&|& - \text{memory.grow}~~x{:}\Tmemidx_I &\Rightarrow& \MEMORYGROW~x \\ &&|& - \text{memory.fill}~~x{:}\Tmemidx_I &\Rightarrow& \MEMORYFILL~x \\ &&|& - \text{memory.copy}~~x{:}\Tmemidx_I~~y{:}\Tmemidx_I &\Rightarrow& \MEMORYCOPY~x~y \\ &&|& - \text{memory.init}~~x{:}\Tmemidx_I~~y{:}\Tdataidx_I &\Rightarrow& \MEMORYINIT~x~y \\ &&|& - \text{data.drop}~~x{:}\Tdataidx_I &\Rightarrow& \DATADROP~x \\ - \end{array} +The offset defaults to ${:0}, the alignment to the storage size of the respective memory access, which is its *natural alignment*. +Lexically, an ${grammar-case: Toffset} or ${grammar-case: Talign_} phrase is considered a single :ref:`keyword token `, so no :ref:`white space ` is allowed around the ${grammar-case: "="}. + +$${grammar: {Tmemarg_ Toffset Talign_ Tlaneidx Tplaininstr_/memory-plain Tplaininstr_/data}} Abbreviations ............. -As an abbreviation, the memory index can be omitted in all memory instructions, defaulting to :math:`\T{0}`. - -.. math:: - \begin{array}{llclll} - \production{instruction} & - \Tnumtype\text{.load}~~\Tmemarg - &\equiv& - \Tnumtype\text{.load}~~\text{0}~~\Tmemarg \\& - \Tvectype\text{.load}~~\Tmemarg - &\equiv& - \Tvectype\text{.load}~~\text{0}~~\Tmemarg \\& - \Tnumtype\text{.load}N\text{\_}\sx~~\Tmemarg - &\equiv& - \Tnumtype\text{.load}N\text{\_}\sx~~\text{0}~~\Tmemarg \\& - \Tvectype\text{.load}{N}\K{x}M\text{\_}\sx~~\Tmemarg - &\equiv& - \Tvectype\text{.load}{N}\K{x}M\text{\_}\sx~~\text{0}~~\Tmemarg \\& - \Tvectype\text{.load}N\text{\_splat}~~\Tmemarg - &\equiv& - \Tvectype\text{.load}N\text{\_splat}~~\text{0}~~\Tmemarg \\& - \Tvectype\text{.load}N\text{\_zero}~~\Tmemarg - &\equiv& - \Tvectype\text{.load}N\text{\_zero}~~\text{0}~~\Tmemarg \\& - \Tvectype\text{.load}N\text{\_lane}~~\Tmemarg~~\Tu8 - &\equiv& - \Tvectype\text{.load}N\text{\_lane}~~\text{0}~~\Tmemarg~~\Tu8 \\& - \Tnumtype\text{.store}~~\Tmemarg - &\equiv& - \Tnumtype\text{.store}~~\text{0}~~\Tmemarg \\& - \Tvectype\text{.store}~~\Tmemarg - &\equiv& - \Tvectype\text{.store}~~\text{0}~~\Tmemarg \\& - \Tnumtype\text{.store}N~~\Tmemarg - &\equiv& - \Tnumtype\text{.store}N~~\text{0}~~\Tmemarg \\& - \Tvectype\text{.store}N\text{\_lane}~~\Tmemarg~~\Tu8 - &\equiv& - \Tvectype\text{.store}N\text{\_lane}~~\text{0}~~\Tmemarg~~\Tu8 \\& - \text{memory.size} - &\equiv& - \text{memory.size}~~\text{0} \\& - \text{memory.grow} - &\equiv& - \text{memory.grow}~~\text{0} \\& - \text{memory.fill} - &\equiv& - \text{memory.fill}~~\text{0} \\& - \text{memory.copy} - &\equiv& - \text{memory.copy}~~\text{0}~~\text{0} \\& - \text{memory.init}~~x{:}\Telemidx_I - &\equiv& - \text{memory.init}~~\text{0}~~x{:}\Telemidx_I - \end{array} +As an abbreviation, the memory index can be omitted in all memory instructions, defaulting to ${:0}. + +$${grammar: Tplaininstr_/memory-abbrev} .. index:: reference instruction @@ -467,42 +229,7 @@ Reference Instructions .. _text-any.convert_extern: .. _text-extern.convert_any: -.. math:: - \begin{array}{llclll} - \production{instruction} & \Tplaininstr_I &::=& \dots \\ &&|& - \text{ref.null}~~t{:}\Theaptype_I &\Rightarrow& \REFNULL~t \\ &&|& - \text{ref.func}~~x{:}\Tfuncidx_I &\Rightarrow& \REFFUNC~x \\ &&|& - \text{ref.is\_null} &\Rightarrow& \REFISNULL \\ &&|& - \text{ref.as\_non\_null} &\Rightarrow& \REFASNONNULL \\ &&|& - \text{ref.eq} &\Rightarrow& \REFEQ \\ &&|& - \text{ref.test}~~t{:}\Treftype_I &\Rightarrow& \REFTEST~t \\ &&|& - \text{ref.cast}~~t{:}\Treftype_I &\Rightarrow& \REFCAST~t \\ &&|& - \text{struct.new}~~x{:}\Ttypeidx_I &\Rightarrow& \STRUCTNEW~x \\ &&|& - \text{struct.new\_default}~~x{:}\Ttypeidx_I &\Rightarrow& \STRUCTNEWDEFAULT~x \\ &&|& - \text{struct.get}~~x{:}\Ttypeidx_I~~y{:}\Tfieldidx_{I,x} &\Rightarrow& \STRUCTGET~x~y \\ &&|& - \text{struct.get\_u}~~x{:}\Ttypeidx_I~~y{:}\Tfieldidx_{I,x} &\Rightarrow& \STRUCTGETU~x~y \\ &&|& - \text{struct.get\_s}~~x{:}\Ttypeidx_I~~y{:}\Tfieldidx_{I,x} &\Rightarrow& \STRUCTGETS~x~y \\ &&|& - \text{struct.set}~~x{:}\Ttypeidx_I~~y{:}\Tfieldidx_{I,x} &\Rightarrow& \STRUCTSET~x~y \\ &&|& - \text{array.new}~~x{:}\Ttypeidx_I &\Rightarrow& \ARRAYNEW~x \\ &&|& - \text{array.new\_default}~~x{:}\Ttypeidx_I &\Rightarrow& \ARRAYNEWDEFAULT~x \\ &&|& - \text{array.new\_fixed}~~x{:}\Ttypeidx_I~~n{:}\Tu32 &\Rightarrow& \ARRAYNEWFIXED~x~n \\ &&|& - \text{array.new\_data}~~x{:}\Ttypeidx_I~~y{:}\Tdataidx_I &\Rightarrow& \ARRAYNEWDATA~x~y \\ &&|& - \text{array.new\_elem}~~x{:}\Ttypeidx_I~~y{:}\Telemidx_I &\Rightarrow& \ARRAYNEWELEM~x~y \\ &&|& - \text{array.get}~~x{:}\Ttypeidx_I &\Rightarrow& \ARRAYGET~x \\ &&|& - \text{array.get\_u}~~x{:}\Ttypeidx_I &\Rightarrow& \ARRAYGETU~x \\ &&|& - \text{array.get\_s}~~x{:}\Ttypeidx_I &\Rightarrow& \ARRAYGETS~x \\ &&|& - \text{array.set}~~x{:}\Ttypeidx_I &\Rightarrow& \ARRAYSET~x \\ &&|& - \text{array.len} &\Rightarrow& \ARRAYLEN \\ &&|& - \text{array.fill}~~x{:}\Ttypeidx_I &\Rightarrow& \ARRAYFILL~x \\ &&|& - \text{array.copy}~~x{:}\Ttypeidx_I~~y{:}\Ttypeidx_I &\Rightarrow& \ARRAYCOPY~x~y \\ &&|& - \text{array.init\_data}~~x{:}\Ttypeidx_I~~y{:}\Tdataidx_I &\Rightarrow& \ARRAYINITDATA~x~y \\ &&|& - \text{array.init\_elem}~~x{:}\Ttypeidx_I~~y{:}\Telemidx_I &\Rightarrow& \ARRAYINITELEM~x~y \\ &&|& - \text{ref.i31} &\Rightarrow& \REFI31 \\ &&|& - \text{i31.get\_u} &\Rightarrow& \I31GETU \\ &&|& - \text{i31.get\_s} &\Rightarrow& \I31GETS \\ &&|& - \text{any.convert\_extern} &\Rightarrow& \ANYCONVERTEXTERN \\ &&|& - \text{extern.convert\_any} &\Rightarrow& \EXTERNCONVERTANY \\ - \end{array} +$${grammar: {Tplaininstr_/ref Tplaininstr_/i31 Tplaininstr_/struct Tplaininstr_/array Tplaininstr_/extern}} .. index:: numeric instruction @@ -514,208 +241,48 @@ Numeric Instructions .. _text-const: -.. math:: - \begin{array}{llclll} - \production{instruction} & \Tplaininstr_I &::=& \dots \\&&|& - \text{i32.const}~~n{:}\Ti32 &\Rightarrow& \I32.\CONST~n \\ &&|& - \text{i64.const}~~n{:}\Ti64 &\Rightarrow& \I64.\CONST~n \\ &&|& - \text{f32.const}~~z{:}\Tf32 &\Rightarrow& \F32.\CONST~z \\ &&|& - \text{f64.const}~~z{:}\Tf64 &\Rightarrow& \F64.\CONST~z \\ - \end{array} - -.. _text-unop: -.. _text-binop: - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{i32.clz} &\Rightarrow& \I32.\CLZ \\ &&|& - \text{i32.ctz} &\Rightarrow& \I32.\CTZ \\ &&|& - \text{i32.popcnt} &\Rightarrow& \I32.\POPCNT \\ &&|& - \text{i32.add} &\Rightarrow& \I32.\ADD \\ &&|& - \text{i32.sub} &\Rightarrow& \I32.\SUB \\ &&|& - \text{i32.mul} &\Rightarrow& \I32.\MUL \\ &&|& - \text{i32.div\_s} &\Rightarrow& \I32.\DIV\K{\_s} \\ &&|& - \text{i32.div\_u} &\Rightarrow& \I32.\DIV\K{\_u} \\ &&|& - \text{i32.rem\_s} &\Rightarrow& \I32.\REM\K{\_s} \\ &&|& - \text{i32.rem\_u} &\Rightarrow& \I32.\REM\K{\_u} \\ &&|& - \text{i32.and} &\Rightarrow& \I32.\AND \\ &&|& - \text{i32.or} &\Rightarrow& \I32.\OR \\ &&|& - \text{i32.xor} &\Rightarrow& \I32.\XOR \\ &&|& - \text{i32.shl} &\Rightarrow& \I32.\SHL \\ &&|& - \text{i32.shr\_s} &\Rightarrow& \I32.\SHR\K{\_s} \\ &&|& - \text{i32.shr\_u} &\Rightarrow& \I32.\SHR\K{\_u} \\ &&|& - \text{i32.rotl} &\Rightarrow& \I32.\ROTL \\ &&|& - \text{i32.rotr} &\Rightarrow& \I32.\ROTR \\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{i64.clz} &\Rightarrow& \I64.\CLZ \\ &&|& - \text{i64.ctz} &\Rightarrow& \I64.\CTZ \\ &&|& - \text{i64.popcnt} &\Rightarrow& \I64.\POPCNT \\ &&|& - \text{i64.add} &\Rightarrow& \I64.\ADD \\ &&|& - \text{i64.sub} &\Rightarrow& \I64.\SUB \\ &&|& - \text{i64.mul} &\Rightarrow& \I64.\MUL \\ &&|& - \text{i64.div\_s} &\Rightarrow& \I64.\DIV\K{\_s} \\ &&|& - \text{i64.div\_u} &\Rightarrow& \I64.\DIV\K{\_u} \\ &&|& - \text{i64.rem\_s} &\Rightarrow& \I64.\REM\K{\_s} \\ &&|& - \text{i64.rem\_u} &\Rightarrow& \I64.\REM\K{\_u} \\ &&|& - \text{i64.and} &\Rightarrow& \I64.\AND \\ &&|& - \text{i64.or} &\Rightarrow& \I64.\OR \\ &&|& - \text{i64.xor} &\Rightarrow& \I64.\XOR \\ &&|& - \text{i64.shl} &\Rightarrow& \I64.\SHL \\ &&|& - \text{i64.shr\_s} &\Rightarrow& \I64.\SHR\K{\_s} \\ &&|& - \text{i64.shr\_u} &\Rightarrow& \I64.\SHR\K{\_u} \\ &&|& - \text{i64.rotl} &\Rightarrow& \I64.\ROTL \\ &&|& - \text{i64.rotr} &\Rightarrow& \I64.\ROTR \\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{f32.abs} &\Rightarrow& \F32.\ABS \\ &&|& - \text{f32.neg} &\Rightarrow& \F32.\NEG \\ &&|& - \text{f32.ceil} &\Rightarrow& \F32.\CEIL \\ &&|& - \text{f32.floor} &\Rightarrow& \F32.\FLOOR \\ &&|& - \text{f32.trunc} &\Rightarrow& \F32.\TRUNC \\ &&|& - \text{f32.nearest} &\Rightarrow& \F32.\NEAREST \\ &&|& - \text{f32.sqrt} &\Rightarrow& \F32.\SQRT \\ &&|& - \text{f32.add} &\Rightarrow& \F32.\ADD \\ &&|& - \text{f32.sub} &\Rightarrow& \F32.\SUB \\ &&|& - \text{f32.mul} &\Rightarrow& \F32.\MUL \\ &&|& - \text{f32.div} &\Rightarrow& \F32.\DIV \\ &&|& - \text{f32.min} &\Rightarrow& \F32.\FMIN \\ &&|& - \text{f32.max} &\Rightarrow& \F32.\FMAX \\ &&|& - \text{f32.copysign} &\Rightarrow& \F32.\COPYSIGN \\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{f64.abs} &\Rightarrow& \F64.\ABS \\ &&|& - \text{f64.neg} &\Rightarrow& \F64.\NEG \\ &&|& - \text{f64.ceil} &\Rightarrow& \F64.\CEIL \\ &&|& - \text{f64.floor} &\Rightarrow& \F64.\FLOOR \\ &&|& - \text{f64.trunc} &\Rightarrow& \F64.\TRUNC \\ &&|& - \text{f64.nearest} &\Rightarrow& \F64.\NEAREST \\ &&|& - \text{f64.sqrt} &\Rightarrow& \F64.\SQRT \\ &&|& - \text{f64.add} &\Rightarrow& \F64.\ADD \\ &&|& - \text{f64.sub} &\Rightarrow& \F64.\SUB \\ &&|& - \text{f64.mul} &\Rightarrow& \F64.\MUL \\ &&|& - \text{f64.div} &\Rightarrow& \F64.\DIV \\ &&|& - \text{f64.min} &\Rightarrow& \F64.\FMIN \\ &&|& - \text{f64.max} &\Rightarrow& \F64.\FMAX \\ &&|& - \text{f64.copysign} &\Rightarrow& \F64.\COPYSIGN \\ - \end{array} +$${grammar: Tplaininstr_/num-const} .. _text-testop: .. _text-relop: +.. _text-unop: +.. _text-binop: -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{i32.eqz} &\Rightarrow& \I32.\EQZ \\ &&|& - \text{i32.eq} &\Rightarrow& \I32.\EQ \\ &&|& - \text{i32.ne} &\Rightarrow& \I32.\NE \\ &&|& - \text{i32.lt\_s} &\Rightarrow& \I32.\LT\K{\_s} \\ &&|& - \text{i32.lt\_u} &\Rightarrow& \I32.\LT\K{\_u} \\ &&|& - \text{i32.gt\_s} &\Rightarrow& \I32.\GT\K{\_s} \\ &&|& - \text{i32.gt\_u} &\Rightarrow& \I32.\GT\K{\_u} \\ &&|& - \text{i32.le\_s} &\Rightarrow& \I32.\LE\K{\_s} \\ &&|& - \text{i32.le\_u} &\Rightarrow& \I32.\LE\K{\_u} \\ &&|& - \text{i32.ge\_s} &\Rightarrow& \I32.\GE\K{\_s} \\ &&|& - \text{i32.ge\_u} &\Rightarrow& \I32.\GE\K{\_u} \\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{i64.eqz} &\Rightarrow& \I64.\EQZ \\ &&|& - \text{i64.eq} &\Rightarrow& \I64.\EQ \\ &&|& - \text{i64.ne} &\Rightarrow& \I64.\NE \\ &&|& - \text{i64.lt\_s} &\Rightarrow& \I64.\LT\K{\_s} \\ &&|& - \text{i64.lt\_u} &\Rightarrow& \I64.\LT\K{\_u} \\ &&|& - \text{i64.gt\_s} &\Rightarrow& \I64.\GT\K{\_s} \\ &&|& - \text{i64.gt\_u} &\Rightarrow& \I64.\GT\K{\_u} \\ &&|& - \text{i64.le\_s} &\Rightarrow& \I64.\LE\K{\_s} \\ &&|& - \text{i64.le\_u} &\Rightarrow& \I64.\LE\K{\_u} \\ &&|& - \text{i64.ge\_s} &\Rightarrow& \I64.\GE\K{\_s} \\ &&|& - \text{i64.ge\_u} &\Rightarrow& \I64.\GE\K{\_u} \\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{f32.eq} &\Rightarrow& \F32.\EQ \\ &&|& - \text{f32.ne} &\Rightarrow& \F32.\NE \\ &&|& - \text{f32.lt} &\Rightarrow& \F32.\LT \\ &&|& - \text{f32.gt} &\Rightarrow& \F32.\GT \\ &&|& - \text{f32.le} &\Rightarrow& \F32.\LE \\ &&|& - \text{f32.ge} &\Rightarrow& \F32.\GE \\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{f64.eq} &\Rightarrow& \F64.\EQ \\ &&|& - \text{f64.ne} &\Rightarrow& \F64.\NE \\ &&|& - \text{f64.lt} &\Rightarrow& \F64.\LT \\ &&|& - \text{f64.gt} &\Rightarrow& \F64.\GT \\ &&|& - \text{f64.le} &\Rightarrow& \F64.\LE \\ &&|& - \text{f64.ge} &\Rightarrow& \F64.\GE \\ - \end{array} +$${grammar: { + Tplaininstr_/num-test-i32 + Tplaininstr_/num-rel-i32 + Tplaininstr_/num-un-i32 + Tplaininstr_/num-bin-i32 +}} + +$${grammar: { + Tplaininstr_/num-test-i64 + Tplaininstr_/num-rel-i64 + Tplaininstr_/num-un-i64 + Tplaininstr_/num-bin-i64 +}} + +$${grammar: { + Tplaininstr_/num-rel-f32 + Tplaininstr_/num-un-f32 + Tplaininstr_/num-bin-f32 +}} + +$${grammar: { + Tplaininstr_/num-rel-f64 + Tplaininstr_/num-un-f64 + Tplaininstr_/num-bin-f64 +}} .. _text-cvtop: -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{i32.wrap\_i64} &\Rightarrow& \I32.\WRAP\K{\_}\I64 \\ &&|& - \text{i32.trunc\_f32\_s} &\Rightarrow& \I32.\TRUNC\K{\_}\F32\K{\_s} \\ &&|& - \text{i32.trunc\_f32\_u} &\Rightarrow& \I32.\TRUNC\K{\_}\F32\K{\_u} \\ &&|& - \text{i32.trunc\_f64\_s} &\Rightarrow& \I32.\TRUNC\K{\_}\F64\K{\_s} \\ &&|& - \text{i32.trunc\_f64\_u} &\Rightarrow& \I32.\TRUNC\K{\_}\F64\K{\_u} \\ &&|& - \text{i32.trunc\_sat\_f32\_s} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F32\K{\_s} \\ &&|& - \text{i32.trunc\_sat\_f32\_u} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F32\K{\_u} \\ &&|& - \text{i32.trunc\_sat\_f64\_s} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F64\K{\_s} \\ &&|& - \text{i32.trunc\_sat\_f64\_u} &\Rightarrow& \I32.\TRUNC\K{\_sat\_}\F64\K{\_u} \\ &&|& - \text{i64.extend\_i32\_s} &\Rightarrow& \I64.\EXTEND\K{\_}\I32\K{\_s} \\ &&|& - \text{i64.extend\_i32\_u} &\Rightarrow& \I64.\EXTEND\K{\_}\I32\K{\_u} \\ &&|& - \text{i64.trunc\_f32\_s} &\Rightarrow& \I64.\TRUNC\K{\_}\F32\K{\_s} \\ &&|& - \text{i64.trunc\_f32\_u} &\Rightarrow& \I64.\TRUNC\K{\_}\F32\K{\_u} \\ &&|& - \text{i64.trunc\_f64\_s} &\Rightarrow& \I64.\TRUNC\K{\_}\F64\K{\_s} \\ &&|& - \text{i64.trunc\_f64\_u} &\Rightarrow& \I64.\TRUNC\K{\_}\F64\K{\_u} \\ &&|& - \text{i64.trunc\_sat\_f32\_s} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F32\K{\_s} \\ &&|& - \text{i64.trunc\_sat\_f32\_u} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F32\K{\_u} \\ &&|& - \text{i64.trunc\_sat\_f64\_s} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F64\K{\_s} \\ &&|& - \text{i64.trunc\_sat\_f64\_u} &\Rightarrow& \I64.\TRUNC\K{\_sat\_}\F64\K{\_u} \\ &&|& - \text{f32.convert\_i32\_s} &\Rightarrow& \F32.\CONVERT\K{\_}\I32\K{\_s} \\ &&|& - \text{f32.convert\_i32\_u} &\Rightarrow& \F32.\CONVERT\K{\_}\I32\K{\_u} \\ &&|& - \text{f32.convert\_i64\_s} &\Rightarrow& \F32.\CONVERT\K{\_}\I64\K{\_s} \\ &&|& - \text{f32.convert\_i64\_u} &\Rightarrow& \F32.\CONVERT\K{\_}\I64\K{\_u} \\ &&|& - \text{f32.demote\_f64} &\Rightarrow& \F32.\DEMOTE\K{\_}\F64 \\ &&|& - \text{f64.convert\_i32\_s} &\Rightarrow& \F64.\CONVERT\K{\_}\I32\K{\_s} \\ &&|& - \text{f64.convert\_i32\_u} &\Rightarrow& \F64.\CONVERT\K{\_}\I32\K{\_u} \\ &&|& - \text{f64.convert\_i64\_s} &\Rightarrow& \F64.\CONVERT\K{\_}\I64\K{\_s} \\ &&|& - \text{f64.convert\_i64\_u} &\Rightarrow& \F64.\CONVERT\K{\_}\I64\K{\_u} \\ &&|& - \text{f64.promote\_f32} &\Rightarrow& \F64.\PROMOTE\K{\_}\F32 \\ &&|& - \text{i32.reinterpret\_f32} &\Rightarrow& \I32.\REINTERPRET\K{\_}\F32 \\ &&|& - \text{i64.reinterpret\_f64} &\Rightarrow& \I64.\REINTERPRET\K{\_}\F64 \\ &&|& - \text{f32.reinterpret\_i32} &\Rightarrow& \F32.\REINTERPRET\K{\_}\I32 \\ &&|& - \text{f64.reinterpret\_i64} &\Rightarrow& \F64.\REINTERPRET\K{\_}\I64 \\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{thisisenough} && \phantom{thisshouldbeenough} \\[-2ex] &&|& - \text{i32.extend8\_s} &\Rightarrow& \I32.\EXTEND\K{8\_s} \\ &&|& - \text{i32.extend16\_s} &\Rightarrow& \I32.\EXTEND\K{16\_s} \\ &&|& - \text{i64.extend8\_s} &\Rightarrow& \I64.\EXTEND\K{8\_s} \\ &&|& - \text{i64.extend16\_s} &\Rightarrow& \I64.\EXTEND\K{16\_s} \\ &&|& - \text{i64.extend32\_s} &\Rightarrow& \I64.\EXTEND\K{32\_s} \\ - \end{array} +$${grammar: { + Tplaininstr_/num-cvt-i32 + Tplaininstr_/num-cvt-i64 + Tplaininstr_/num-cvt-f32 + Tplaininstr_/num-cvt-f64 + Tplaininstr_/num-cvt-reinterpret +}} .. index:: vector instruction @@ -727,357 +294,106 @@ Vector Instructions Vector constant instructions have a mandatory :ref:`shape ` descriptor, which determines how the following values are parsed. -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{v128.const}~~\text{i8x16}~~(n{:}\Ti8)^{16} &\Rightarrow& \V128.\VCONST~\bytes_{\I128}^{-1}(\bytes_{i8}(n)^{16}) \\ &&|& - \text{v128.const}~~\text{i16x8}~~(n{:}\Ti16)^{8} &\Rightarrow& \V128.\VCONST~\bytes_{\I128}^{-1}(\bytes_{i16}(n)^8) \\ &&|& - \text{v128.const}~~\text{i32x4}~~(n{:}\Ti32)^{4} &\Rightarrow& \V128.\VCONST~\bytes_{\I128}^{-1}(\bytes_{i32}(n)^4) \\ &&|& - \text{v128.const}~~\text{i64x2}~~(n{:}\Ti64)^{2} &\Rightarrow& \V128.\VCONST~\bytes_{\I128}^{-1}(\bytes_{i64}(n)^2) \\ &&|& - \text{v128.const}~~\text{f32x4}~~(z{:}\Tf32)^{4} &\Rightarrow& \V128.\VCONST~\bytes_{\I128}^{-1}(\bytes_{f32}(z)^4) \\ &&|& - \text{v128.const}~~\text{f64x2}~~(z{:}\Tf64)^{2} &\Rightarrow& \V128.\VCONST~\bytes_{\I128}^{-1}(\bytes_{f64}(z)^2) - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i8x16.shuffle}~~(laneidx{:}\Tu8)^{16} &\Rightarrow& \I8X16.\VSHUFFLE~laneidx^{16} \\ &&|& - \text{i8x16.swizzle} &\Rightarrow& \I8X16.\VSWIZZLE - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i8x16.splat} &\Rightarrow& \I8X16.\VSPLAT\\ &&|& - \text{i16x8.splat} &\Rightarrow& \I16X8.\VSPLAT\\ &&|& - \text{i32x4.splat} &\Rightarrow& \I32X4.\VSPLAT\\ &&|& - \text{i64x2.splat} &\Rightarrow& \I64X2.\VSPLAT\\ &&|& - \text{f32x4.splat} &\Rightarrow& \F32X4.\VSPLAT\\ &&|& - \text{f64x2.splat} &\Rightarrow& \F64X2.\VSPLAT\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i8x16.extract\_lane\_s}~~laneidx{:}\Tu8 &\Rightarrow& \I8X16.\VEXTRACTLANE\K{\_s}~laneidx \\ &&|& - \text{i8x16.extract\_lane\_u}~~laneidx{:}\Tu8 &\Rightarrow& \I8X16.\VEXTRACTLANE\K{\_u}~laneidx \\ &&|& - \text{i8x16.replace\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \I8X16.\VREPLACELANE~laneidx \\ &&|& - \text{i16x8.extract\_lane\_s}~~laneidx{:}\Tu8 &\Rightarrow& \I16X8.\VEXTRACTLANE\K{\_s}~laneidx \\ &&|& - \text{i16x8.extract\_lane\_u}~~laneidx{:}\Tu8 &\Rightarrow& \I16X8.\VEXTRACTLANE\K{\_u}~laneidx \\ &&|& - \text{i16x8.replace\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \I16X8.\VREPLACELANE~laneidx \\ &&|& - \text{i32x4.extract\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \I32X4.\VEXTRACTLANE~laneidx \\ &&|& - \text{i32x4.replace\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \I32X4.\VREPLACELANE~laneidx \\ &&|& - \text{i64x2.extract\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \I64X2.\VEXTRACTLANE~laneidx \\ &&|& - \text{i64x2.replace\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \I64X2.\VREPLACELANE~laneidx \\ &&|& - \text{f32x4.extract\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \F32X4.\VEXTRACTLANE~laneidx \\ &&|& - \text{f32x4.replace\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \F32X4.\VREPLACELANE~laneidx \\ &&|& - \text{f64x2.extract\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \F64X2.\VEXTRACTLANE~laneidx \\ &&|& - \text{f64x2.replace\_lane}~~laneidx{:}\Tu8 &\Rightarrow& \F64X2.\VREPLACELANE~laneidx \\ - \end{array} +$${grammar: Tplaininstr_/vec-const} -.. _text-virelop: - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i8x16.eq} &\Rightarrow& \I8X16.\VEQ\\ &&|& - \text{i8x16.ne} &\Rightarrow& \I8X16.\VNE\\ &&|& - \text{i8x16.lt\_s} &\Rightarrow& \I8X16.\VLT\K{\_s}\\ &&|& - \text{i8x16.lt\_u} &\Rightarrow& \I8X16.\VLT\K{\_u}\\ &&|& - \text{i8x16.gt\_s} &\Rightarrow& \I8X16.\VGT\K{\_s}\\ &&|& - \text{i8x16.gt\_u} &\Rightarrow& \I8X16.\VGT\K{\_u}\\ &&|& - \text{i8x16.le\_s} &\Rightarrow& \I8X16.\VLE\K{\_s}\\ &&|& - \text{i8x16.le\_u} &\Rightarrow& \I8X16.\VLE\K{\_u}\\ &&|& - \text{i8x16.ge\_s} &\Rightarrow& \I8X16.\VGE\K{\_s}\\ &&|& - \text{i8x16.ge\_u} &\Rightarrow& \I8X16.\VGE\K{\_u}\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i16x8.eq} &\Rightarrow& \I16X8.\VEQ\\ &&|& - \text{i16x8.ne} &\Rightarrow& \I16X8.\VNE\\ &&|& - \text{i16x8.lt\_s} &\Rightarrow& \I16X8.\VLT\K{\_s}\\ &&|& - \text{i16x8.lt\_u} &\Rightarrow& \I16X8.\VLT\K{\_u}\\ &&|& - \text{i16x8.gt\_s} &\Rightarrow& \I16X8.\VGT\K{\_s}\\ &&|& - \text{i16x8.gt\_u} &\Rightarrow& \I16X8.\VGT\K{\_u}\\ &&|& - \text{i16x8.le\_s} &\Rightarrow& \I16X8.\VLE\K{\_s}\\ &&|& - \text{i16x8.le\_u} &\Rightarrow& \I16X8.\VLE\K{\_u}\\ &&|& - \text{i16x8.ge\_s} &\Rightarrow& \I16X8.\VGE\K{\_s}\\ &&|& - \text{i16x8.ge\_u} &\Rightarrow& \I16X8.\VGE\K{\_u}\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i32x4.eq} &\Rightarrow& \I32X4.\VEQ\\ &&|& - \text{i32x4.ne} &\Rightarrow& \I32X4.\VNE\\ &&|& - \text{i32x4.lt\_s} &\Rightarrow& \I32X4.\VLT\K{\_s}\\ &&|& - \text{i32x4.lt\_u} &\Rightarrow& \I32X4.\VLT\K{\_u}\\ &&|& - \text{i32x4.gt\_s} &\Rightarrow& \I32X4.\VGT\K{\_s}\\ &&|& - \text{i32x4.gt\_u} &\Rightarrow& \I32X4.\VGT\K{\_u}\\ &&|& - \text{i32x4.le\_s} &\Rightarrow& \I32X4.\VLE\K{\_s}\\ &&|& - \text{i32x4.le\_u} &\Rightarrow& \I32X4.\VLE\K{\_u}\\ &&|& - \text{i32x4.ge\_s} &\Rightarrow& \I32X4.\VGE\K{\_s}\\ &&|& - \text{i32x4.ge\_u} &\Rightarrow& \I32X4.\VGE\K{\_u}\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i64x2.eq} &\Rightarrow& \I64X2.\VEQ\\ &&|& - \text{i64x2.ne} &\Rightarrow& \I64X2.\VNE\\ &&|& - \text{i64x2.lt\_s} &\Rightarrow& \I64X2.\VLT\K{\_s}\\ &&|& - \text{i64x2.gt\_s} &\Rightarrow& \I64X2.\VGT\K{\_s}\\ &&|& - \text{i64x2.le\_s} &\Rightarrow& \I64X2.\VLE\K{\_s}\\ &&|& - \text{i64x2.ge\_s} &\Rightarrow& \I64X2.\VGE\K{\_s}\\ &&|& - \end{array} +$${grammar: { + Tplaininstr_/vec-shuffle + Tplaininstr_/vec-splat + Tplaininstr_/vec-lane +}} -.. _text-vfrelop: - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{f32x4.eq} &\Rightarrow& \F32X4.\VEQ\\ &&|& - \text{f32x4.ne} &\Rightarrow& \F32X4.\VNE\\ &&|& - \text{f32x4.lt} &\Rightarrow& \F32X4.\VLT\\ &&|& - \text{f32x4.gt} &\Rightarrow& \F32X4.\VGT\\ &&|& - \text{f32x4.le} &\Rightarrow& \F32X4.\VLE\\ &&|& - \text{f32x4.ge} &\Rightarrow& \F32X4.\VGE\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{f64x2.eq} &\Rightarrow& \F64X2.\VEQ\\ &&|& - \text{f64x2.ne} &\Rightarrow& \F64X2.\VNE\\ &&|& - \text{f64x2.lt} &\Rightarrow& \F64X2.\VLT\\ &&|& - \text{f64x2.gt} &\Rightarrow& \F64X2.\VGT\\ &&|& - \text{f64x2.le} &\Rightarrow& \F64X2.\VLE\\ &&|& - \text{f64x2.ge} &\Rightarrow& \F64X2.\VGE\\ - \end{array} .. _text-vvunop: .. _text-vvbinop: .. _text-vvternop: - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{v128.not} &\Rightarrow& \V128.\VNOT\\ &&|& - \text{v128.and} &\Rightarrow& \V128.\VAND\\ &&|& - \text{v128.andnot} &\Rightarrow& \V128.\VANDNOT\\ &&|& - \text{v128.or} &\Rightarrow& \V128.\VOR\\ &&|& - \text{v128.xor} &\Rightarrow& \V128.\VXOR\\ &&|& - \text{v128.bitselect} &\Rightarrow& \V128.\VBITSELECT\\ &&|& - \text{v128.any\_true} &\Rightarrow& \V128.\VANYTRUE - \end{array} - .. _text-vitestop: -.. _text-vishiftop: +.. _text-virelop: +.. _text-vfrelop: .. _text-viunop: -.. _text-vibinop: -.. _text-viminmaxop: -.. _text-visatbinop: - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i8x16.abs} &\Rightarrow& \I8X16.\VABS\\ &&|& - \text{i8x16.neg} &\Rightarrow& \I8X16.\VNEG\\ &&|& - \text{i8x16.all\_true} &\Rightarrow& \I8X16.\VALLTRUE\\ &&|& - \text{i8x16.bitmask} &\Rightarrow& \I8X16.\VBITMASK\\ &&|& - \text{i8x16.narrow\_i16x8\_s} &\Rightarrow& \I8X16.\VNARROW\K{\_i16x8\_s}\\ &&|& - \text{i8x16.narrow\_i16x8\_u} &\Rightarrow& \I8X16.\VNARROW\K{\_i16x8\_u}\\ &&|& - \text{i8x16.shl} &\Rightarrow& \I8X16.\VSHL\\ &&|& - \text{i8x16.shr\_s} &\Rightarrow& \I8X16.\VSHR\K{\_s}\\ &&|& - \text{i8x16.shr\_u} &\Rightarrow& \I8X16.\VSHR\K{\_u}\\ &&|& - \text{i8x16.add} &\Rightarrow& \I8X16.\VADD\\ &&|& - \text{i8x16.add\_sat\_s} &\Rightarrow& \I8X16.\VADDSAT\K{\_s}\\ &&|& - \text{i8x16.add\_sat\_u} &\Rightarrow& \I8X16.\VADDSAT\K{\_u}\\ &&|& - \text{i8x16.sub} &\Rightarrow& \I8X16.\VSUB\\ &&|& - \text{i8x16.sub\_sat\_s} &\Rightarrow& \I8X16.\VSUBSAT\K{\_s}\\ &&|& - \text{i8x16.sub\_sat\_u} &\Rightarrow& \I8X16.\VSUBSAT\K{\_u}\\ &&|& - \text{i8x16.min\_s} &\Rightarrow& \I8X16.\VMIN\K{\_s}\\ &&|& - \text{i8x16.min\_u} &\Rightarrow& \I8X16.\VMIN\K{\_u}\\ &&|& - \text{i8x16.max\_s} &\Rightarrow& \I8X16.\VMAX\K{\_s}\\ &&|& - \text{i8x16.max\_u} &\Rightarrow& \I8X16.\VMAX\K{\_u}\\ &&|& - \text{i8x16.avgr\_u} &\Rightarrow& \I8X16.\VAVGR\K{\_u}\\ &&|& - \text{i8x16.popcnt} &\Rightarrow& \I8X16.\VPOPCNT\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i16x8.abs} &\Rightarrow& \I16X8.\VABS\\ &&|& - \text{i16x8.neg} &\Rightarrow& \I16X8.\VNEG\\ &&|& - \text{i16x8.all\_true} &\Rightarrow& \I16X8.\VALLTRUE\\ &&|& - \text{i16x8.bitmask} &\Rightarrow& \I16X8.\VBITMASK\\ &&|& - \text{i16x8.narrow\_i32x4\_s} &\Rightarrow& \I16X8.\VNARROW\K{\_i32x4\_s}\\ &&|& - \text{i16x8.narrow\_i32x4\_u} &\Rightarrow& \I16X8.\VNARROW\K{\_i32x4\_u}\\ &&|& - \text{i16x8.extend\_low\_i8x16\_s} &\Rightarrow& \I16X8.\VEXTEND\K{\_low\_i8x16\_s}\\ &&|& - \text{i16x8.extend\_high\_i8x16\_s} &\Rightarrow& \I16X8.\VEXTEND\K{\_high\_i8x16\_s}\\ &&|& - \text{i16x8.extend\_low\_i8x16\_u} &\Rightarrow& \I16X8.\VEXTEND\K{\_low\_i8x16\_u}\\ &&|& - \text{i16x8.extend\_high\_i8x16\_u} &\Rightarrow& \I16X8.\VEXTEND\K{\_high\_i8x16\_u}\\ &&|& - \text{i16x8.shl} &\Rightarrow& \I16X8.\VSHL\\ &&|& - \text{i16x8.shr\_s} &\Rightarrow& \I16X8.\VSHR\K{\_s}\\ &&|& - \text{i16x8.shr\_u} &\Rightarrow& \I16X8.\VSHR\K{\_u}\\ &&|& - \text{i16x8.add} &\Rightarrow& \I16X8.\VADD\\ &&|& - \text{i16x8.add\_sat\_s} &\Rightarrow& \I16X8.\VADDSAT\K{\_s}\\ &&|& - \text{i16x8.add\_sat\_u} &\Rightarrow& \I16X8.\VADDSAT\K{\_u}\\ &&|& - \text{i16x8.sub} &\Rightarrow& \I16X8.\VSUB\\ &&|& - \text{i16x8.sub\_sat\_s} &\Rightarrow& \I16X8.\VSUBSAT\K{\_s}\\ &&|& - \text{i16x8.sub\_sat\_u} &\Rightarrow& \I16X8.\VSUBSAT\K{\_u}\\ &&|& - \text{i16x8.mul} &\Rightarrow& \I16X8.\VMUL\\ &&|& - \text{i16x8.min\_s} &\Rightarrow& \I16X8.\VMIN\K{\_s}\\ &&|& - \text{i16x8.min\_u} &\Rightarrow& \I16X8.\VMIN\K{\_u}\\ &&|& - \text{i16x8.max\_s} &\Rightarrow& \I16X8.\VMAX\K{\_s}\\ &&|& - \text{i16x8.max\_u} &\Rightarrow& \I16X8.\VMAX\K{\_u}\\ &&|& - \text{i16x8.avgr\_u} &\Rightarrow& \I16X8.\VAVGR\K{\_u}\\ &&|& - \text{i16x8.q15mulr\_sat\_s} &\Rightarrow& \I16X8.\VQ15MULRSAT\K{\_s}\\ &&|& - \text{i16x8.extmul\_low\_i8x16\_s} &\Rightarrow& \I16X8.\VEXTMUL\K{\_low\_i8x16\_s}\\ &&|& - \text{i16x8.extmul\_high\_i8x16\_s} &\Rightarrow& \I16X8.\VEXTMUL\K{\_high\_i8x16\_s}\\ &&|& - \text{i16x8.extmul\_low\_i8x16\_u} &\Rightarrow& \I16X8.\VEXTMUL\K{\_low\_i8x16\_u}\\ &&|& - \text{i16x8.extmul\_high\_i8x16\_u} &\Rightarrow& \I16X8.\VEXTMUL\K{\_high\_i8x16\_u}\\ &&|& - \text{i16x8.extadd\_pairwise\_i8x16\_s} &\Rightarrow& \I16X8.\VEXTADDPAIRWISE\K{\_i8x16\_s}\\ &&|& - \text{i16x8.extadd\_pairwise\_i8x16\_u} &\Rightarrow& \I16X8.\VEXTADDPAIRWISE\K{\_i8x16\_u}\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i32x4.abs} &\Rightarrow& \I32X4.\VABS\\ &&|& - \text{i32x4.neg} &\Rightarrow& \I32X4.\VNEG\\ &&|& - \text{i32x4.all\_true} &\Rightarrow& \I32X4.\VALLTRUE\\ &&|& - \text{i32x4.bitmask} &\Rightarrow& \I32X4.\VBITMASK\\ &&|& - \text{i32x4.extadd\_pairwise\_i16x8\_s} &\Rightarrow& \I32X4.\VEXTADDPAIRWISE\K{\_i16x8\_s}\\ &&|& - \text{i32x4.extadd\_pairwise\_i16x8\_u} &\Rightarrow& \I32X4.\VEXTADDPAIRWISE\K{\_i16x8\_u}\\ &&|& - \text{i32x4.extend\_low\_i16x8\_s} &\Rightarrow& \I32X4.\VEXTEND\K{\_low\_i16x8\_s}\\ &&|& - \text{i32x4.extend\_high\_i16x8\_s} &\Rightarrow& \I32X4.\VEXTEND\K{\_high\_i16x8\_s}\\ &&|& - \text{i32x4.extend\_low\_i16x8\_u} &\Rightarrow& \I32X4.\VEXTEND\K{\_low\_i16x8\_u}\\ &&|& - \text{i32x4.extend\_high\_i16x8\_u} &\Rightarrow& \I32X4.\VEXTEND\K{\_high\_i16x8\_u}\\ &&|& - \text{i32x4.shl} &\Rightarrow& \I32X4.\VSHL\\ &&|& - \text{i32x4.shr\_s} &\Rightarrow& \I32X4.\VSHR\K{\_s}\\ &&|& - \text{i32x4.shr\_u} &\Rightarrow& \I32X4.\VSHR\K{\_u}\\ &&|& - \text{i32x4.add} &\Rightarrow& \I32X4.\VADD\\ &&|& - \text{i32x4.sub} &\Rightarrow& \I32X4.\VSUB\\ &&|& - \text{i32x4.mul} &\Rightarrow& \I32X4.\VMUL\\ &&|& - \text{i32x4.min\_s} &\Rightarrow& \I32X4.\VMIN\K{\_s}\\ &&|& - \text{i32x4.min\_u} &\Rightarrow& \I32X4.\VMIN\K{\_u}\\ &&|& - \text{i32x4.max\_s} &\Rightarrow& \I32X4.\VMAX\K{\_s}\\ &&|& - \text{i32x4.max\_u} &\Rightarrow& \I32X4.\VMAX\K{\_u}\\ &&|& - \text{i32x4.dot\_i16x8\_s} &\Rightarrow& \I32X4.\VDOT\K{\_i16x8\_s}\\ &&|& - \text{i32x4.extmul\_low\_i16x8\_s} &\Rightarrow& \I32X4.\VEXTMUL\K{\_low\_i16x8\_s}\\ &&|& - \text{i32x4.extmul\_high\_i16x8\_s} &\Rightarrow& \I32X4.\VEXTMUL\K{\_high\_i16x8\_s}\\ &&|& - \text{i32x4.extmul\_low\_i16x8\_u} &\Rightarrow& \I32X4.\VEXTMUL\K{\_low\_i16x8\_u}\\ &&|& - \text{i32x4.extmul\_high\_i16x8\_u} &\Rightarrow& \I32X4.\VEXTMUL\K{\_high\_i16x8\_u}\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i64x2.abs} &\Rightarrow& \I64X2.\VABS\\ &&|& - \text{i64x2.neg} &\Rightarrow& \I64X2.\VNEG\\ &&|& - \text{i64x2.all\_true} &\Rightarrow& \I64X2.\VALLTRUE\\ &&|& - \text{i64x2.bitmask} &\Rightarrow& \I64X2.\VBITMASK\\ &&|& - \text{i64x2.extend\_low\_i32x4\_s} &\Rightarrow& \I64X2.\VEXTEND\K{\_low\_i32x4\_s} \\ &&|& - \text{i64x2.extend\_high\_i32x4\_s} &\Rightarrow& \I64X2.\VEXTEND\K{\_high\_i32x4\_s} \\ &&|& - \text{i64x2.extend\_low\_i32x4\_u} &\Rightarrow& \I64X2.\VEXTEND\K{\_low\_i32x4\_u} \\ &&|& - \text{i64x2.extend\_high\_i32x4\_u} &\Rightarrow& \I64X2.\VEXTEND\K{\_high\_i32x4\_u} \\ &&|& - \text{i64x2.shl} &\Rightarrow& \I64X2.\VSHL\\ &&|& - \text{i64x2.shr\_s} &\Rightarrow& \I64X2.\VSHR\K{\_s}\\ &&|& - \text{i64x2.shr\_u} &\Rightarrow& \I64X2.\VSHR\K{\_u}\\ &&|& - \text{i64x2.add} &\Rightarrow& \I64X2.\VADD\\ &&|& - \text{i64x2.sub} &\Rightarrow& \I64X2.\VSUB\\ &&|& - \text{i64x2.mul} &\Rightarrow& \I64X2.\VMUL\\ &&|& - \text{i64x2.extmul\_low\_i32x4\_s} &\Rightarrow& \I64X2.\VEXTMUL\K{\_low\_i32x4\_s}\\ &&|& - \text{i64x2.extmul\_high\_i32x4\_s} &\Rightarrow& \I64X2.\VEXTMUL\K{\_high\_i32x4\_s}\\ &&|& - \text{i64x2.extmul\_low\_i32x4\_u} &\Rightarrow& \I64X2.\VEXTMUL\K{\_low\_i32x4\_u}\\ &&|& - \text{i64x2.extmul\_high\_i32x4\_u} &\Rightarrow& \I64X2.\VEXTMUL\K{\_high\_i32x4\_u}\\ - \end{array} - .. _text-vfunop: +.. _text-vibinop: .. _text-vfbinop: +.. _text-vishiftop: -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{f32x4.abs} &\Rightarrow& \F32X4.\VABS\\ &&|& - \text{f32x4.neg} &\Rightarrow& \F32X4.\VNEG\\ &&|& - \text{f32x4.sqrt} &\Rightarrow& \F32X4.\VSQRT\\ &&|& - \text{f32x4.ceil} &\Rightarrow& \F32X4.\VCEIL\\ &&|& - \text{f32x4.floor} &\Rightarrow& \F32X4.\VFLOOR\\ &&|& - \text{f32x4.trunc} &\Rightarrow& \F32X4.\VTRUNC\\ &&|& - \text{f32x4.nearest} &\Rightarrow& \F32X4.\VNEAREST\\ &&|& - \text{f32x4.add} &\Rightarrow& \F32X4.\VADD\\ &&|& - \text{f32x4.sub} &\Rightarrow& \F32X4.\VSUB\\ &&|& - \text{f32x4.mul} &\Rightarrow& \F32X4.\VMUL\\ &&|& - \text{f32x4.div} &\Rightarrow& \F32X4.\VDIV\\ &&|& - \text{f32x4.min} &\Rightarrow& \F32X4.\VMIN\\ &&|& - \text{f32x4.max} &\Rightarrow& \F32X4.\VMAX\\ &&|& - \text{f32x4.pmin} &\Rightarrow& \F32X4.\VPMIN\\ &&|& - \text{f32x4.pmax} &\Rightarrow& \F32X4.\VPMAX\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{f64x2.abs} &\Rightarrow& \F64X2.\VABS\\ &&|& - \text{f64x2.neg} &\Rightarrow& \F64X2.\VNEG\\ &&|& - \text{f64x2.sqrt} &\Rightarrow& \F64X2.\VSQRT\\ &&|& - \text{f64x2.ceil} &\Rightarrow& \F64X2.\VCEIL\\ &&|& - \text{f64x2.floor} &\Rightarrow& \F64X2.\VFLOOR\\ &&|& - \text{f64x2.trunc} &\Rightarrow& \F64X2.\VTRUNC\\ &&|& - \text{f64x2.nearest} &\Rightarrow& \F64X2.\VNEAREST\\ &&|& - \text{f64x2.add} &\Rightarrow& \F64X2.\VADD\\ &&|& - \text{f64x2.sub} &\Rightarrow& \F64X2.\VSUB\\ &&|& - \text{f64x2.mul} &\Rightarrow& \F64X2.\VMUL\\ &&|& - \text{f64x2.div} &\Rightarrow& \F64X2.\VDIV\\ &&|& - \text{f64x2.min} &\Rightarrow& \F64X2.\VMIN\\ &&|& - \text{f64x2.max} &\Rightarrow& \F64X2.\VMAX\\ &&|& - \text{f64x2.pmin} &\Rightarrow& \F64X2.\VPMIN\\ &&|& - \text{f64x2.pmax} &\Rightarrow& \F64X2.\VPMAX\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallylonginstructionnames} \\[-2ex] &&|& - \text{i32x4.trunc\_sat\_f32x4\_s} &\Rightarrow& \I32X4.\VTRUNCSAT\K{\_f32x4\_s}\\ &&|& - \text{i32x4.trunc\_sat\_f32x4\_u} &\Rightarrow& \I32X4.\VTRUNCSAT\K{\_f32x4\_u}\\ &&|& - \text{i32x4.trunc\_sat\_f64x2\_s\_zero} &\Rightarrow& \I32X4.\VTRUNCSAT\K{\_f64x2\_s\_zero}\\ &&|& - \text{i32x4.trunc\_sat\_f64x2\_u\_zero} &\Rightarrow& \I32X4.\VTRUNCSAT\K{\_f64x2\_u\_zero}\\ &&|& - \text{f32x4.convert\_i32x4\_s} &\Rightarrow& \F32X4.\VCONVERT\K{\_i32x4\_s}\\ &&|& - \text{f32x4.convert\_i32x4\_u} &\Rightarrow& \F32X4.\VCONVERT\K{\_i32x4\_u}\\ &&|& - \text{f64x2.convert\_low\_i32x4\_s} &\Rightarrow& \F64X2.\VCONVERT\K{\_low\_i32x4\_s}\\ &&|& - \text{f64x2.convert\_low\_i32x4\_u} &\Rightarrow& \F64X2.\VCONVERT\K{\_low\_i32x4\_u}\\ &&|& - \text{f32x4.demote\_f64x2\_zero} &\Rightarrow& \F32X4.\VDEMOTE\K{\_f64x2\_zero}\\ &&|& - \text{f64x2.promote\_low\_f32x4} &\Rightarrow& \F64X2.\VPROMOTE\K{\_low\_f32x4}\\ - \end{array} - -.. math:: - \begin{array}{llclll} - \phantom{\production{instruction}} & \phantom{\Tplaininstr_I} &\phantom{::=}& \phantom{averylonginstructionnameforvectext} && \phantom{vechasreallyreallyreallylonginstructionnames} \\[-2ex] &&|& - \text{i8x16.relaxed\_swizzle} &\Rightarrow& \I8X16.\VRELAXEDSWIZZLE \\ &&|& - \text{i32x4.relaxed\_trunc\_f32x4\_s} &\Rightarrow& \I32X4.\VRELAXEDTRUNC\K{\_f32x4\_s} \\ &&|& - \text{i32x4.relaxed\_trunc\_f32x4\_u} &\Rightarrow& \I32X4.\VRELAXEDTRUNC\K{\_f32x4\_u} \\ &&|& - \text{i32x4.relaxed\_trunc\_f32x4\_s\_zero} &\Rightarrow& \I32X4.\VRELAXEDTRUNC\K{\_f32x4\_s\_zero} \\ &&|& - \text{i32x4.relaxed\_trunc\_f32x4\_u\_zero} &\Rightarrow& \I32X4.\VRELAXEDTRUNC\K{\_f32x4\_u\_zero} \\ &&|& - \text{f32x4.relaxed\_madd} &\Rightarrow& \F32X4.\VRELAXEDMADD \\ &&|& - \text{f32x4.relaxed\_nmadd} &\Rightarrow& \F32X4.\VRELAXEDNMADD \\ &&|& - \text{f64x2.relaxed\_madd} &\Rightarrow& \F64X2.\VRELAXEDMADD \\ &&|& - \text{f64x2.relaxed\_nmadd} &\Rightarrow& \F64X2.\VRELAXEDNMADD \\ &&|& - \text{i8x16.relaxed\_laneselect} &\Rightarrow& \I8X16.\VRELAXEDLANESELECT \\ &&|& - \text{i16x8.relaxed\_laneselect} &\Rightarrow& \I16X8.\VRELAXEDLANESELECT \\ &&|& - \text{i32x4.relaxed\_laneselect} &\Rightarrow& \I32X4.\VRELAXEDLANESELECT \\ &&|& - \text{i64x2.relaxed\_laneselect} &\Rightarrow& \I64X2.\VRELAXEDLANESELECT \\ &&|& - \text{f32x4.relaxed\_min} &\Rightarrow& \F32X4.\VRELAXEDMIN \\ &&|& - \text{f32x4.relaxed\_max} &\Rightarrow& \F32X4.\VRELAXEDMAX \\ &&|& - \text{f64x2.relaxed\_min} &\Rightarrow& \F64X2.\VRELAXEDMIN \\ &&|& - \text{f64x2.relaxed\_max} &\Rightarrow& \F64X2.\VRELAXEDMAX \\ &&|& - \text{i16x8.relaxed\_q15mulr\_s} &\Rightarrow& \I16X8.\VRELAXEDQ15MULR\K{\_s} \\ &&|& - \text{i16x8.relaxed\_dot\_i8x16\_i7x16\_s} &\Rightarrow& \I16X8.\VRELAXEDDOT\K{\_i8x16\_i7x16\_s} \\ &&|& - \text{i16x8.relaxed\_dot\_i8x16\_i7x16\_add\_s} &\Rightarrow& \I16X8.\VRELAXEDDOT\K{\_i8x16\_i7x16\_add\_s} - \end{array} +$${grammar: { + Tplaininstr_/vec-test-v128 + Tplaininstr_/vec-un-v128 + Tplaininstr_/vec-bin-v128 + Tplaininstr_/vec-tern-v128 +}} + +$${grammar: { + Tplaininstr_/vec-test-i8x16 + Tplaininstr_/vec-rel-i8x16 + Tplaininstr_/vec-un-i8x16 + Tplaininstr_/vec-bin-i8x16 + Tplaininstr_/vec-tern-i8x16 + Tplaininstr_/vec-shift-i8x16 + Tplaininstr_/vec-bitmask-i8x16 + Tplaininstr_/vec-narrow-i8x16 +}} + +$${grammar: { + Tplaininstr_/vec-test-i16x8 + Tplaininstr_/vec-rel-i16x8 + Tplaininstr_/vec-un-i16x8 + Tplaininstr_/vec-bin-i16x8 + Tplaininstr_/vec-tern-i16x8 + Tplaininstr_/vec-shift-i16x8 + Tplaininstr_/vec-bitmask-i16x8 + Tplaininstr_/vec-narrow-i16x8 +}} + +$${grammar: { + Tplaininstr_/vec-test-i32x4 + Tplaininstr_/vec-rel-i32x4 + Tplaininstr_/vec-un-i32x4 + Tplaininstr_/vec-bin-i32x4 + Tplaininstr_/vec-tern-i32x4 + Tplaininstr_/vec-shift-i32x4 + Tplaininstr_/vec-bitmask-i32x4 + Tplaininstr_/vec-narrow-i32x4 +}} + +$${grammar: { + Tplaininstr_/vec-test-i64x2 + Tplaininstr_/vec-rel-i64x2 + Tplaininstr_/vec-un-i64x2 + Tplaininstr_/vec-bin-i64x2 + Tplaininstr_/vec-tern-i64x2 + Tplaininstr_/vec-shift-i64x2 + Tplaininstr_/vec-bitmask-i64x2 +}} + +$${grammar: { + Tplaininstr_/vec-rel-f32x4 + Tplaininstr_/vec-un-f32x4 + Tplaininstr_/vec-bin-f32x4 + Tplaininstr_/vec-tern-f32x4 +}} + +$${grammar: { + Tplaininstr_/vec-rel-f64x2 + Tplaininstr_/vec-un-f64x2 + Tplaininstr_/vec-bin-f64x2 + Tplaininstr_/vec-tern-f64x2 +}} + +$${grammar: { + Tplaininstr_/vec-cvt-i16x8 + Tplaininstr_/vec-cvt-i32x4 + Tplaininstr_/vec-cvt-i64x2 + Tplaininstr_/vec-cvt-f32x4 + Tplaininstr_/vec-cvt-f64x2 +}} + +$${grammar: { + Tplaininstr_/vec-extun-i16x8 + Tplaininstr_/vec-extbin-i16x8 + Tplaininstr_/vec-extun-i32x4 + Tplaininstr_/vec-extbin-i32x4 + Tplaininstr_/vec-extbin-i64x2 +}} .. index:: ! folded instruction, S-expression @@ -1088,34 +404,15 @@ Folded Instructions Instructions can be written as S-expressions by grouping them into *folded* form. In that notation, an instruction is wrapped in parentheses and optionally includes nested folded instructions to indicate its operands. -In the case of :ref:`block instructions `, the folded form omits the :math:`\text{end}` delimiter. -For |IF| instructions, both branches have to be wrapped into nested S-expressions, headed by the keywords :math:`\text{then}` and :math:`\text{else}`. +In the case of :ref:`block instructions `, the folded form omits the ${grammar-case: "end"} delimiter. +For ${:IF} instructions, both branches have to be wrapped into nested S-expressions, headed by the keywords ${grammar-case: "then"} and ${grammar-case: "else"}. -The set of all phrases defined by the following abbreviations recursively forms the auxiliary syntactic class |Tfoldedinstr|. +The set of all phrases defined by the following abbreviations recursively forms the auxiliary syntactic class ${grammar-case: Tfoldedinstr}. Such a folded instruction can appear anywhere a regular instruction can. .. MathJax doesn't handle LaTex multicolumns, thus the spacing hack in the following formula. -.. math:: - \begin{array}{lllll} - \production{instruction} & - \text{(}~\Tplaininstr~~\Tfoldedinstr^\ast~\text{)} - &\equiv\quad \Tfoldedinstr^\ast~~\Tplaininstr \\ & - \text{(}~\text{block}~~\Tlabel~~\Tblocktype~~\Tinstr^\ast~\text{)} - &\equiv\quad \text{block}~~\Tlabel~~\Tblocktype~~\Tinstr^\ast~~\text{end} \\ & - \text{(}~\text{loop}~~\Tlabel~~\Tblocktype~~\Tinstr^\ast~\text{)} - &\equiv\quad \text{loop}~~\Tlabel~~\Tblocktype~~\Tinstr^\ast~~\text{end} \\ & - \text{(}~\text{if}~~\Tlabel~~\Tblocktype~~\Tfoldedinstr^\ast \\ & - \qquad \text{(}~\text{then}~~\Tinstr_1^\ast~\text{)}~~(\text{(}~\text{else}~~\Tinstr_2^\ast~\text{)})^?~~\text{)} - &\equiv\quad - \Tfoldedinstr^\ast~~\text{if}~~\Tlabel~~\Tblocktype~~\Tinstr_1^\ast~~\\ & - &\qquad\qquad \text{else}~~(\Tinstr_2^\ast)^?~\text{end} \\ & - \text{(}~\text{try\_table}~~\Tlabel~~\Tblocktype~~\Tcatch^\ast~~\Tinstr^\ast~\text{)} - &\equiv\quad - \text{try\_table}~~\Tlabel~~\Tblocktype~~\\ & - &\qquad\qquad \Tcatch^\ast~~\Tinstr^\ast~~\text{end} \\ - \end{array} - +$${grammar: Tfoldedinstr_} .. note:: For example, the instruction sequence @@ -1141,10 +438,5 @@ Expressions ~~~~~~~~~~~ Expressions are written as instruction sequences. -No explicit :math:`\text{end}` keyword is included, since they only occur in bracketed positions. -.. math:: - \begin{array}{llclll} - \production{expression} & \Texpr_I &::=& - (\X{in}{:}\Tinstr_I)^\ast &\Rightarrow& \X{in}^\ast \\ - \end{array} +$${grammar: Texpr_} diff --git a/document/core/text/modules.rst b/document/core/text/modules.rst index e3f222dd5..167b4f451 100644 --- a/document/core/text/modules.rst +++ b/document/core/text/modules.rst @@ -1,6 +1,12 @@ Modules ------- +Modules consist of a sequence of :ref:`declarations `. +The grammar rules for each declaration construct produce a pair, +consisting of not just the abstract syntax representing the respective declaration, +but also an :ref:`identifier context ` recording the new symbolic :ref:`identifiers ` bound by the construct, +for use in the remainder of the module. + .. index:: index, type index, tag index, global index, memory index, table index, function index, data index, element index, local index, label index pair: text format; type index @@ -13,6 +19,7 @@ Modules pair: text format; element index pair: text format; local index pair: text format; label index +.. _text-idx: .. _text-typeidx: .. _text-tagidx: .. _text-globalidx: @@ -30,44 +37,34 @@ Indices ~~~~~~~ :ref:`Indices ` can be given either in raw numeric form or as symbolic :ref:`identifiers ` when bound by a respective construct. -Such identifiers are looked up in the suitable space of the :ref:`identifier context ` :math:`I`. - -.. math:: - \begin{array}{llcllllllll} - \production{type index} & \Ttypeidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\ITYPES[x] = v) \\ - \production{global index} & \Tglobalidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\IGLOBALS[x] = v) \\ - \production{tag index} & \Ttagidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\ITAGS[x] = v) \\ - \production{memory index} & \Tmemidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\IMEMS[x] = v) \\ - \production{table index} & \Ttableidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\ITABLES[x] = v) \\ - \production{function index} & \Tfuncidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\IFUNCS[x] = v) \\ - \production{data index} & \Tdataidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\IDATAS[x] = v) \\ - \production{element index} & \Telemidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\IELEMS[x] = v) \\ - \production{local index} & \Tlocalidx_I &::=& - x{:}\Tu32 &\Rightarrow& x \\&&|& - v{:}\Tid &\Rightarrow& x & (\iff I.\ILOCALS[x] = v) \\ - \production{label index} & \Tlabelidx_I &::=& - l{:}\Tu32 &\Rightarrow& l \\&&|& - v{:}\Tid &\Rightarrow& l & (\iff I.\ILABELS[l] = v) \\ - \production{field index} & \Tfieldidx_{I,x} &::=& - i{:}\Tu32 &\Rightarrow& i \\&&|& - v{:}\Tid &\Rightarrow& i & (\iff I.\IFIELDS[x][i] = v) \\ - \end{array} +Such identifiers are looked up in the suitable space of the :ref:`identifier context ` ${idctxt: I}. + +$${grammar: Tidx_ { + Ttypeidx_ + Ttagidx_ + Tglobalidx_ + Tmemidx_ + Ttableidx_ + Tfuncidx_ + Tdataidx_ + Telemidx_ + Tlocalidx_ + Tlabelidx_ + Tfieldidx__ +}} + + +.. index:: type, recursive type, identifier + pair: text format; type +.. _text-types: + +Types +~~~~~ + +A type definition consists of a :ref:`recursive type `. +The :ref:`identifier context ` produced for the local bindings is further extended with the respective sequence of :ref:`defined types ` that the recursive type generates. + +$${grammar: Ttype_} .. index:: tag, tag type, identifier, function type, exception tag @@ -77,14 +74,10 @@ Such identifiers are looked up in the suitable space of the :ref:`identifier con Tags ~~~~ -An tag definition can bind a symbolic :ref:`tag identifier `. +A tag definition can bind a symbolic :ref:`tag identifier `. + +$${grammar: Ttag_} -.. math:: - \begin{array}{llcl} - \production{tag} & \Ttag_I &::=& - \text{(}~\text{tag}~~\Tid^?~~\X{tt}{:}\Ttagtype_I~\text{)} \\ &&& \qquad - \Rightarrow\quad \TAG~\X{tt} \\ - \end{array} .. index:: import, name pair: text format; import @@ -98,21 +91,10 @@ Abbreviations Tags can be defined as :ref:`imports ` or :ref:`exports ` inline: -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{tag}~~\Tid^?~~\text{(}~\text{import}~~\Tname_1~~\Tname_2~\text{)}~~\Ttagtype~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{import}~~\Tname_1~~\Tname_2~~\text{(}~\text{tag}~~\Tid^?~~\Ttagtype~\text{)}~\text{)} - \\[1ex] & - \text{(}~\text{tag}~~\Tid^?~~\text{(}~\text{export}~~\Tname~\text{)}~~\dots~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{export}~~\Tname~~\text{(}~\text{tag}~~\Tid'~\text{)}~\text{)}~~ - \text{(}~\text{tag}~~\Tid'~~\dots~\text{)} - \\ & \qquad\qquad - (\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh) \\ - \end{array} +$${grammar: Timport_/abbrev-tag Texporttag_} .. note:: - The latter abbreviation can be applied repeatedly, if ":math:`\dots`" contains additional export clauses. + The latter abbreviation can be applied repeatedly, if "${grammar-case: Texporttagdots_(I)}" contains additional export clauses. Consequently, a memory declaration can contain any number of exports, possibly followed by an import. @@ -125,12 +107,7 @@ Globals Global definitions can bind a symbolic :ref:`global identifier `. -.. math:: - \begin{array}{llclll} - \production{global} & \Tglobal_I &::=& - \text{(}~\text{global}~~\Tid^?~~\X{gt}{:}\Tglobaltype_I~~e{:}\Texpr_I~\text{)} - &\Rightarrow& \GLOBAL~\X{gt}~e \\ - \end{array} +$${grammar: Tglobal_} .. index:: import, name @@ -144,21 +121,10 @@ Abbreviations Globals can be defined as :ref:`imports ` or :ref:`exports ` inline: -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{global}~~\Tid^?~~\text{(}~\text{import}~~\Tname_1~~\Tname_2~\text{)}~~\Tglobaltype~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{import}~~\Tname_1~~\Tname_2~~\text{(}~\text{global}~~\Tid^?~~\Tglobaltype~\text{)}~\text{)} - \\[1ex] & - \text{(}~\text{global}~~\Tid^?~~\text{(}~\text{export}~~\Tname~\text{)}~~\dots~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{export}~~\Tname~~\text{(}~\text{global}~~\Tid'~\text{)}~\text{)}~~ - \text{(}~\text{global}~~\Tid'~~\dots~\text{)} - \\ & \qquad\qquad - (\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh) \\ - \end{array} +$${grammar: Timport_/abbrev-global Texportglobal_} .. note:: - The latter abbreviation can be applied repeatedly, if ":math:`\dots`" contains additional export clauses. + The latter abbreviation can be applied repeatedly, if "${grammar-case: Texportglobaldots_(I)}" contains additional export clauses. Consequently, a global declaration can contain any number of exports, possibly followed by an import. @@ -171,12 +137,7 @@ Memories Memory definitions can bind a symbolic :ref:`memory identifier `. -.. math:: - \begin{array}{llclll} - \production{memory} & \Tmem_I &::=& - \text{(}~\text{memory}~~\Tid^?~~\X{mt}{:}\Tmemtype_I~\text{)} - &\Rightarrow& \MEMORY~\X{mt} \\ - \end{array} +$${grammar: Tmem_} .. index:: import, name @@ -192,37 +153,16 @@ Memory definitions can bind a symbolic :ref:`memory identifier `. Abbreviations ............. -A :ref:`data segment ` can be given inline with a memory definition, in which case its offset is :math:`0` and the :ref:`limits ` of the :ref:`memory type ` are inferred from the length of the data, rounded up to :ref:`page size `: +A :ref:`data segment ` can be given inline with a memory definition, in which case its offset is ${:0} and the :ref:`limits ` of the :ref:`memory type ` are inferred from the length of the data, rounded up to :ref:`page size `: -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{memory}~~\Tid^?~~\Taddrtype^?~~\text{(}~\text{data}~~b^n{:}\Tdatastring~\text{)}~~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{memory}~~\Tid'~~\Taddrtype^?~~m~~m~\text{)} \\ & \qquad - \text{(}~\text{data}~~\text{(}~\text{memory}~~\Tid'~\text{)}~~\text{(}~\Taddrtype'\text{.const}~~\text{0}~\text{)}~~\Tdatastring~\text{)} - \\ & \qquad\qquad - (\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh, \\ & \qquad\qquad - \iff \Taddrtype? \neq \epsilon \wedge \Taddrtype' = \Taddrtype^? \vee \Taddrtype^? = \epsilon \wedge \Taddrtype' = \text{i32}, \\ & \qquad\qquad - m = \F{ceil}(n / 64\,\F{Ki})) \\ - \end{array} +$${grammar: Tdatamem_} Memories can be defined as :ref:`imports ` or :ref:`exports ` inline: -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{memory}~~\Tid^?~~\text{(}~\text{import}~~\Tname_1~~\Tname_2~\text{)}~~\Tmemtype~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{import}~~\Tname_1~~\Tname_2~~\text{(}~\text{memory}~~\Tid^?~~\Tmemtype~\text{)}~\text{)} - \\[1ex] & - \text{(}~\text{memory}~~\Tid^?~~\text{(}~\text{export}~~\Tname~\text{)}~~\dots~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{export}~~\Tname~~\text{(}~\text{memory}~~\Tid'~\text{)}~\text{)}~~ - \text{(}~\text{memory}~~\Tid'~~\dots~\text{)} - \\ & \qquad\qquad - (\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh) \\ - \end{array} +$${grammar: Timport_/abbrev-mem Texportmem_} .. note:: - The latter abbreviation can be applied repeatedly, if ":math:`\dots`" contains additional export clauses. + The latter abbreviation can be applied repeatedly, if "${grammar-case: Texportmemdots_(I)}" contains additional export clauses. Consequently, a memory declaration can contain any number of exports, possibly followed by an import. @@ -235,12 +175,7 @@ Tables Table definitions can bind a symbolic :ref:`table identifier `. -.. math:: - \begin{array}{llclll} - \production{table} & \Ttable_I &::=& - \text{(}~\text{table}~~\Tid^?~~\X{tt}{:}\Ttabletype_I~~e{:}\Texpr_I~\text{)} - &\Rightarrow& \TABLE~\X{tt}~e \\ - \end{array} +$${grammar: Ttable_/plain} .. index:: reference type, heap type @@ -257,58 +192,20 @@ Table definitions can bind a symbolic :ref:`table identifier `. Abbreviations ............. -A table's initialization :ref:`expression ` can be omitted, in which case it defaults to :math:`\REFNULL`: - -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{table}~~\Tid^?~~\Ttabletype~\text{)} - &\equiv& - \text{(}~\text{table}~~\Tid^?~~\Ttabletype~~\text{(}~\REFNULL~\X{ht}~\text{)}~\text{)} - \\ &&& \qquad\qquad - (\iff \Ttabletype = \Taddrtype^?~\Tlimits~\text{(}~\text{ref}~\text{null}^?~\X{ht}~\text{)}) \\ - \end{array} - -An :ref:`element segment ` can be given inline with a table definition, in which case its offset is :math:`0` and the :ref:`limits ` of the :ref:`table type ` are inferred from the length of the given segment: - -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{table}~~\Tid^?~~\Taddrtype^?~~\Treftype~~\text{(}~\text{elem}~~\expr^n{:}\Tlist(\Telemexpr)~\text{)}~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{table}~~\Tid'~~\Taddrtype^?~~n~~n~~\Treftype~\text{)} \\ & \qquad - \text{(}~\text{elem}~~\text{(}~\text{table}~~\Tid'~\text{)}~~\text{(}~\Taddrtype'\text{.const}~~\text{0}~\text{)}~~\Treftype~~\Tlist(\Telemexpr)~\text{)} - \\ & \qquad\qquad - (\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh, \\ & \qquad\qquad - \iff \Taddrtype? \neq \epsilon \wedge \Taddrtype' = \Taddrtype^? \vee \Taddrtype^? = \epsilon \wedge \Taddrtype' = \text{i32}) \\ - \end{array} - -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{table}~~\Tid^?~~\Taddrtype^?~~\Treftype~~\text{(}~\text{elem}~~x^n{:}\Tlist(\Tfuncidx)~\text{)}~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{table}~~\Tid'~~\Taddrtype^?~~n~~n~~\Treftype~\text{)} \\ & \qquad - \text{(}~\text{elem}~~\text{(}~\text{table}~~\Tid'~\text{)}~~\text{(}~\Taddrtype'\text{.const}~~\text{0}~\text{)}~~\Treftype~~\Tlist(\text{(}~\text{ref.func}~~\Tfuncidx~\text{)})~\text{)} - \\ & \qquad\qquad - (\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh, \\ & \qquad\qquad - \iff \Taddrtype? \neq \epsilon \wedge \Taddrtype' = \Taddrtype^? \vee \Taddrtype^? = \epsilon \wedge \Taddrtype' = \text{i32}) \\ - \end{array} +A table's initialization :ref:`expression ` can be omitted, in which case it defaults to ${:REF.NULL}: + +$${grammar: Ttable_/abbrev} + +An :ref:`element segment ` can be given inline with a table definition, in which case its offset is ${:0} and the :ref:`limits ` of the :ref:`table type ` are inferred from the length of the given segment: + +$${grammar: Telemtable_} Tables can be defined as :ref:`imports ` or :ref:`exports ` inline: -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{table}~~\Tid^?~~\text{(}~\text{import}~~\Tname_1~~\Tname_2~\text{)}~~\Ttabletype~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{import}~~\Tname_1~~\Tname_2~~\text{(}~\text{table}~~\Tid^?~~\Ttabletype~\text{)}~\text{)} \\[1ex] & - \text{(}~\text{table}~~\Tid^?~~\text{(}~\text{export}~~\Tname~\text{)}~~\dots~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{export}~~\Tname~~\text{(}~\text{table}~~\Tid'~\text{)}~\text{)}~~ - \text{(}~\text{table}~~\Tid'~~\dots~\text{)} - \\ & \qquad\qquad - (\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh) \\ - \end{array} +$${grammar: Timport_/abbrev-table Texporttable_} .. note:: - The latter abbreviation can be applied repeatedly, if ":math:`\dots`" contains additional export clauses. + The latter abbreviation can be applied repeatedly, if "${grammar-case: Texporttabledots_(I)}" contains additional export clauses. Consequently, a table declaration can contain any number of exports, possibly followed by an import. @@ -323,28 +220,12 @@ Functions Function definitions can bind a symbolic :ref:`function identifier `, and :ref:`local identifiers ` for its :ref:`parameters ` and locals. -.. math:: - \begin{array}{llclll} - \production{function} & \Tfunc_I &::=& - \text{(}~\text{func}~~\Tid^?~~x,I'{:}\Ttypeuse_I~~ - (\X{loc}{:}\Tlocal_I)^\ast~~(\X{in}{:}\Tinstr_{I''})^\ast~\text{)} \\ &&& \qquad - \Rightarrow\quad \FUNC~x~\X{loc}^\ast~\X{in}^\ast \\ &&& \qquad\qquad\qquad - (\iff I'' = I \compose I' \compose \{\ILOCALS~\F{id}(\Tlocal)^\ast\} \idcwellformed) \\[1ex] - \production{local} & \Tlocal_I &::=& - \text{(}~\text{local}~~\Tid^?~~t{:}\Tvaltype_I~\text{)} - \quad\Rightarrow\quad \LOCAL~t \\ - \end{array} - -The definition of the local :ref:`identifier context ` :math:`I''` uses the following auxiliary function to extract optional identifiers from locals: - -.. math:: - \begin{array}{lcl@{\qquad\qquad}l} - \F{id}(\text{(}~\text{local}~\Tid^?~\dots~\text{)}) &=& \Tid^? \\ - \end{array} +$${grammar: Tfunc_} +$${grammar: Tlocal_/plain} .. note:: - The :ref:`well-formedness ` condition on :math:`I''` ensures that parameters and locals do not contain duplicate identifiers. + The :ref:`well-formedness ` condition on ${idctxt: I'} ensures that parameters and locals do not contain duplicate identifiers. .. index:: import, name @@ -358,29 +239,14 @@ Abbreviations Multiple anonymous locals may be combined into a single declaration: -.. math:: - \begin{array}{llclll} - \production{local} & - \text{(}~~\text{local}~~\Tvaltype^\ast~~\text{)} &\equiv& - (\text{(}~~\text{local}~~\Tvaltype~~\text{)})^\ast \\ - \end{array} +$${grammar: Tlocal_/abbrev} Functions can be defined as :ref:`imports ` or :ref:`exports ` inline: -.. math:: - \begin{array}{llclll} - \production{module field} & - \text{(}~\text{func}~~\Tid^?~~\text{(}~\text{import}~~\Tname_1~~\Tname_2~\text{)}~~\Ttypeuse~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{import}~~\Tname_1~~\Tname_2~~\text{(}~\text{func}~~\Tid^?~~\Ttypeuse~\text{)}~\text{)} \\[1ex] & - \text{(}~\text{func}~~\Tid^?~~\text{(}~\text{export}~~\Tname~\text{)}~~\dots~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{export}~~\Tname~~\text{(}~\text{func}~~\Tid'~\text{)}~\text{)}~~ - \text{(}~\text{func}~~\Tid'~~\dots~\text{)} - \\ & \qquad\qquad - (\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh) \\ - \end{array} +$${grammar: Timport_/abbrev-func Texportfunc_} .. note:: - The latter abbreviation can be applied repeatedly, if ":math:`\dots`" contains additional export clauses. + The latter abbreviation can be applied repeatedly, if "${grammar-case: Texportfuncdots_(I)}" contains additional export clauses. Consequently, a function declaration can contain any number of exports, possibly followed by an import. @@ -398,19 +264,7 @@ Data Segments Data segments allow for an optional :ref:`memory index ` to identify the memory to initialize. The data is written as a :ref:`string `, which may be split up into a possibly empty sequence of individual string literals. -.. math:: - \begin{array}{llclll} - \production{data segment} & \Tdata_I &::=& - \text{(}~\text{data}~~\Tid^?~~b^\ast{:}\Tdatastring~\text{)} \\ &&& \qquad - \Rightarrow\quad \DATA~b^\ast~\DPASSIVE \\ &&|& - \text{(}~\text{data}~~\Tid^?~~x{:}\Tmemuse_I~~\text{(}~\text{offset}~~e{:}\Texpr_I~\text{)}~~b^\ast{:}\Tdatastring~\text{)} \\ &&& \qquad - \Rightarrow\quad \DATA~b^\ast~\DACTIVE~x~e \\ - \production{data string} & \Tdatastring &::=& - (b^\ast{:}\Tstring)^\ast \quad\Rightarrow\quad \concat((b^\ast)^\ast) \\ - \production{memory use} & \Tmemuse_I &::=& - \text{(}~\text{memory}~~x{:}\Tmemidx_I ~\text{)} - \quad\Rightarrow\quad x \\ - \end{array} +$${grammar: Tdata_ Tdatastring {Tmemuse_/plain Toffset_/plain}} .. note:: In the current version of WebAssembly, the only valid memory index is 0 @@ -420,22 +274,13 @@ The data is written as a :ref:`string `, which may be split up into Abbreviations ............. -As an abbreviation, a single :ref:`folded instruction ` may occur in place of the offset of an active data segment: +As an abbreviation, a single :ref:`folded instruction ` may occur in place of the offset of an active segment: -.. math:: - \begin{array}{llcll} - \production{data offset} & - \text{(}~\Tfoldedinstr~\text{)} &\equiv& - \text{(}~\text{offset}~~\Tinstr~\text{)} - \end{array} +$${grammar: Toffset_/abbrev} -Also, a memory use can be omitted, defaulting to :math:`\T{0}`. +Also, a memory use can be omitted, defaulting to ${:0}. -.. math:: - \begin{array}{llclll} - \production{memory use} & - \epsilon &\equiv& \text{(}~\text{memory}~~\text{0}~\text{)} \\ - \end{array} +$${grammar: Tmemuse_/abbrev} As another abbreviation, data segments may also be specified inline with :ref:`memory ` definitions; see the respective section. @@ -454,24 +299,7 @@ Element Segments Element segments allow for an optional :ref:`table index ` to identify the table to initialize. -.. math:: - \begin{array}{llclll} - \production{element segment} & \Telem_I &::=& - \text{(}~\text{elem}~~\Tid^?~~(et, e^\ast){:}\Telemlist_I~\text{)} \\ &&& \qquad - \Rightarrow\quad \ELEM~et~e^\ast~\EPASSIVE \\ &&|& - \text{(}~\text{elem}~~\Tid^?~~x{:}\Ttableuse_I~~\text{(}~\text{offset}~~e'{:}\Texpr_I~\text{)}~~(et, e^\ast){:}\Telemlist_I~\text{)} \\ &&& \qquad - \Rightarrow\quad \ELEM~et~e^\ast~\EACTIVE~~x~e' \\ &&& - \text{(}~\text{elem}~~\Tid^?~~\text{declare}~~(et, y^\ast){:}\Telemlist_I~\text{)} \\ &&& \qquad - \Rightarrow\quad \ELEM~et~e^\ast~\EDECLARE \\ - \production{element list} & \Telemlist_I &::=& - t{:}\Treftype_I~~e^\ast{:}\Tlist(\Telemexpr_I) \qquad\Rightarrow\quad ( t, ee^\ast ) \\ - \production{element expression} & \Telemexpr_I &::=& - \text{(}~\text{item}~~e{:}\Texpr_I~\text{)} - \quad\Rightarrow\quad e \\ - \production{table use} & \Ttableuse_I &::=& - \text{(}~\text{table}~~x{:}\Ttableidx_I ~\text{)} - \quad\Rightarrow\quad x \\ - \end{array} +$${grammar: Telem_/plain {Telemlist_/plain Telemexpr_/plain} Ttableuse_/plain} Abbreviations @@ -479,41 +307,21 @@ Abbreviations As an abbreviation, a single :ref:`folded instruction ` may occur in place of the offset of an active element segment or as an element expression: -.. math:: - \begin{array}{llcll} - \production{element offset} & - \text{(}~\Tfoldedinstr~\text{)} &\equiv& - \text{(}~\text{offset}~~\Tinstr~\text{)} \\ - \production{element item} & - \text{(}~\Tfoldedinstr~\text{)} &\equiv& - \text{(}~\text{item}~~\Tinstr~\text{)} \\ - \end{array} +$${grammar: Telemexpr_/abbrev} Also, the element list may be written as just a sequence of :ref:`function indices `: -.. math:: - \begin{array}{llcll} - \production{element list} & - \text{func}~~\Tlist(\Tfuncidx_I) &\equiv& - \text{(ref}~\text{func)}~~\Tlist(\text{(}~\text{ref.func}~~\Tfuncidx_I~\text{)}) - \end{array} +$${grammar: Telemlist_/abbrev} + +A table use can be omitted, defaulting to ${:0}. -A table use can be omitted, defaulting to :math:`\T{0}`. -Furthermore, for backwards compatibility with earlier versions of WebAssembly, if the table use is omitted, the :math:`\text{func}` keyword can be omitted as well. +$${grammar: Ttableuse_/abbrev} -.. math:: - \begin{array}{llclll} - \production{table use} & - \epsilon &\equiv& \text{(}~\text{table}~~\text{0}~\text{)} \\ - \production{element segment} & - \text{(}~\text{elem}~~\Tid^?~~\text{(}~\text{offset}~~\Texpr_I~\text{)}~~\\ & - \qquad \Tlist(\Tfuncidx_I)~\text{)} - &\equiv& - \text{(}~\text{elem}~~\Tid^?~~\text{(}~\text{table}~~\text{0}~\text{)}~~\text{(}~\text{offset}~~\Texpr_I~\text{)}~~\\ & - &&\qquad \text{func}~~\Tlist(\Tfuncidx_I)~\text{)} - \end{array} +Furthermore, for backwards compatibility with earlier versions of WebAssembly, if the table use is omitted, the ${grammar-case: "func"} keyword can be omitted as well. -As another abbreviation, element segments may also be specified inline with :ref:`table ` definitions; see the respective section. +$${grammar: Telem_/abbrev} + +As yet another abbreviation, element segments may also be specified inline with :ref:`table ` definitions; see the respective section. .. index:: start function, function index @@ -525,16 +333,11 @@ Start Function A :ref:`start function ` is defined in terms of its index. -.. math:: - \begin{array}{llclll} - \production{start function} & \Tstart_I &::=& - \text{(}~\text{start}~~x{:}\Tfuncidx_I~\text{)} - &\Rightarrow& \START~x \\ - \end{array} +$${grammar: Tstart_} .. note:: At most one start function may occur in a module, - which is ensured by a suitable side condition on the |Tmodule| grammar. + which is ensured by a suitable side condition on the ${grammar-case: Tmodule} grammar. @@ -547,12 +350,7 @@ Imports The :ref:`external type ` in imports can bind a symbolic tag, global, memory, or function :ref:`identifier `. -.. math:: - \begin{array}{llclll} - \production{import} & \Timport_I &::=& - \text{(}~\text{import}~~\X{nm}_1{:}\Tname~~\X{nm}_2{:}\Tname~~\X{xx}{:}\Texterntype_I~\text{)} \\ &&& \qquad - \Rightarrow\quad \IMPORT~\X{nm}_1~\X{nm}_2~\X{xx} \\[1ex] - \end{array} +$${grammar: Timport_/plain} Abbreviations @@ -567,7 +365,6 @@ As an abbreviation, imports may also be specified inline with definitions; see the respective sections. - .. index:: export, name, index, external index, tag index, global index, memory index, table index, function index pair: text format; export .. _text-externidx: @@ -578,23 +375,7 @@ Exports The syntax for exports mirrors their :ref:`abstract syntax ` directly. -.. math:: - \begin{array}{llclll} - \production{export} & \Texport_I &::=& - \text{(}~\text{export}~~\X{nm}{:}\Tname~~\X{xx}{:}\Texternidx_I~\text{)} - &\Rightarrow& \EXPORT~\X{nm}~\X{xx} \} \\ - \production{external index} & \Texternidx_I &::=& - \text{(}~\text{tag}~~x{:}\Ttagidx_I~\text{)} - &\Rightarrow& \XXTAG~x \\ &&|& - \text{(}~\text{global}~~x{:}\Tglobalidx_I~\text{)} - &\Rightarrow& \XXGLOBAL~x \\&&|& - \text{(}~\text{memory}~~x{:}\Tmemidx_I~\text{)} - &\Rightarrow& \XXMEM~x \\ &&|& - \text{(}~\text{table}~~x{:}\Ttableidx_I~\text{)} - &\Rightarrow& \XXTABLE~x \\ &&|& - \text{(}~\text{func}~~x{:}\Tfuncidx_I~\text{)} - &\Rightarrow& \XXFUNC~x \\ - \end{array} +$${grammar: Texport_ Texternidx_} Abbreviations @@ -609,123 +390,50 @@ As an abbreviation, exports may also be specified inline with definitions; see the respective sections. -.. index:: module, type definition, recursive type, tag, global, memory, table, function, data segment, element segment, start function, import, export, identifier context, identifier, name section +.. index:: module, type definition, recursive type, tag, global, memory, table, function, data segment, element segment, start function, import, export, identifier context, identifier, name section, ! declaration pair: text format; module single: section; name -.. _text-modulefield: +.. _syntax-decl: +.. _text-decl: .. _text-module: Modules ~~~~~~~ -A module consists of a sequence of fields that can occur in any order. -All definitions and their respective bound :ref:`identifiers ` scope over the entire module, including the text preceding them. +A module consists of a sequence of *declarations* that can occur in any order. + +$${syntax: decl} -A module may optionally bind an :ref:`identifier ` that names the module. +All declarations and their respective bound :ref:`identifiers ` scope over the entire module, including the text preceding them. +A module itself may optionally bind an :ref:`identifier ` that names the module. The name serves a documentary role only. .. note:: Tools may include the module name in the :ref:`name section ` of the :ref:`binary format `. -.. math:: - \begin{array}{lll} - \production{module} & \Tmodule & - \begin{array}[t]{@{}cllll} - ::=& - \text{(}~\text{module}~~\Tid^?~~(m{:}\Tmodulefield_I)^\ast~\text{)} - \quad\Rightarrow\quad \bigcompose m^\ast \\ - &\qquad (\iff I = \bigcompose \F{idc}(\Tmodulefield)^\ast \idcwellformed) \\ - \end{array} \\[1ex] - \production{module field} & \Tmodulefield_I & - \begin{array}[t]{@{}clll} - ::=& - \X{ty}^\ast{:}\Trectype_I &\Rightarrow& \MODULE~\X{ty}^\ast \\ |& - \X{im}{:}\Timport_I &\Rightarrow& \MODULE~\X{im} \\ |& - \X{tg}{:}\Ttag_I &\Rightarrow& \MODULE~\X{tg} \\ |& - \X{gl}{:}\Tglobal_I &\Rightarrow& \MODULE~\X{gl} \\ |& - \X{me}{:}\Tmem_I &\Rightarrow& \MODULE~\X{me} \\ |& - \X{ta}{:}\Ttable_I &\Rightarrow& \MODULE~\X{ta} \\ |& - \X{fn}{:}\Tfunc_I &\Rightarrow& \MODULE~\X{fn} \\ |& - \X{da}{:}\Tdata_I &\Rightarrow& \MODULE~\X{da} \\ |& - \X{el}{:}\Telem_I &\Rightarrow& \MODULE~\X{el} \\ |& - \X{st}{:}\Tstart_I &\Rightarrow& \MODULE~\X{st} \\ |& - \X{ex}{:}\Texport_I &\Rightarrow& \MODULE~\X{ex} \\ - \end{array} - \end{array} - -where :math:`\bigcompose m^\ast` is the :ref:`module ` formed by the repeated concatenation of the indivual field sequences in order. -The following restrictions are imposed on this composition: :math:`m_1 \compose m_2` is defined if and only if - -* :math:`\start_1^? = \epsilon \vee \start_2^? = \epsilon` - -* :math:`\tag_1^\ast = \global_1^\ast = \mem_1^\ast = \table_1^\ast = \func_1^\ast = \epsilon \vee \import_2^\ast = \epsilon` +$${grammar: Tdecl_} -.. note:: - The first condition ensures that there is at most one start function. - The second condition enforces that all :ref:`imports ` must occur before any regular definition of a - :ref:`tag `, - :ref:`global `, - :ref:`memory `, - :ref:`table `, or - :ref:`function `, - thereby maintaining the ordering of the respective :ref:`index spaces `. - - The :ref:`well-formedness ` condition on :math:`I` in the grammar for |Tmodule| ensures that no namespace contains duplicate identifiers. - -The definition of the initial :ref:`identifier context ` :math:`I` uses the following auxiliary definition which maps each relevant definition to a singular context with one (possibly empty) identifier: - -.. math:: - \begin{array}{@{}lcl@{\qquad\qquad}l} - \F{idc}(\text{(}~\text{rec}~~\Ttypedef^\ast~\text{)}) &=& - \bigcompose \F{idc}(\Ttypedef)^\ast \\ - \F{idc}(\text{(}~\text{type}~v^?{:}\Tid^?~\Tsubtype~\text{)}) &=& - \{\ITYPES~(v^?), \IFIELDS~\F{idf}(\Tsubtype), \ITYPEDEFS~\X{st}\} \\ - \F{idc}(\text{(}~\text{tag}~v^?{:}\Tid^?~\dots~\text{)}) &=& - \{\ITAGS~(v^?)\} \\ - \F{idc}(\text{(}~\text{global}~v^?{:}\Tid^?~\dots~\text{)}) &=& - \{\IGLOBALS~(v^?)\} \\ - \F{idc}(\text{(}~\text{memory}~v^?{:}\Tid^?~\dots~\text{)}) &=& - \{\IMEMS~(v^?)\} \\ - \F{idc}(\text{(}~\text{table}~v^?{:}\Tid^?~\dots~\text{)}) &=& - \{\ITABLES~(v^?)\} \\ - \F{idc}(\text{(}~\text{func}~v^?{:}\Tid^?~\dots~\text{)}) &=& - \{\IFUNCS~(v^?)\} \\ - \F{idc}(\text{(}~\text{data}~v^?{:}\Tid^?~\dots~\text{)}) &=& - \{\IDATAS~(v^?)\} \\ - \F{idc}(\text{(}~\text{elem}~v^?{:}\Tid^?~\dots~\text{)}) &=& - \{\IELEMS~(v^?)\} \\ - \F{idc}(\text{(}~\text{import}~\dots~\text{(}~\text{func}~v^?{:}\Tid^?~\dots~\text{)}~\text{)}) &=& - \{\IFUNCS~(v^?)\} \\ - \F{idc}(\text{(}~\text{import}~\dots~\text{(}~\text{table}~v^?{:}\Tid^?~\dots~\text{)}~\text{)}) &=& - \{\ITABLES~(v^?)\} \\ - \F{idc}(\text{(}~\text{import}~\dots~\text{(}~\text{memory}~v^?{:}\Tid^?~\dots~\text{)}~\text{)}) &=& - \{\IMEMS~(v^?)\} \\ - \F{idc}(\text{(}~\text{import}~\dots~\text{(}~\text{global}~v^?{:}\Tid^?~\dots~\text{)}~\text{)}) &=& - \{\IGLOBALS~(v^?)\} \\ - \F{idc}(\text{(}~\dots~\text{)}) &=& - \{\} - \\[2ex] - \F{idf}(\text{(}~\text{sub}~\dots~\Tcomptype~\text{)}) &=& - \F{idf}(\Tcomptype) \\ - \F{idf}(\text{(}~\text{struct}~\X{Tfield}^\ast~\text{)}) &=& - \bigcompose \F{idf}(\Tfield)^\ast \\ - \F{idf}(\text{(}~\text{array}~\dots~\text{)}) &=& - \epsilon \\ - \F{idf}(\text{(}~\text{func}~\dots~\text{)}) &=& - \epsilon \\ - \F{idf}(\text{(}~\text{field}~v^?{:}\Tid^?~\dots~\text{)}) &=& - v^? \\ - \end{array} +$${grammar: Tmodule/plain} + +where ${:$types(decl*)}, ${:$imports(decl*)}, ${:$tags(decl*)}, etc., extract the sequence of :ref:`types `, :ref:`imports `, :ref:`tags `, etc., contained in ${:decl*}, respectively. +The auxiliary predicate ${:$ordered} checks that no imports occur after the first definition of a +:ref:`tag `, +:ref:`global `, +:ref:`memory `, +:ref:`table `, or +:ref:`function ` +in a sequence of declarations: + +.. _aux-ordered: + +$${definition: ordered} + +$${definition-ignore: typesd importsd tagsd globalsd memsd tablesd funcsd datasd elemsd startsd exportsd} Abbreviations ............. -In a source file, the toplevel :math:`\T{(module}~\dots\T{)}` surrounding the module body may be omitted. +In a source file, the toplevel ${grammar-case: "(" "module" Tdecldots ")"} surrounding the module body may be omitted. -.. math:: - \begin{array}{llcll} - \production{module} & - \Tmodulefield^\ast &\equiv& - \text{(}~\text{module}~~\Tmodulefield^\ast~\text{)} - \end{array} +$${grammar: Tmodule/abbrev} diff --git a/document/core/util/macros.def b/document/core/util/macros.def index 7bd9e29ff..00b8213d3 100644 --- a/document/core/util/macros.def +++ b/document/core/util/macros.def @@ -418,6 +418,7 @@ .. Modules, non-terminals .. |module| mathdef:: \xref{syntax/modules}{syntax-module}{\X{module}} +.. |decl| mathdef:: \xref{text/modules}{syntax-decl}{\X{decl}} .. |type| mathdef:: \xref{syntax/types}{syntax-rectype}{\X{type}} .. |func| mathdef:: \xref{syntax/modules}{syntax-func}{\X{func}} .. |local| mathdef:: \xref{syntax/modules}{syntax-local}{\X{local}} @@ -442,6 +443,20 @@ .. |globalsxx| mathdef:: \xref{syntax/modules}{syntax-externidx}{\F{globals}} .. |tagsxx| mathdef:: \xref{syntax/modules}{syntax-externidx}{\F{tags}} +.. |typesd| mathdef:: \xref{text/modules}{syntax-decl}{\F{types}} +.. |importsd| mathdef:: \xref{text/modules}{syntax-decl}{\F{imports}} +.. |tagsd| mathdef:: \xref{text/modules}{syntax-decl}{\F{tags}} +.. |globalsd| mathdef:: \xref{text/modules}{syntax-decl}{\F{globals}} +.. |memsd| mathdef:: \xref{text/modules}{syntax-decl}{\F{mems}} +.. |tablesd| mathdef:: \xref{text/modules}{syntax-decl}{\F{tables}} +.. |funcsd| mathdef:: \xref{text/modules}{syntax-decl}{\F{funcs}} +.. |datasd| mathdef:: \xref{text/modules}{syntax-decl}{\F{datas}} +.. |elemsd| mathdef:: \xref{text/modules}{syntax-decl}{\F{elems}} +.. |startsd| mathdef:: \xref{text/modules}{syntax-decl}{\F{starts}} +.. |exportsd| mathdef:: \xref{text/modules}{syntax-decl}{\F{exports}} + +.. |ordered| mathdef:: \xref{text/modules}{aux-ordered}{\F{ordered}} + .. Instructions, terminals @@ -965,26 +980,26 @@ .. |TfX#1| mathdef:: {\T{f}#1} .. |TuN| mathdef:: \xref{text/values}{text-int}{\TuX{{\kern-0.1em N}}} -.. |Tu1| mathdef:: \xref{text/values}{text-int}{\TuX{\T{1}}} -.. |Tu8| mathdef:: \xref{text/values}{text-int}{\TuX{\T{8}}} -.. |Tu16| mathdef:: \xref{text/values}{text-int}{\TuX{\T{16}}} -.. |Tu32| mathdef:: \xref{text/values}{text-int}{\TuX{\T{32}}} -.. |Tu64| mathdef:: \xref{text/values}{text-int}{\TuX{\T{64}}} +.. |Tu1| mathdef:: \xref{text/values}{text-int}{\T{u1}} +.. |Tu8| mathdef:: \xref{text/values}{text-int}{\T{u8}} +.. |Tu16| mathdef:: \xref{text/values}{text-int}{\T{u16}} +.. |Tu32| mathdef:: \xref{text/values}{text-int}{\T{u32}} +.. |Tu64| mathdef:: \xref{text/values}{text-int}{\T{u64}} .. |TsN| mathdef:: \xref{text/values}{text-int}{\TsX{\kern-0.1em N}} -.. |Ts32| mathdef:: \xref{text/values}{text-int}{\TsX{\T{32}}} -.. |Ts64| mathdef:: \xref{text/values}{text-int}{\TsX{\T{64}}} +.. |Ts32| mathdef:: \xref{text/values}{text-int}{\T{s32}} +.. |Ts64| mathdef:: \xref{text/values}{text-int}{\T{s64}} .. |TiN| mathdef:: \xref{text/values}{text-int}{\TiX{\kern-0.1em N}} -.. |Ti8| mathdef:: \xref{text/values}{text-int}{\TiX{\T{8}}} -.. |Ti16| mathdef:: \xref{text/values}{text-int}{\TiX{\T{16}}} -.. |Ti32| mathdef:: \xref{text/values}{text-int}{\TiX{\T{32}}} -.. |Ti64| mathdef:: \xref{text/values}{text-int}{\TiX{\T{64}}} +.. |Ti8| mathdef:: \xref{text/values}{text-int}{\T{i8}} +.. |Ti16| mathdef:: \xref{text/values}{text-int}{\T{i16}} +.. |Ti32| mathdef:: \xref{text/values}{text-int}{\T{i32}} +.. |Ti64| mathdef:: \xref{text/values}{text-int}{\T{i64}} .. |TfN| mathdef:: \xref{text/values}{text-float}{\TfX{\kern-0.1em N}} .. |TfNmag| mathdef:: \xref{text/values}{text-float}{\TfX{N}\T{mag}} -.. |Tf32| mathdef:: \xref{text/values}{text-float}{\TfX{\T{32}}} -.. |Tf64| mathdef:: \xref{text/values}{text-float}{\TfX{\T{64}}} +.. |Tf32| mathdef:: \xref{text/values}{text-float}{\T{f32}} +.. |Tf64| mathdef:: \xref{text/values}{text-float}{\T{f64}} .. |Tstring| mathdef:: \xref{text/values}{text-string}{\T{string}} .. |Tstringelem| mathdef:: \xref{text/values}{text-string}{\T{stringelem}} @@ -1030,6 +1045,7 @@ .. Indices, non-terminals +.. |Tidx| mathdef:: \xref{text/modules}{text-idx}{\T{idx}} .. |Ttypeidx| mathdef:: \xref{text/modules}{text-typeidx}{\T{typeidx}} .. |Tfuncidx| mathdef:: \xref{text/modules}{text-funcidx}{\T{funcidx}} .. |Ttableidx| mathdef:: \xref{text/modules}{text-tableidx}{\T{tableidx}} @@ -1046,7 +1062,7 @@ .. Modules, non-terminals .. |Tmodule| mathdef:: \xref{text/modules}{text-module}{\T{module}} -.. |Tmodulefield| mathdef:: \xref{text/modules}{text-modulefield}{\T{modulefield}} +.. |Tdecl| mathdef:: \xref{text/modules}{text-decl}{\T{decl}} .. |Ttype| mathdef:: \xref{text/types}{text-type}{\T{type}} .. |Ttypeuse| mathdef:: \xref{text/types}{text-typeuse}{\T{typeuse}} .. |Tfunc| mathdef:: \xref{text/modules}{text-func}{\T{func}} @@ -1074,11 +1090,13 @@ .. |Tmemarg| mathdef:: \xref{text/instructions}{text-memarg}{\T{memarg}} .. |Talign| mathdef:: \xref{text/instructions}{text-memarg}{\T{align}} .. |Toffset| mathdef:: \xref{text/instructions}{text-memarg}{\T{offset}} +.. |Tlaneidx| mathdef:: \xref{text/instructions}{text-laneidx}{\T{laneidx}} .. |Tblocktype| mathdef:: \xref{text/instructions}{text-blocktype}{\T{blocktype}} .. |Tlabel| mathdef:: \xref{text/instructions}{text-label}{\T{label}} .. |Tinstr| mathdef:: \xref{text/instructions}{text-instr}{\T{instr}} +.. |Tinstrs| mathdef:: \xref{text/instructions}{text-instrs}{\T{instrs}} .. |Tplaininstr| mathdef:: \xref{text/instructions}{text-plaininstr}{\T{plaininstr}} .. |Tblockinstr| mathdef:: \xref{text/instructions}{text-blockinstr}{\T{blockinstr}} .. |Tfoldedinstr| mathdef:: \xref{text/instructions}{text-foldedinstr}{\T{foldedinstr}} @@ -1235,6 +1253,8 @@ .. |subexterntypematch| mathdef:: \xref{valid/matching}{match-externtype}{\leq} .. |sublimitsmatch| mathdef:: \xref{valid/matching}{match-limits}{\leq} +.. |arrowmemarg| mathdef:: \xref{valid/instructions}{valid-memarg}{\rightarrow} +.. |vdashmemarg| mathdef:: \xref{valid/instructions}{valid-memarg}{\vdash} .. |vdashinstr| mathdef:: \xref{valid/instructions}{valid-instr}{\vdash} .. |vdashinstrs| mathdef:: \xref{valid/instructions}{valid-instrs}{\vdash} .. |vdashcatch| mathdef:: \xref{valid/instructions}{valid-catch}{\vdash} @@ -1519,10 +1539,6 @@ .. |REFEXTERN| mathdef:: \xref{exec/runtime}{syntax-ref}{\K{ref{.}extern}} .. |TRAP| mathdef:: \xref{exec/runtime}{syntax-trap}{\K{trap}} -.. TODO remove these -.. |INVOKE| mathdef:: \xref{exec/instructions}{exec-invoke}{\K{invoke}} -.. |RETURNINVOKE| mathdef:: \xref{exec/instructions}{exec-invoke}{\K{return\_invoke}} - .. Values & Results, non-terminals diff --git a/document/core/util/mathjax2katex.py b/document/core/util/mathjax2katex.py index 2f7d5bd7d..b840fced1 100755 --- a/document/core/util/mathjax2katex.py +++ b/document/core/util/mathjax2katex.py @@ -61,16 +61,19 @@ def HasBalancedTags(s): def ReplaceMath(cache, data): old = data - data = re.sub('[\\\\]\\[([0-9]|-)', '\\\\DOUBLESLASH\\[\\1', data) # Messed up by Bikeshed + data = re.sub('[\\\\][\\\\]\\[([0-9]|-)', '\\\\DOUBLESLASH[\\1', data) # Messed up by Bikeshed data = data.replace('\\\\', '\\DOUBLESLASH') - data = data.replace('\\(', '') - data = data.replace('\\)', '') + #data = data.replace('\\(', '') + #data = data.replace('\\)', '') + data = re.sub('^\\\\\\(', '', data) + data = re.sub('\\\\\\)$', '', data) data = data.replace('\\[', '') data = data.replace('\\]', '') data = data.replace('\\DOUBLESLASH', '\\\\') data = data.replace('\u2019', '\'') # "Right Single Quotation Mark" messed up by Bikeshed data = data.replace('\\hfill', ' ') data = data.replace('\\mbox', '\\text') + data = data.replace('\\texttt{', '{\\tt ') data = data.replace('\\begin{split}', '\\begin{aligned}') data = data.replace('\\end{split}', '\\end{aligned}') data = re.sub('\\\\multicolumn\\{[2-9]\\}\\{@\\{\\}l@\\{\\}\\}', '', data) # Katex can't handle it diff --git a/document/core/valid/conventions.rst b/document/core/valid/conventions.rst index fe9ea161c..7164062ed 100644 --- a/document/core/valid/conventions.rst +++ b/document/core/valid/conventions.rst @@ -88,7 +88,7 @@ Convention .. note:: This definition computes an approximation of the reference type that is inhabited by all values from ${:rt_1} except those from ${:rt_2}. Since the type system does not have general union types, - the defnition only affects the presence of null and cannot express the absence of other values. + the definition only affects the presence of null and cannot express the absence of other values. .. index:: ! defined type, recursive type diff --git a/document/core/valid/instructions.rst b/document/core/valid/instructions.rst index 84579f28a..d92dd7d19 100644 --- a/document/core/valid/instructions.rst +++ b/document/core/valid/instructions.rst @@ -548,7 +548,7 @@ $${rule-prose: Instr_ok/elem.drop} $${rule: Instr_ok/elem.drop} -.. index:: memory instruction, memory index, context +.. index:: memory instruction, memory index, context, memmory argument pair: validation; instruction single: abstract syntax; instruction .. _valid-memarg: @@ -557,6 +557,18 @@ $${rule: Instr_ok/elem.drop} Memory Instructions ~~~~~~~~~~~~~~~~~~~ +Memory instructions use :ref:`memory arguments `, +which are classified by the :ref:`address type ` and the +and :ref:`bit width ` of the access they are suitable for. + +:math:`\memarg` +............... + +$${rule-prose: Memarg_ok} + +$${rule: Memarg_ok} + + .. _valid-load-val: :math:`t\K{.}\LOAD~x~\memarg` diff --git a/document/core/valid/types.rst b/document/core/valid/types.rst index 622df6599..b5ba80c84 100644 --- a/document/core/valid/types.rst +++ b/document/core/valid/types.rst @@ -82,6 +82,8 @@ Value Types $${rule-prose: Valtype_ok} +$${rule: Valtype_ok/bot} + .. index:: result type, value type pair: validation; result type diff --git a/document/index.html b/document/index.html index 9fbe292c3..322b4d94f 100644 --- a/document/index.html +++ b/document/index.html @@ -112,7 +112,7 @@

All Versions

diff --git a/document/js-api/index.bs b/document/js-api/index.bs index f20b0cf2e..a9dc728d4 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -639,15 +639,17 @@ The verification of WebAssembly type requirements is deferred to the To instantiate a promise of a module |promiseOfModule| with imports |importObject|, perform the following steps: 1. Let |promise| be [=a new promise=]. - 1. [=Upon fulfillment=] of |promiseOfModule| with value |module|: - 1. [=asynchronously instantiate a WebAssembly module|Instantiate the WebAssembly module=] |module| importing |importObject|, and let |innerPromise| be the result. - 1. [=Upon fulfillment=] of |innerPromise| with value |instance|. - 1. Let |result| be the {{WebAssemblyInstantiatedSource}} value «[ "{{WebAssemblyInstantiatedSource/module}}" → |module|, "{{WebAssemblyInstantiatedSource/instance}}" → |instance| ]». - 1. [=Resolve=] |promise| with |result|. - 1. [=Upon rejection=] of |innerPromise| with reason |reason|: + 1. [=React=] to |promiseOfModule|: + * If |promiseOfModule| was fulfilled with value |module|: + 1. [=asynchronously instantiate a WebAssembly module|Instantiate the WebAssembly module=] |module| importing |importObject|, and let |innerPromise| be the result. + 1. [=React=] to |innerPromise|: + * If |innerPromise| was fulfilled with value |instance|. + 1. Let |result| be the {{WebAssemblyInstantiatedSource}} value «[ "{{WebAssemblyInstantiatedSource/module}}" → |module|, "{{WebAssemblyInstantiatedSource/instance}}" → |instance| ]». + 1. [=Resolve=] |promise| with |result|. + * If |innerPromise| was rejected with reason |reason|: + 1. [=Reject=] |promise| with |reason|. + * If |promiseOfModule| was rejected with reason |reason|: 1. [=Reject=] |promise| with |reason|. - 1. [=Upon rejection=] of |promiseOfModule| with reason |reason|: - 1. [=Reject=] |promise| with |reason|. 1. Return |promise|. diff --git a/document/util/check-echidna-status.py b/document/util/check-echidna-status.py index 9bc3f6026..75611c2e8 100755 --- a/document/util/check-echidna-status.py +++ b/document/util/check-echidna-status.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import argparse from datetime import datetime, timedelta import json import os @@ -23,13 +24,21 @@ def get_echidna_id(directory): def get_current_response(echidna_id): url = ECHIDNA_STATUS_URL + echidna_id print(f'Fetching {url}') - response = requests.get(url, allow_redirects=True) - if response.status_code != 200: + tries = 3 + while tries: + response = requests.get(url, allow_redirects=True) + if response.status_code == 200: + return response.json() + print(f'Got status code {response.status_code}, text:') print(response.text) - raise Exception('Failed to fetch echidna result') + tries -= 1 + if tries: + print('Retrying in 10s') + time.sleep(10) + + raise Exception('Failed to fetch echidna result') - return response.json() def get_echidna_result(echidna_id): @@ -42,16 +51,26 @@ def get_echidna_result(echidna_id): result = response['results']['status'] print(f'Echidna issue {echidna_id} is {result}.') print(json.dumps(response, indent=2)) - return result == 'success' + if result != 'success': + raise Exception(f'Echidna result: {result}') def main(argv): - directory = os.getcwd() if len(argv) < 2 else argv[1] + parser = argparse.ArgumentParser() + parser.add_argument('--ignore-failure', action='store_true') + parser.add_argument('directory', nargs='?', default=os.getcwd()) + args = parser.parse_args() + + directory = args.directory echidna_id = get_echidna_id(directory) print(f'Got echidna id {echidna_id}.') time.sleep(5) - if not get_echidna_result(echidna_id): - sys.exit(1) + try: + get_echidna_result(echidna_id) + except Exception as e: + print(f'Echidna failure: {e}') + if not args.ignore_failure: + sys.exit(1) if __name__ == '__main__': diff --git a/document/versions/core/WebAssembly-2.0.pdf b/document/versions/core/WebAssembly-2.0.pdf index 3a43c0020..4ccfdebd1 100644 Binary files a/document/versions/core/WebAssembly-2.0.pdf and b/document/versions/core/WebAssembly-2.0.pdf differ diff --git a/document/versions/core/WebAssembly-3.0-draft.pdf b/document/versions/core/WebAssembly-3.0-draft.pdf index 5dd7c4608..8c320a02d 100644 Binary files a/document/versions/core/WebAssembly-3.0-draft.pdf and b/document/versions/core/WebAssembly-3.0-draft.pdf differ diff --git a/document/web-api/index.bs b/document/web-api/index.bs index 83d8288d8..09c0d975b 100644 --- a/document/web-api/index.bs +++ b/document/web-api/index.bs @@ -117,30 +117,32 @@ Note: This algorithm accepts a {{Response}} object, or a {{CompileError}} or other relevant error type, depending on the cause of failure. - 1. Let |returnValue| be [=a new promise=] - 1. [=Upon fulfillment=] of |source| with value |unwrappedSource|: - 1. Let |response| be |unwrappedSource|'s [=Response/response=]. - 1. Let |mimeType| be the result of [=header list/getting=] `` `Content-Type` `` from |response|'s [=response/header list=]. - 1. If |mimeType| is null, reject |returnValue| with a {{TypeError}} and abort these substeps. - 1. Remove all [=HTTP tab or space byte=] from the start and end of |mimeType|. - 1. If |mimeType| is not a [=byte-case-insensitive=] match for `` `application/wasm` ``, reject |returnValue| with a {{TypeError}} and abort these substeps. - - Note: extra parameters are not allowed, including the empty `` `application/wasm;` ``. - - 1. If |response| is not [=CORS-same-origin=], [=reject=] |returnValue| with a {{TypeError}} and abort these substeps. - 1. If |response|'s [=response/status=] is not an [=ok status=], [=reject=] |returnValue| with a {{TypeError}} and abort these substeps. - 1. [=Consume body|Consume=] |response|'s body as an {{ArrayBuffer}}, and let |bodyPromise| be the result. - - Note: Although it is specified here that the response is consumed entirely before compilation proceeds, that is purely for ease of specification; implementations are likely to instead perform processing in a streaming fashion. The difference is unobservable, and thus the simpler model is specified. - - 1. [=Upon fulfillment=] of |bodyPromise| with value |bodyArrayBuffer|: - 1. Let |stableBytes| be a [=get a copy of the buffer source|copy of the bytes held by the buffer=] |bodyArrayBuffer|. - 1. [=Asynchronously compile a WebAssembly module|Asynchronously compile the WebAssembly module=] |stableBytes| using the [=networking task source=] and |options| and [=resolve=] |returnValue| with the result. - 1. [=Upon rejection=] of |bodyPromise| with reason |reason|: + 1. Let |returnValue| be [=a new promise=]. + 1. [=React=] to |source|: + * If |source| was fulfilled with value |unwrappedSource|: + 1. Let |response| be |unwrappedSource|'s [=Response/response=]. + 1. Let |mimeType| be the result of [=header list/getting=] `` `Content-Type` `` from |response|'s [=response/header list=]. + 1. If |mimeType| is null, reject |returnValue| with a {{TypeError}} and abort these substeps. + 1. Remove all [=HTTP tab or space byte=] from the start and end of |mimeType|. + 1. If |mimeType| is not a [=byte-case-insensitive=] match for `` `application/wasm` ``, reject |returnValue| with a {{TypeError}} and abort these substeps. + + Note: extra parameters are not allowed, including the empty `` `application/wasm;` ``. + + 1. If |response| is not [=CORS-same-origin=], [=reject=] |returnValue| with a {{TypeError}} and abort these substeps. + 1. If |response|'s [=response/status=] is not an [=ok status=], [=reject=] |returnValue| with a {{TypeError}} and abort these substeps. + 1. [=Consume body|Consume=] |response|'s body as an {{ArrayBuffer}}, and let |bodyPromise| be the result. + + Note: Although it is specified here that the response is consumed entirely before compilation proceeds, that is purely for ease of specification; implementations are likely to instead perform processing in a streaming fashion. The difference is unobservable, and thus the simpler model is specified. + + 1. [=React=] to |bodyPromise|: + * If |bodyPromise| was fulfilled with value |bodyArrayBuffer|: + 1. Let |stableBytes| be a [=get a copy of the buffer source|copy of the bytes held by the buffer=] |bodyArrayBuffer|. + 1. [=Asynchronously compile a WebAssembly module|Asynchronously compile the WebAssembly module=] |stableBytes| using the [=networking task source=] and |options| and [=resolve=] |returnValue| with the result. + * If |bodyPromise| was rejected with reason |reason|: + 1. [=Reject=] |returnValue| with |reason|. + * If |source| was rejected with reason |reason|: 1. [=Reject=] |returnValue| with |reason|. - 1. [=Upon rejection=] of |source| with reason |reason|: - 1. [=Reject=] |returnValue| with |reason|. - 1. Return |returnValue|. + 1. Return |returnValue|.

Serialization

diff --git a/interpreter/script/js.ml b/interpreter/script/js.ml index e0e180a08..d395a6882 100644 --- a/interpreter/script/js.ml +++ b/interpreter/script/js.ml @@ -161,6 +161,8 @@ function assert_return(action, loc, ...expected) { throw new Error(expected.length + " value(s) expected, got " + actual.length); } for (let i = 0; i < actual.length; ++i) { + let actual_i; + try { actual_i = "" + actual[i] } catch { actual_i = typeof actual[i] } switch (expected[i]) { case "nan:canonical": case "nan:arithmetic": @@ -168,12 +170,12 @@ function assert_return(action, loc, ...expected) { // Note that JS can't reliably distinguish different NaN values, // so there's no good way to test that it's a canonical NaN. if (!Number.isNaN(actual[i])) { - throw new Error("Wasm NaN return value expected, got " + actual[i]); + throw new Error("Wasm NaN return value expected, got " + actual_i); }; return; case "ref.i31": if (typeof actual[i] !== "number" || (actual[i] & 0x7fffffff) !== actual[i]) { - throw new Error("Wasm i31 return value expected, got " + actual[i]); + throw new Error("Wasm i31 return value expected, got " + actual_i); }; return; case "ref.any": @@ -183,27 +185,27 @@ function assert_return(action, loc, ...expected) { // For now, JS can't distinguish exported Wasm GC values, // so we only test for object. if (typeof actual[i] !== "object") { - throw new Error("Wasm object return value expected, got " + actual[i]); + throw new Error("Wasm object return value expected, got " + actual_i); }; return; case "ref.func": if (typeof actual[i] !== "function") { - throw new Error("Wasm function return value expected, got " + actual[i]); + throw new Error("Wasm function return value expected, got " + actual_i); }; return; case "ref.extern": if (actual[i] === null) { - throw new Error("Wasm reference return value expected, got " + actual[i]); + throw new Error("Wasm reference return value expected, got " + actual_i); }; return; case "ref.null": if (actual[i] !== null) { - throw new Error("Wasm null return value expected, got " + actual[i]); + throw new Error("Wasm null return value expected, got " + actual_i); }; return; default: if (!Object.is(actual[i], expected[i])) { - throw new Error("Wasm return value " + expected[i] + " expected, got " + actual[i]); + throw new Error("Wasm return value " + expected[i] + " expected, got " + actual_i); }; } } @@ -642,7 +644,7 @@ let is_js_vectype = function | _ -> false let is_js_reftype = function - | (_, ExnHT) -> false + | (_, (ExnHT | NoExnHT)) -> false | _ -> true let is_js_valtype = function @@ -685,8 +687,11 @@ let of_bytes = of_string_with String.iter add_hex_char let of_string = of_string_with String.iter add_char let of_name = of_string_with List.iter add_unicode_char +let of_loc_unquoted at = + Filename.basename at.left.file ^ ":" ^ string_of_int at.left.line + let of_loc at = - of_string (Filename.basename at.left.file ^ ":" ^ string_of_int at.left.line) + of_string (of_loc_unquoted at) let of_float z = match string_of_float z with @@ -789,7 +794,7 @@ let of_action env act = let of_assertion' env act loc name args wrapper_opt = let act_js, act_wrapper_opt = of_action env act in - let js = name ^ "(() => " ^ act_js ^ loc ^ String.concat ", " ("" :: args) ^ ")" in + let js = name ^ "(() => " ^ act_js ^ ", " ^ loc ^ String.concat ", " ("" :: args) ^ ")" in match act_wrapper_opt with | None -> js ^ ";" | Some (act_wrapper, out) -> @@ -797,7 +802,7 @@ let of_assertion' env act loc name args wrapper_opt = match wrapper_opt with | None -> name, run | Some wrapper -> "run", wrapper - in run_name ^ "(() => " ^ act_wrapper (wrapper out) act.at ^ loc ^ "); // " ^ js + in run_name ^ "(() => " ^ act_wrapper (wrapper out) act.at ^ ", " ^ loc ^ "); // " ^ js let of_assertion env ass = let loc = of_loc ass.at in @@ -825,8 +830,8 @@ let of_assertion env ass = of_assertion' env act loc "assert_exception" [] None let of_command env cmd = + "\n// " ^ of_loc_unquoted cmd.at ^ "\n" ^ let loc = of_loc cmd.at in - "\n// " ^ loc ^ "\n" ^ match cmd.it with | Module (x_opt, def) -> let rec unquote def = diff --git a/proposals/gc/Overview.md b/proposals/gc/Overview.md index c4982342b..07142bb82 100644 --- a/proposals/gc/Overview.md +++ b/proposals/gc/Overview.md @@ -162,7 +162,7 @@ The above could map to (array.new $char-array (i32.const 0x41) (i32.const 4)) ) ) - (array.get $buf + (array.get $char-array (struct.get $buf $chars (local.get $b)) (struct.get $buf $pos (local.get $b)) ) diff --git a/specification/Makefile b/specification/Makefile new file mode 100644 index 000000000..c9b963bc0 --- /dev/null +++ b/specification/Makefile @@ -0,0 +1,75 @@ +EXE = $(PWD)/../spectec/spectec + + +# Main targets + +.PHONY: all ci + +all: check-all spec test +ci: check-all spec-clean spec test-clean test + + +# Checking + +check: check-3.0 + +check-1.0: $(EXE) + $(EXE) wasm-1.0/* + @echo Wasm 1.0 spec checked OK. + @echo ========================= + +check-2.0: $(EXE) + $(EXE) wasm-2.0/* + @echo Wasm 2.0 spec checked OK. + @echo ========================= + +check-3.0: $(EXE) + $(EXE) wasm-3.0/* + @echo Wasm 3.0 spec checked OK. + @echo ========================= + +check-all: check-1.0 check-2.0 check-3.0 + @echo All Wasm specs checked OK. + + +# Build + +spec: + (cd ../document/core && make main) + @echo Wasm 3.0 specs all built OK. + @echo ============================ + +spec-pdf: + (cd ../document/core && make pdf) + @echo Wasm 3.0 PDF spec built OK. + @echo =========================== + +spec-html: + (cd ../document/core && make html) + @echo Wasm 3.0 HTML spec built OK. + @echo ============================ + +spec-clean: + (cd ../document/core && make clean) + + +# Full test + +test: + @((cd ../spectec/src && make test) || @echo Backend tests failed. Perhaps run `make testpromote` to update test output.) + @echo Wasm 3.0 backend tests ran OK. + @echo ============================== + +test-clean: + @(cd ../spectec/src && make clean) + +testpromote: + @(cd ../spectec/src && make testpromote) + + +# Executable + +$(EXE): spectec + +spectec: + @(cd ../spectec && make exe) diff --git a/specification/wasm-2.0/1-syntax.spectec b/specification/wasm-2.0/1-syntax.spectec index 0c110a5fa..bbb9daf38 100644 --- a/specification/wasm-2.0/1-syntax.spectec +++ b/specification/wasm-2.0/1-syntax.spectec @@ -395,7 +395,7 @@ syntax vloadop = syntax blocktype hint(desc "block type") = | _RESULT valtype? - | _IDX funcidx + | _IDX typeidx var bt : blocktype diff --git a/specification/wasm-3.0/1.3-syntax.instructions.spectec b/specification/wasm-3.0/1.3-syntax.instructions.spectec index beb7ba2df..e51133cb7 100644 --- a/specification/wasm-3.0/1.3-syntax.instructions.spectec +++ b/specification/wasm-3.0/1.3-syntax.instructions.spectec @@ -184,7 +184,7 @@ syntax vcvtop__(Fnn_1 X M_1, Fnn_2 X M_2) = ;; Memory operators -syntax memarg hint(desc "memory argument") = {ALIGN u32, OFFSET u32} +syntax memarg hint(desc "memory argument") = {ALIGN u32, OFFSET u64} var ao : memarg @@ -204,7 +204,7 @@ syntax vloadop_(vectype) hint(macro "%" "L%") = syntax blocktype hint(desc "block type") = | _RESULT valtype? - | _IDX funcidx + | _IDX typeidx var bt : blocktype @@ -422,7 +422,7 @@ def $free_expr(expr) : free def $free_shape(lanetype X dim) = $free_lanetype(lanetype) def $free_blocktype(_RESULT valtype?) = $free_opt($free_valtype(valtype)?) -def $free_blocktype(_IDX funcidx) = $free_funcidx(funcidx) +def $free_blocktype(_IDX typeidx) = $free_typeidx(typeidx) def $free_instr(NOP) = {} diff --git a/specification/wasm-3.0/2.3-validation.instructions.spectec b/specification/wasm-3.0/2.3-validation.instructions.spectec index bfd71e57f..a89f98c09 100644 --- a/specification/wasm-3.0/2.3-validation.instructions.spectec +++ b/specification/wasm-3.0/2.3-validation.instructions.spectec @@ -2,7 +2,7 @@ ;; Validation of Instructions ;; -relation Instr_ok: context |- instr : instrtype hint(name "T") hint(macro "%instr") +relation Instr_ok: context |- instr : instrtype hint(name "T-instr") hint(macro "%instr") relation Instrs_ok: context |- instr* : instrtype hint(name "T-instr*") hint(macro "%instrs") relation Expr_ok: context |- expr : resulttype hint(name "T-expr") hint(macro "%expr") @@ -405,6 +405,14 @@ rule Instr_ok/elem.drop: ;; Memory instructions +relation Memarg_ok: |- memarg : addrtype -> N hint(name "T-memarg") hint(macro "%memarg") hint(prose "%1 is valid for %2 and %3") + +rule Memarg_ok: + |- {ALIGN n, OFFSET m} : at -> N + -- if $(2^n <= N/8) + -- if $(m < 2^$size(at)) + + rule Instr_ok/memory.size: C |- MEMORY.SIZE x : eps -> at -- if C.MEMS[x] = at lim PAGE @@ -443,12 +451,12 @@ rule Instr_ok/load: rule Instr_ok/load-val: C |- LOAD nt x memarg : at -> nt -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= $size(nt)/8) + -- Memarg_ok: |- memarg : at -> $size(nt) rule Instr_ok/load-pack: C |- LOAD Inn (M _ sx) x memarg : at -> Inn -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= M/8) + -- Memarg_ok: |- memarg : at -> M (; rule Instr_ok/store: @@ -462,48 +470,48 @@ rule Instr_ok/store: rule Instr_ok/store-val: C |- STORE nt x memarg : at nt -> eps -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= $size(nt)/8) + -- Memarg_ok: |- memarg : at -> $size(nt) rule Instr_ok/store-pack: C |- STORE Inn M x memarg : at Inn -> eps -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= M/8) + -- Memarg_ok: |- memarg : at -> M rule Instr_ok/vload-val: C |- VLOAD V128 x memarg : at -> V128 -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= $vsize(V128)/8) + -- Memarg_ok: |- memarg : at -> $vsize(V128) rule Instr_ok/vload-pack: C |- VLOAD V128 (SHAPE M X N _ sx) x memarg : at -> V128 -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= M/8 * N) + -- Memarg_ok: |- memarg : at -> $(M*N) rule Instr_ok/vload-splat: C |- VLOAD V128 (SPLAT N) x memarg : at -> V128 -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= N/8) + -- Memarg_ok: |- memarg : at -> N rule Instr_ok/vload-zero: C |- VLOAD V128 (ZERO N) x memarg : at -> V128 -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= N/8) + -- Memarg_ok: |- memarg : at -> N rule Instr_ok/vload_lane: C |- VLOAD_LANE V128 N x memarg i : at V128 -> V128 -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= N/8) + -- Memarg_ok: |- memarg : at -> N -- if $(i < 128/N) rule Instr_ok/vstore: C |- VSTORE V128 x memarg : at V128 -> eps -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= $vsize(V128)/8) + -- Memarg_ok: |- memarg : at -> $vsize(V128) rule Instr_ok/vstore_lane: C |- VSTORE_LANE V128 N x memarg i : at V128 -> eps -- if C.MEMS[x] = at lim PAGE - -- if $(2^(memarg.ALIGN) <= N/8) + -- Memarg_ok: |- memarg : at -> N -- if $(i < 128/N) diff --git a/specification/wasm-3.0/3.1-numerics.scalar.spectec b/specification/wasm-3.0/3.1-numerics.scalar.spectec index 832c21998..17171da2d 100644 --- a/specification/wasm-3.0/3.1-numerics.scalar.spectec +++ b/specification/wasm-3.0/3.1-numerics.scalar.spectec @@ -77,7 +77,7 @@ def $truncz(rat) : int def $truncz hint(builtin) ;;def $truncz(+-q) = +-n -- if n <- nat /\ $(q - 1) < n <= q -def $ceilz(rat) : int +def $ceilz(rat) : int hint(show $ceil(%)) hint(macro none) def $ceilz hint(builtin) ;;def $ceilz(+-q) = +-n -- if n <- nat /\ q <= n < $(q + 1) diff --git a/specification/wasm-3.0/3.2-numerics.vector.spectec b/specification/wasm-3.0/3.2-numerics.vector.spectec index 8ccc06b14..c88b9dadf 100644 --- a/specification/wasm-3.0/3.2-numerics.vector.spectec +++ b/specification/wasm-3.0/3.2-numerics.vector.spectec @@ -62,9 +62,6 @@ def $fvbinop_(shape, def $f_(N, fN(N), fN(N)) : fN(N)*, vec_(V128), vec_(V128)) def $ivternopnd_(shape, def $f_(N, iN(N), iN(N), iN(N)) : iN(N)*, vec_(V128), vec_(V128), vec_(V128)) : vec_(V128)* def $fvternop_(shape, def $f_(N, fN(N), fN(N), fN(N)) : fN(N)*, vec_(V128), vec_(V128), vec_(V128)) : vec_(V128)* -def $ivtestop_(shape, def $f_(N, iN(N)) : u32, vec_(V128)) : u32 -def $fvtestop_(shape, def $f_(N, fN(N)) : u32, vec_(V128)) : u32 - def $ivrelop_(shape, def $f_(N, iN(N), iN(N)) : u32, vec_(V128), vec_(V128)) : vec_(V128) def $ivrelopsx_(shape, def $f_(N, sx, iN(N), iN(N)) : u32, sx, vec_(V128), vec_(V128)) : vec_(V128) def $fvrelop_(shape, def $f_(N, fN(N), fN(N)) : u32, vec_(V128), vec_(V128)) : vec_(V128) @@ -120,15 +117,6 @@ def $fvternop_(Fnn X M, def $f_, v_1, v_2, v_3) = $inv_lanes_(Fnn X M, c*)* -- if c** = $setproduct_(lane_(Fnn), $f_($sizenn(Fnn), c_1, c_2, c_3)*) -def $ivtestop_(Jnn X M, def $f_, v_1) = $prod(c*) - -- if c_1* = $lanes_(Jnn X M, v_1) - -- if c* = $f_($lsizenn(Jnn), c_1)* - -def $fvtestop_(Fnn X M, def $f_, v_1) = $prod(c*) - -- if c_1* = $lanes_(Fnn X M, v_1) - -- if c* = $f_($sizenn(Fnn), c_1)* - - def $ivrelop_(Jnn X M, def $f_, v_1, v_2) = $inv_lanes_(Jnn X M, c*) -- if c_1* = $lanes_(Jnn X M, v_1) -- if c_2* = $lanes_(Jnn X M, v_2) @@ -187,8 +175,6 @@ def $vbinop_(shape, vbinop_(shape), vec_(V128), vec_(V128)) : vec_(V128)* hint(show %2#$_(%1,%3,%4)) def $vternop_(shape, vternop_(shape), vec_(V128), vec_(V128), vec_(V128)) : vec_(V128)* hint(show %2#$_(%1,%3,%4,%5)) -def $vtestop_(shape, vtestop_(shape), vec_(V128)) : u32 - hint(show %2#$_(%1,%3)) def $vrelop_(shape, vrelop_(shape), vec_(V128), vec_(V128)) : vec_(V128) hint(show %2#$_(%1,%3,%4)) @@ -265,8 +251,6 @@ def $vternop_(Jnn X M, RELAXED_LANESELECT, v_1, v_2, v_3) = $ivternopnd_(Jnn X M def $vternop_(Fnn X M, RELAXED_MADD, v_1, v_2, v_3) = $fvternop_(Fnn X M, $frelaxed_madd_, v_1, v_2, v_3) def $vternop_(Fnn X M, RELAXED_NMADD, v_1, v_2, v_3) = $fvternop_(Fnn X M, $frelaxed_nmadd_, v_1, v_2, v_3) -def $vtestop_(Jnn X M, ALL_TRUE, v) = $ivtestop_(Jnn X M, $inez_, v) - def $vrelop_(Jnn X M, EQ, v_1, v_2) = $ivrelop_(Jnn X M, $ieq_, v_1, v_2) def $vrelop_(Jnn X M, NE, v_1, v_2) = $ivrelop_(Jnn X M, $ine_, v_1, v_2) def $vrelop_(Jnn X M, LT sx, v_1, v_2) = $ivrelopsx_(Jnn X M, $ilt_, sx, v_1, v_2) diff --git a/specification/wasm-3.0/4.3-execution.instructions.spectec b/specification/wasm-3.0/4.3-execution.instructions.spectec index 5c7a70663..bde165a66 100644 --- a/specification/wasm-3.0/4.3-execution.instructions.spectec +++ b/specification/wasm-3.0/4.3-execution.instructions.spectec @@ -992,7 +992,7 @@ rule Step_pure/vvternop: rule Step_pure/vvtestop: (VCONST V128 c_1) (VVTESTOP V128 ANY_TRUE) ~> (CONST I32 c) - -- if c = $ine_($vsize(V128), c_1, 0) + -- if c = $inez_($vsize(V128), c_1) rule Step_pure/vunop-val: @@ -1023,8 +1023,9 @@ rule Step_pure/vternop-trap: rule Step_pure/vtestop: - (VCONST V128 c_1) (VTESTOP sh vtestop) ~> (CONST I32 i) - -- if i = $vtestop_(sh, vtestop, c_1) + (VCONST V128 c_1) (VTESTOP (Jnn X M) ALL_TRUE) ~> (CONST I32 c) + -- if i* = $lanes_(Jnn X M, c_1) + -- if c = $prod(($inez_($jsizenn(Jnn), i)*)) rule Step_pure/vrelop: diff --git a/specification/wasm-3.0/4.4-execution.modules.spectec b/specification/wasm-3.0/4.4-execution.modules.spectec index 2e3edccb2..cd2122336 100644 --- a/specification/wasm-3.0/4.4-execution.modules.spectec +++ b/specification/wasm-3.0/4.4-execution.modules.spectec @@ -198,6 +198,6 @@ def $instantiate(s, module, externaddr*) = s'; {MODULE moduleinst}; instr_E* ins def $invoke(store, funcaddr, val*) : config def $invoke(s, funcaddr, val*) = s; {MODULE {}}; val* (REF.FUNC_ADDR funcaddr) (CALL_REF s.FUNCS[funcaddr].TYPE) - ---- ---- + ---- -- Expand: s.FUNCS[funcaddr].TYPE ~~ FUNC t_1* -> t_2* -- (Val_ok: s |- val : t_1)* diff --git a/specification/wasm-3.0/5.3-binary.instructions.spectec b/specification/wasm-3.0/5.3-binary.instructions.spectec index 582fb29e5..bd0c75bd5 100644 --- a/specification/wasm-3.0/5.3-binary.instructions.spectec +++ b/specification/wasm-3.0/5.3-binary.instructions.spectec @@ -82,8 +82,8 @@ grammar Binstr/table : instr = ... syntax memidxop = (memidx, memarg) grammar Bmemarg : memidxop = - | n:Bu32 m:Bu32 => (0, {ALIGN n, OFFSET m}) -- if $(n < 2^6) - | n:Bu32 x:Bmemidx m:Bu32 => (x, {ALIGN $((n - 2^6)), OFFSET m}) -- if $(2^6 <= n < 2^7) + | n:Bu32 m:Bu64 => (0, {ALIGN n, OFFSET m}) -- if $(n < 2^6) + | n:Bu32 x:Bmemidx m:Bu64 => (x, {ALIGN $((n - 2^6)), OFFSET m}) -- if $(2^6 <= n < 2^7) grammar Binstr/memory : instr = ... | 0x28 (x,ao):Bmemarg => LOAD I32 x ao diff --git a/specification/wasm-3.0/6.1-text.values.spectec b/specification/wasm-3.0/6.1-text.values.spectec index e93e646fc..41d8a00e2 100644 --- a/specification/wasm-3.0/6.1-text.values.spectec +++ b/specification/wasm-3.0/6.1-text.values.spectec @@ -147,12 +147,12 @@ syntax idctxt hint(desc "identifier context") hint(macro "I" "I%") = LOCALS (name?)* hint(desc "local"), LABELS (name?)* hint(desc "label"), FIELDS ((name?)*)* hint(desc "field"), - TYPEDEFS (subtype?)* hint(desc "type definitions") + TYPEDEFS (deftype?)* hint(desc "type definitions") } syntax I = idctxt -def $concat_idctxt(idctxt*) : idctxt hint(show (++) %2) +def $concat_idctxt(idctxt*) : idctxt hint(show (++) %) def $concat_idctxt(eps) = {} def $concat_idctxt(I I') = I ++ $concat_idctxt(I'*) diff --git a/specification/wasm-3.0/6.2-text.types.spectec b/specification/wasm-3.0/6.2-text.types.spectec index fba18c345..2afedafc9 100644 --- a/specification/wasm-3.0/6.2-text.types.spectec +++ b/specification/wasm-3.0/6.2-text.types.spectec @@ -160,19 +160,21 @@ grammar Texterntype_(I) : (externtype, idctxt) = grammar Ttypeuse_(I)/base : (typeidx, idctxt) = | "(" "type" x:Ttypeidx_(I) ")" => (x, I') ---- - -- if I.TYPEDEFS[x] = SUB FINAL (FUNC t_1* -> t_2*) + -- if I.TYPEDEFS[x] = _DEF (REC st*) i + -- if st*[i] = SUB FINAL (FUNC t_1* -> t_2*) -- if I' = {LOCALS (eps)^(|t_1*|)} | "(" "type" x:Ttypeidx_(I) ")" (t_1,id?)*:Tparam_(I)* t_2*:Tresult_(I)* => (x, I') ---- - -- if I.TYPEDEFS[x] = SUB FINAL (FUNC t_1* -> t_2*) + -- if I.TYPEDEFS[x] = _DEF (REC st*) i + -- if st*[i] = SUB FINAL (FUNC t_1* -> t_2*) -- if I' = {LOCALS (id?)*} -- Idctxt_ok: |- I' : OK | ... grammar Ttypeuse_(I)/abbrev : (typeidx, idctxt) = ... | (t_1,id?)*:Tparam_(I)* t_2*:Tresult_(I)* == "(" "type" x:Ttypeidx_(I) ")" Tparam_(I)* Tresult_(I)* ---- - -- if I.TYPEDEFS[x] = SUB FINAL (FUNC t_1* -> t_2*) - -- (if I.TYPEDEFS[i] =/= SUB FINAL (FUNC t_1* -> t_2*))^(i t_2*))) 0 + -- (if I.TYPEDEFS[i] =/= _DEF (REC (SUB FINAL (FUNC t_1* -> t_2*))) 0)^(i (eps, {LABELS eps} ++ I) - | id:Tid => (id, {LABELS id} ++ I) -- if ~(id <- I.LABELS) + | id:Tid => (id, {LABELS id} ++ I) -- if id (id, {LABELS id} ++ I[.LABELS[x] = eps]) -- if id = I.LABELS[x] @@ -16,7 +16,7 @@ grammar Tinstr_(I) : instr = | in:Tplaininstr_(I) => in | in:Tblockinstr_(I) => in -grammar Tinstrs_(I) : instr* = +grammar Tinstrs_(I)/unfolded : instr* = | in*:Tinstr_(I)* => in* | ... @@ -25,20 +25,20 @@ grammar Tinstrs_(I)/folded : instr* = ... grammar Tfoldedinstr_(I)/plain : instr* = - | "(" in:Tplaininstr_(I) in'*:Tinstrs_(I) ")" => in'* in + | "(" Tplaininstr_(I) Tinstrs_(I) ")" == + Tinstrs_(I) Tplaininstr_(I) | ... grammar Tfoldedinstr_(I)/block : instr* = ... - | "(" "block" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) in*:Tinstrs_(I') ")" => - BLOCK bt in* - | "(" "loop" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) in*:Tinstrs_(I') ")" => - LOOP bt in* - | "(" "if" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) in*:Tinstrs_(I') - "(" "then" in_1*:Tinstrs_(I') ")" - ("(" "else" in_2*:Tinstrs_(I') ")")? ")" => - in* (IF bt in_1* ELSE in_2*) - | "(" "try_table" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) c*:Tcatch_(I)* in*:Tinstrs_(I') ")" => - TRY_TABLE bt c* in* + | "(" "block" Tlabel_(I) Tblocktype_(I) Tinstrs_(I') ")" == + "block" Tlabel_(I) Tblocktype_(I) Tinstrs_(I') "end" + | "(" "loop" Tlabel_(I) Tblocktype_(I) Tinstrs_(I') ")" == + "loop" Tlabel_(I) Tblocktype_(I) Tinstrs_(I') "end" + | "(" "if" Tlabel_(I) Tblocktype_(I) Tfoldedinstr_(I)* + "(" "then" in_1*:Tinstrs_(I') ")" ("(" "else" in_2*:Tinstrs_(I') ")")? ")" == + Tfoldedinstr_(I)* "if" Tlabel_(I) Tblocktype_(I) in_1*:Tinstrs_(I') ("else" in_2*:Tinstrs_(I'))? "end" + | "(" "try_table" Tlabel_(I) Tblocktype_(I) Tcatch_(I)* Tinstrs_(I') ")" == + "try_table" Tlabel_(I) Tblocktype_(I) Tcatch_(I)* Tinstrs_(I') "end" ;; Parametric instructions @@ -47,7 +47,7 @@ grammar Tplaininstr_(I)/parametric : instr = | "unreachable" => UNREACHABLE | "nop" => NOP | "drop" => DROP - | "select" t?:Tresult_(I)? => SELECT t? + | "select" (t*:Tresult_(I)*)? => SELECT (t*)? | ... @@ -55,20 +55,33 @@ grammar Tplaininstr_(I)/parametric : instr = grammar Tblocktype_(I) : blocktype = | t?:Tresult_(I)? => _RESULT t? - | (x,I'):Ttypeuse_(I) => _IDX x -- if I' = {LOCALS (eps)*} + | (x,I'):Ttypeuse_(I) => _IDX x + ---- + -- if I' = {LOCALS (eps)*} -grammar Tblockinstr_(I) : instr = - | "block" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) in*:Tinstrs_(I') "end" id'?:Tid? => - BLOCK bt in* +grammar Tblockinstr_(I)/plain : instr = + | "block" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) + in*:Tinstrs_(I') + "end" id'?:Tid? => BLOCK bt in* + ---- -- if id'? = eps \/ id'? = id? - | "loop" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) in*:Tinstrs_(I') "end" id'?:Tid? => - LOOP bt in* + | "loop" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) + in*:Tinstrs_(I') + "end" id'?:Tid? => LOOP bt in* + ---- -- if id'? = eps \/ id'? = id? - | "if" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) in_1*:Tinstrs_(I') "else" id_1?:Tid? in_2*:Tinstrs_(I') "end" id_2?:Tid? => - IF bt in_1* ELSE in_2* + | "if" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) + in_1*:Tinstrs_(I') + "else" id_1?:Tid? + in_2*:Tinstrs_(I') + "end" id_2?:Tid? => IF bt in_1* ELSE in_2* + ---- -- if (id_1? = eps \/ id_1? = id?) /\ (id_2? = eps \/ id_2? = id?) - | "try_table" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) c*:Tcatch_(I)* in*:Tinstrs_(I') "end" id'?:Tid? => - TRY_TABLE bt c* in* + | "try_table" (id?,I'):Tlabel_(I) bt:Tblocktype_(I) + c*:Tcatch_(I)* + in*:Tinstrs_(I') + "end" id'?:Tid? => TRY_TABLE bt c* in* + ---- -- if id'? = eps \/ id'? = id? | ... @@ -95,7 +108,7 @@ grammar Tplaininstr_(I)/br : instr = ... | "br_on_cast_fail" l:Tlabelidx_(I) rt_1:Treftype_(I) rt_2:Treftype_(I) => BR_ON_CAST_FAIL l rt_1 rt_2 | ... -grammar Tplaininstr_(I)/func : instr = ... +grammar Tplaininstr_(I)/func-plain : instr = ... | "call" x:Tfuncidx_(I) => CALL x | "call_ref" x:Ttypeidx_(I) => CALL_REF $($(_IDX x)) | "call_indirect" x:Ttableidx_(I) (y,I'):Ttypeuse_(I) => CALL_INDIRECT x $($(_IDX y)) @@ -107,7 +120,7 @@ grammar Tplaininstr_(I)/func : instr = ... -- if I' = {LOCALS (eps)*} | ... -grammar Tplaininstr_(I)/func/abbrev : instr = ... +grammar Tplaininstr_(I)/func-abbrev : instr = ... | "call_indirect" Ttypeuse_(I) == "call_indirect" "0" Ttypeuse_(I) | "return_call_indirect" Ttypeuse_(I) == "return_call_indirect" "0" Ttypeuse_(I) | ... @@ -134,7 +147,7 @@ grammar Tplaininstr_(I)/global : instr = ... ;; Table instructions -grammar Tplaininstr_(I)/table : instr = ... +grammar Tplaininstr_(I)/table-plain : instr = ... | "table.get" x:Ttableidx_(I) => TABLE.GET x | "table.set" x:Ttableidx_(I) => TABLE.SET x | "table.size" x:Ttableidx_(I) => TABLE.SIZE x @@ -144,7 +157,7 @@ grammar Tplaininstr_(I)/table : instr = ... | "table.init" x:Ttableidx_(I) y:Telemidx_(I) => TABLE.INIT x y | ... -grammar Tplaininstr_(I)/table/abbrev : instr = ... +grammar Tplaininstr_(I)/table-abbrev : instr = ... | "table.get" == "table.get" "0" | "table.set" == "table.set" "0" | "table.size" == "table.size" "0" @@ -166,14 +179,16 @@ grammar Tmemarg_(N) : memarg = grammar Toffset : u64 = | "offset=" n:Tu64 => n + | eps => 0 grammar Talign_(N) : u64 = | "align=" m:Tu64 => m -- if $(m = 2^n) + | eps => N grammar Tlaneidx : laneidx = | i:Tu8 => i -grammar Tplaininstr_(I)/memory : instr = ... +grammar Tplaininstr_(I)/memory-plain : instr = ... | "i32.load" x:Tmemidx_(I) ao:Tmemarg_(4) => LOAD I32 x ao | "i64.load" x:Tmemidx_(I) ao:Tmemarg_(8) => LOAD I64 x ao | "f32.load" x:Tmemidx_(I) ao:Tmemarg_(4) => LOAD F32 x ao @@ -226,7 +241,7 @@ grammar Tplaininstr_(I)/memory : instr = ... | "memory.init" x:Tmemidx_(I) y:Tdataidx_(I) => MEMORY.INIT x y | ... -grammar Tplaininstr_(I)/memory/abbrev : instr = ... +grammar Tplaininstr_(I)/memory-abbrev : instr = ... | "i32.load" Tmemarg_(4) == "i32.load" "0" Tmemarg_(4) | "i64.load" Tmemarg_(8) == "i64.load" "0" Tmemarg_(8) | "f32.load" Tmemarg_(4) == "f32.load" "0" Tmemarg_(4) @@ -564,20 +579,20 @@ grammar Tplaininstr_(I)/vec-splat : instr = ... | ... grammar Tplaininstr_(I)/vec-lane : instr = ... - | "i8x16.extract_lane_s" l:Tlaneidx => VEXTRACT_LANE (I8 X `16) S l - | "i8x16.extract_lane_u" l:Tlaneidx => VEXTRACT_LANE (I8 X `16) U l - | "i16x8.extract_lane_s" l:Tlaneidx => VEXTRACT_LANE (I16 X `8) S l - | "i16x8.extract_lane_u" l:Tlaneidx => VEXTRACT_LANE (I16 X `8) U l - | "i32x4.extract_lane" l:Tlaneidx => VEXTRACT_LANE (I32 X `4) l - | "i64x2.extract_lane" l:Tlaneidx => VEXTRACT_LANE (I64 X `2) l - | "f32x4.extract_lane" l:Tlaneidx => VEXTRACT_LANE (F32 X `4) l - | "f64x2.extract_lane" l:Tlaneidx => VEXTRACT_LANE (F64 X `2) l - | "i8x16.replace_lane" l:Tlaneidx => VREPLACE_LANE (I8 X `16) l - | "i16x8.replace_lane" l:Tlaneidx => VREPLACE_LANE (I16 X `8) l - | "i32x4.replace_lane" l:Tlaneidx => VREPLACE_LANE (I32 X `4) l - | "i64x2.replace_lane" l:Tlaneidx => VREPLACE_LANE (I64 X `2) l - | "f32x4.replace_lane" l:Tlaneidx => VREPLACE_LANE (F32 X `4) l - | "f64x2.replace_lane" l:Tlaneidx => VREPLACE_LANE (F64 X `2) l + | "i8x16.extract_lane_s" i:Tlaneidx => VEXTRACT_LANE (I8 X `16) S i + | "i8x16.extract_lane_u" i:Tlaneidx => VEXTRACT_LANE (I8 X `16) U i + | "i16x8.extract_lane_s" i:Tlaneidx => VEXTRACT_LANE (I16 X `8) S i + | "i16x8.extract_lane_u" i:Tlaneidx => VEXTRACT_LANE (I16 X `8) U i + | "i32x4.extract_lane" i:Tlaneidx => VEXTRACT_LANE (I32 X `4) i + | "i64x2.extract_lane" i:Tlaneidx => VEXTRACT_LANE (I64 X `2) i + | "f32x4.extract_lane" i:Tlaneidx => VEXTRACT_LANE (F32 X `4) i + | "f64x2.extract_lane" i:Tlaneidx => VEXTRACT_LANE (F64 X `2) i + | "i8x16.replace_lane" i:Tlaneidx => VREPLACE_LANE (I8 X `16) i + | "i16x8.replace_lane" i:Tlaneidx => VREPLACE_LANE (I16 X `8) i + | "i32x4.replace_lane" i:Tlaneidx => VREPLACE_LANE (I32 X `4) i + | "i64x2.replace_lane" i:Tlaneidx => VREPLACE_LANE (I64 X `2) i + | "f32x4.replace_lane" i:Tlaneidx => VREPLACE_LANE (F32 X `4) i + | "f64x2.replace_lane" i:Tlaneidx => VREPLACE_LANE (F64 X `2) i | ... grammar Tplaininstr_(I)/vec-test-v128 : instr = ... diff --git a/specification/wasm-3.0/6.3-text.modules.spectec b/specification/wasm-3.0/6.3-text.modules.spectec index 18d610039..48e877ad8 100644 --- a/specification/wasm-3.0/6.3-text.modules.spectec +++ b/specification/wasm-3.0/6.3-text.modules.spectec @@ -7,7 +7,7 @@ grammar Ttype_(I) : (type, idctxt) = | (qt,I'):Trectype_(I) => (TYPE qt, I' ++ I'') -- if qt = REC st^n - -- if n = 1 /\ I'' = {TYPEDEFS st} \/ n =/= 1 /\ I'' = {TYPEDEFS eps^n} + -- if I'' = {TYPEDEFS (_DEF qt i)^(i (TABLE tt e, {TABLES (id?)}) | ... grammar Ttable_(I)/abbrev : (table, idctxt) = ... | "(" "table" Tid? tt:Ttabletype_(I) ")" == "(" "table" Tid? tt:Ttabletype_(I) "(" "ref.null" ht:Theaptype_(I) ")" ")" + ---- -- if tt = at lim (REF NULL? ht) ;; Functions grammar Tfunc_(I) : (func, idctxt) = - | "(" "func" id?:Tid? (x,I_1):Ttypeuse_(I) ((loc*,I_2):Tlocal_(I))* e:Texpr_(I') ")" => (FUNC x $concat_(local, loc**) e, {FUNCS (id?)}) + | "(" "func" id?:Tid? (x,I_1):Ttypeuse_(I) ((loc*,I_2):Tlocal_(I))* e:Texpr_(I') ")" => + (FUNC x ($concat_(local, loc**)) e, {FUNCS (id?)}) + ---- -- if I' = I ++ I_1 ++ $concat_idctxt(I_2*) -- Idctxt_ok: |- I' : OK -grammar Tlocal_(I) : (local*, idctxt) = - | "(" "local" id?:Tid? t:Tvaltype_(I) ")" => (LOCAL t, {LOCALS (id?)}) +grammar Tlocal_(I)/plain : (local*, idctxt) = + | "(" "local" id?:Tid? t:Tvaltype_(I) ")" => + (LOCAL t, {LOCALS (id?)}) | ... -grammar Tlocal_(I)/abbrev : (local*, idctxt) = ... - | "(" "local" t:Tvaltype_(I)* ")" == ("(" "local" t:Tvaltype_(I) ")")* +grammar Tlocal_(I)/abbrev : (local*, idctxt) = + ... | "(" "local" t:Tvaltype_(I)* ")" == ("(" "local" t:Tvaltype_(I) ")")* ;; Data segments grammar Tdata_(I) : (data, idctxt) = - | "(" "data" id?:Tid? b*:Tdatastring ")" => (DATA b* PASSIVE, {DATAS (id?)}) - | "(" "data" id?:Tid? b*:Tdatastring x:Tmemuse_(I) e:Toffset_(I) ")" => (DATA b* (ACTIVE x e), {DATAS (id?)}) + | "(" "data" id?:Tid? b*:Tdatastring ")" => + (DATA b* PASSIVE, {DATAS (id?)}) + | "(" "data" id?:Tid? x:Tmemuse_(I) e:Toffset_(I) b*:Tdatastring ")" => + (DATA b* (ACTIVE x e), {DATAS (id?)}) grammar Tdatastring : byte* = | b**:Tstring* => $concat_(byte, b**) -grammar Tmemuse_(I) : memidx = +grammar Tmemuse_(I)/plain : memidx = | "(" "memory" x:Tmemidx_(I) ")" => x | ... -grammar Tmemuse_(I)/abbrev : memidx = ... - | eps => 0 +grammar Tmemuse_(I)/abbrev : memidx = + ... | eps == "(" "memory" "0" ")" -grammar Toffset_(I) : expr = +grammar Toffset_(I)/plain : expr = | "(" "offset" e:Texpr_(I) ")" => e | ... -grammar Toffset_(I)/abbrev : expr = ... - | Tfoldedinstr_(I) == "(" "offset" Tfoldedinstr_(I) ")" +grammar Toffset_(I)/abbrev : expr = + ... | Tfoldedinstr_(I) == "(" "offset" Tfoldedinstr_(I) ")" ;; Element segments -grammar Telem_(I) : (elem, idctxt) = - | "(" "elem" id?:Tid? (rt,e*):Telemlist_(I) ")" => (ELEM rt e* PASSIVE, {ELEMS (id?)}) - | "(" "elem" id?:Tid? (rt,e*):Telemlist_(I) x:Ttableuse_(I) e':Toffset_(I) ")" => (ELEM rt e* (ACTIVE x e'), {ELEMS (id?)}) - | "(" "elem" id?:Tid? "declare" (rt,e*):Telemlist_(I) ")" => (ELEM rt e* DECLARE, {ELEMS (id?)}) +grammar Telem_(I)/plain : (elem, idctxt) = + | "(" "elem" id?:Tid? (rt,e*):Telemlist_(I) ")" => + (ELEM rt e* PASSIVE, {ELEMS (id?)}) + | "(" "elem" id?:Tid? x:Ttableuse_(I) e':Toffset_(I) (rt,e*):Telemlist_(I) ")" => + (ELEM rt e* (ACTIVE x e'), {ELEMS (id?)}) + | "(" "elem" id?:Tid? "declare" (rt,e*):Telemlist_(I) ")" => + (ELEM rt e* DECLARE, {ELEMS (id?)}) + | ... -grammar Telemlist_(I) : (reftype, expr*) = +grammar Telem_(I)/abbrev : (elem, idctxt) = ... + | "(" "elem" e':Toffset_(I) Tlist(Tfuncidx_(I)) ")" == + "(" "elem" e':Toffset_(I) "func" Tlist(Tfuncidx_(I)) ")" + +grammar Telemlist_(I)/plain : (reftype, expr*) = | rt:Treftype_(I) e*:Tlist(Texpr_(I)) => (rt, e*) | ... -grammar Telemlist_(I)/abbrev : (reftype, expr*) = ... - | "func" x*:Tfuncidx_(I)* == - "(" "ref" "func" ")" ("(" "ref.func" Tfuncidx_(I) ")")* +grammar Telemlist_(I)/abbrev : (reftype, expr*) = + ... | "func" x*:Tfuncidx_(I)* == "(" "ref" "func" ")" ("(" "ref.func" Tfuncidx_(I) ")")* -grammar Telemexpr_(I) : expr = +grammar Telemexpr_(I)/plain : expr = | "(" "item" e:Texpr_(I) ")" => e | ... -grammar Telemexpr_(I)/abbrev : expr = ... - | Tfoldedinstr_(I) == "(" "item" Tfoldedinstr_(I) ")" +grammar Telemexpr_(I)/abbrev : expr = + ... | Tfoldedinstr_(I) == "(" "item" Tfoldedinstr_(I) ")" -grammar Ttableuse_(I) : tableidx = +grammar Ttableuse_(I)/plain : tableidx = | "(" "table" x:Ttableidx_(I) ")" => x | ... -grammar Ttableuse_(I)/abbrev : tableidx = ... - | eps => 0 +grammar Ttableuse_(I)/abbrev : tableidx = + ... | eps == "(" "table" "0" ")" ;; Start functions @@ -117,19 +130,31 @@ grammar Tstart_(I) : (start, idctxt) = ;; Imports -grammar Timport_(I) : (import, idctxt) = +grammar Timport_(I)/plain : (import, idctxt) = | "(" "import" nm_1:Tname nm_2:Tname (xt,I'):Texterntype_(I) ")" => (IMPORT nm_1 nm_2 xt, I') | ... -grammar Timport_(I)/abbrev : (import, idctxt) = ... +grammar Timport_(I)/abbrev-tag : (import, idctxt) = ... | "(" "tag" Tid? "(" "import" Tname^2 ")" Ttagtype_(I) ")" == "(" "import" Tname^2 "(" "tag" Tid? Ttagtype_(I) ")" ")" + | ... + +grammar Timport_(I)/abbrev-global : (import, idctxt) = ... | "(" "global" Tid? "(" "import" Tname^2 ")" Tglobaltype_(I) ")" == "(" "import" Tname^2 "(" "global" Tid? Tglobaltype_(I) ")" ")" + | ... + +grammar Timport_(I)/abbrev-mem : (import, idctxt) = ... | "(" "memory" Tid? "(" "import" Tname^2 ")" Tmemtype_(I) ")" == "(" "import" Tname^2 "(" "memory" Tid? Tmemtype_(I) ")" ")" + | ... + +grammar Timport_(I)/abbrev-table : (import, idctxt) = ... | "(" "table" Tid? "(" "import" Tname^2 ")" Ttabletype_(I) ")" == "(" "import" Tname^2 "(" "table" Tid? Ttabletype_(I) ")" ")" + | ... + +grammar Timport_(I)/abbrev-func : (import, idctxt) = ... | "(" "func" Tid? "(" "import" Tname^2 ")" Ttypeuse_(I) ")" == "(" "import" Tname^2 "(" "func" Tid? Ttypeuse_(I) ")" ")" @@ -142,21 +167,27 @@ grammar Texport_(I) : (export, idctxt) = grammar Texportdots = "(" "export" Tname ")" grammar Timportdots = "(" "import" Tname Tname ")" -grammar Texporttagdots_(I) hint(show `...) = +def $dots : () hint(show `...) ;; Hack + +grammar Texporttagdots_(I) hint(show $dots) = | Texportdots* Ttagtype_(I) | Texportdots* Timportdots Ttagtype_(I) -grammar Texportglobaldots_(I) hint(show `...) = + +grammar Texportglobaldots_(I) hint(show $dots) = | Texportdots* Tglobaltype_(I) Texpr_(I) | Texportdots* Timportdots Tglobaltype_(I) -grammar Texportmemorydots_(I) hint(show `...) = + +grammar Texportmemdots_(I) hint(show $dots) = | Texportdots* Tmemtype_(I) | Texportdots* Taddrtype? "(" "data" Tdatastring ")" | Texportdots* Timportdots Tmemtype_(I) -grammar Texporttabledots_(I) hint(show `...) = + +grammar Texporttabledots_(I) hint(show $dots) = | Texportdots* Ttabletype_(I) Texpr_(I)? | Texportdots* Taddrtype? Treftype_(I) "(" "elem" Telemlist_(I) ")" | Texportdots* Timportdots Ttabletype_(I) -grammar Texportfuncdots_(I) hint(show `...) = + +grammar Texportfuncdots_(I) hint(show $dots) = | Texportdots* Ttypeuse_(I) Tlocal_(I)* Texpr_(I) | Texportdots* Timportdots Ttypeuse_(I) @@ -164,64 +195,65 @@ grammar Texportfuncdots_(I) hint(show `...) = ;; TODO(5, rossberg): These abbreviations are currently not formally reachable ;; and their types don't match up with anything. -grammar Texporttag_(I)/abbrev : () = +grammar Texporttag_(I)/abbrev : () hint(show Texport_(%)) = | "(" "tag" id?:Tid? "(" "export" Tname ")" Texporttagdots_(I) ")" == "(" "tag" id':Tid Texporttagdots_(I) ")" "(" "export" Tname "(" "tag" Tid ")" ")" ---- - -- if id? = id' \/ id? = eps /\ ~(id' <- I.TAGS) + -- if id? = id' \/ id? = eps /\ id' MODULE type* import* tag* global* mem* table* func* data* elem* start? export* + ---- -- if I' = $concat_idctxt(I*) -- Idctxt_ok: |- I' : OK -- if type* = $typesd(decl*) @@ -311,5 +344,7 @@ grammar Tmodule : module = -- if $ordered(decl*) | ... -grammar Tmodule/abbrev : module = ... - | Tdecl_(I)* == "(" "module" Tdecl_(I)* ")" +grammar Tmodule/abbrev : module = + ... | Tdecl_(I)* == "(" "module" Tdecl_(I)* ")" + +grammar Tdecldots_(I) : (decl, idctxt)* hint(show $dots) = Tdecl_(I)* diff --git a/spectec/Makefile b/spectec/Makefile index 93c12961f..1de56e6b1 100644 --- a/spectec/Makefile +++ b/spectec/Makefile @@ -92,6 +92,9 @@ spec: spec-pdf: (cd ../document/core && make pdf) +spec-html: + (cd ../document/core && make html) + spec-clean: (cd ../document/core && make clean) @@ -105,10 +108,7 @@ clean: rm -f src/frontend/parser.{automaton,conflicts} for dir in $(TESTDIRS); do (cd $$dir && make clean); done -distclean: clean +distclean: clean spec-clean rm -f ./$(NAME) rm -rf $(CLONEDIR) for dir in $(TESTDIRS); do (cd $$dir && make distclean); done - -specclean: - (cd ../document/core && make clean) diff --git a/spectec/doc/Language.md b/spectec/doc/Language.md index 8be8110c2..b26cee6e9 100644 --- a/spectec/doc/Language.md +++ b/spectec/doc/Language.md @@ -236,22 +236,22 @@ not administrative ones. In addition to the basic grammar shown above, definitions of syntax variants can also be split into multiple _fragments_: ``` -def ::= - "syntax" varid subid* "=" deftyp-frag syntax fragment definition +deftyp ::= ... + deftyp-frag syntax fragment definition deftyp-frag ::= "..." ("..." "|")? casetyp*"|" ("|" "...")? variant fragment ``` A variant with dots "..." at the end can be extended further by later variant definitions of the same name. -This definition must start with dots, accordingly. +These definitions must start with dots, accordingly. A variant is completed by a fragment without trailing dots. Each fragment must be named uniquely by amending the type name with a (possibly empty) list of hierarchical sub-identifiers of the form `x/y`, which can be used to refer to a fragment from splices. Currently, variant types defined in fragments cannot have parameters. **Example:** -The instruction syntax above could be defined in two fragments: +The instruction syntax above could be defined in multiple fragments: ``` syntax instr/stack = DROP | ... syntax instr/arith = ... | CONST numtyp const | ... @@ -297,6 +297,32 @@ syntax person = {NAME text, AGE nat, ADDRESS text} SpecTec provides special syntax for accessing values of record type, in particular, dot notation for field access. +In addition to the basic grammar shown above, +like [variant types](#variant-types), +definitions of record syntax can also be split into multiple _fragments_: +``` +deftyp-frag ::= + "{" "..." "}" + "{" ("..." ",")? fieldtyp*"," (...")? "}" record fragment +``` +A record with dots "..." at the end can be extended further by later record definitions of the same name. +These definitions must start with dots, accordingly. +A record is completed by a fragment without trailing dots. +Each fragment must be named uniquely by amending the type name with a (possibly empty) list of hierarchical sub-identifiers of the form `x/y`, +which can be used to refer to a fragment from splices. +Currently, record types defined in fragments cannot have parameters. + +**Example:** +The person record above could be defined in multiple fragments: +``` +syntax person/name = { NAME text, ... } +syntax person/age = { ..., AGE nat, ... } +syntax person/address = { ..., ADDRESS text } +``` + +Semantically, a record definition split into fragments is equivalent to a combined one. +Splitting a definition only has organisational purpose. + ##### Premises diff --git a/spectec/doc/Latex.md b/spectec/doc/Latex.md index 9dfd20904..21003ac82 100644 --- a/spectec/doc/Latex.md +++ b/spectec/doc/Latex.md @@ -178,7 +178,7 @@ will render as | reftype ``` -The description is also used in [prose](Prose.md) geenration. +The description is also used in [prose](Prose.md) generation. #### Name hints (`name`) diff --git a/spectec/doc/example/output/NanoWasm.pdf b/spectec/doc/example/output/NanoWasm.pdf index addc3664b..dc68f04ec 100644 Binary files a/spectec/doc/example/output/NanoWasm.pdf and b/spectec/doc/example/output/NanoWasm.pdf differ diff --git a/spectec/src/al/ast.ml b/spectec/src/al/ast.ml index 63b5af589..1f51f2b4e 100644 --- a/spectec/src/al/ast.ml +++ b/spectec/src/al/ast.ml @@ -89,7 +89,7 @@ and expr' = (* Conditions *) | IsCaseOfE of expr * atom (* expr is atom *) | IsValidE of expr (* expr is valid *) - | ContextKindE of atom (* "the fisrt non-value entry of the stack is a" atom *) + | ContextKindE of atom (* "the first non-value entry of the stack is a" atom *) | IsDefinedE of expr (* expr is defined *) | MatchE of expr * expr (* expr matches expr *) | HasTypeE of expr * typ (* expr is ty *) diff --git a/spectec/src/backend-interpreter/runner.ml b/spectec/src/backend-interpreter/runner.ml index a4d901d0e..80ba6b6c0 100644 --- a/spectec/src/backend-interpreter/runner.ml +++ b/spectec/src/backend-interpreter/runner.ml @@ -85,9 +85,12 @@ let print_runner_result name result = in if name = "Total" then - Printf.printf "Total [%d/%d] (%.2f%%)\n\n" num_success total percentage - else - Printf.printf "- %d/%d (%.2f%%)\n\n" num_success total percentage; + log "Total [%d/%d] (%.2f%%)\n\n" num_success total percentage + else ( + log "- %d/%d (%.2f%%)\n\n" num_success total percentage; + if num_success < total then + Printf.printf "Test failed for %s\n" name + ); log "%s took %f ms.\n" name (execution_time *. 1000.) let get_export name modulename = @@ -306,7 +309,6 @@ let run_wat = run_wasm (** Parse **) let parse_file name parser_ file = - Printf.printf "===== %s =====\n%!" name; log "===========================\n\n%s\n\n" name; try diff --git a/spectec/src/backend-latex/render.ml b/spectec/src/backend-latex/render.ml index 658d77ab8..4434e93cb 100644 --- a/spectec/src/backend-latex/render.ml +++ b/spectec/src/backend-latex/render.ml @@ -288,9 +288,15 @@ let env_typdef env tid t : typ list option = | VarT (id, _) -> map_append tid.it (Map.find id.it !(env.atoms)) env.atoms; Some [t] - | StrT tfs -> + | StrT (dots1, ts, tfs, _) -> iter_nl_list (env_typfield env tid) tfs; - Some [] + iter_nl_list (fun t -> + match t.it with + | VarT (id, _) -> + map_append tid.it (Map.find id.it !(env.atoms)) env.atoms + | _ -> () + ) ts; + if dots1 = Dots && ts = [] then None else Some (filter_nl ts) | CaseT (dots1, ts, tcs, _) -> iter_nl_list (env_typcase env tid) tcs; iter_nl_list (fun t -> @@ -1081,7 +1087,7 @@ Printf.eprintf "[render_atom %s @ %s] id=%s def=%s macros: %s (%s)\n%!" let render_text s = let buf = Buffer.create (String.length s + 32) in - Buffer.add_string buf "\\mbox{‘}\\mathtt{"; + Buffer.add_string buf "\\mbox{‘\\texttt{"; for i = 0 to String.length s - 1 do match s.[i] with | '\'' -> Buffer.add_string buf "\\kern0.03em{'}\\kern0.03em" (* TODO: not typeset in TT *) @@ -1091,18 +1097,23 @@ let render_text s = | '%' -> Buffer.add_string buf "\\%" | '&' -> Buffer.add_string buf "\\&" | '_' -> Buffer.add_string buf "\\_" - | '-' -> Buffer.add_string buf "\\mbox{-}" - | '{' -> Buffer.add_string buf "\\{" (* TODO: not typeset in TT *) - | '}' -> Buffer.add_string buf "\\}" (* TODO: not typeset in TT *) + | '=' -> Buffer.add_string buf "{=}" + | '<' -> Buffer.add_string buf "{<}" + | '>' -> Buffer.add_string buf "{>}" + | '-' -> Buffer.add_string buf "{-}" + | '(' -> Buffer.add_string buf "{(}" + | ')' -> Buffer.add_string buf "{)}" + | '{' -> Buffer.add_string buf "{\\{}" + | '}' -> Buffer.add_string buf "{\\}}" | '[' -> Buffer.add_string buf "{[}" | ']' -> Buffer.add_string buf "{]}" - | '\\' -> Buffer.add_string buf "\\backslash{}" (* TODO: not typeset in TT *) - | '^' -> Buffer.add_string buf "\\hat{~~}" - | '`' -> Buffer.add_string buf "\\grave{~~}" - | '~' -> Buffer.add_string buf "\\tilde{~~}" + | '\\' -> Buffer.add_string buf "\\(\\mathtt{\\backslash}\\)" (* TODO: not typeset in TT *) + | '^' -> Buffer.add_string buf "\\(\\mathtt{\\hat{~~}}\\)" + | '`' -> Buffer.add_string buf "\\(\\mathtt{\\grave{~~}}\\)" + | '~' -> Buffer.add_string buf "\\(\\mathtt{\\tilde{~~}}\\)" | c -> Buffer.add_char buf c done; - Buffer.add_string buf "}\\mbox{’}"; + Buffer.add_string buf "}’}"; Buffer.contents buf @@ -1163,13 +1174,23 @@ and render_nottyp env t : table = (string_of_region t.at) (El.Print.string_of_typ t); *) match t.it with - | StrT tfs -> + | StrT (dots1, ts, tfs, _dots2) -> + let render env = function + | `Dots -> render_dots Dots + | `Typ t -> render_nottyp env t + | `TypField tf -> render_typfield env tf + in [Row [Col ( "\\{ " ^ render_table env "@{}" ["l"; "l"] 0 0 - (concat_table "" (render_nl_list env (`H, ", ") render_typfield tfs) [Row [Col " \\}"]]) + (concat_table "" (render_nl_list env (`H, ", ") render ( + (match dots1 with Dots -> [Elem `Dots] | NoDots -> []) @ + map_nl_list (fun t -> `Typ t) ts @ + map_nl_list (fun tf -> `TypField tf) tfs @ + [] (* (match dots2 with Dots -> [Elem `Dots] | NoDots -> []) *) + )) [Row [Col " \\}"]]) )]] - | CaseT (dots1, ts, tcs, dots2) -> + | CaseT (dots1, ts, tcs, _dots2) -> let render env = function | `Dots -> render_dots Dots | `Typ t -> render_nottyp env t @@ -1180,7 +1201,7 @@ and render_nottyp env t : table = (match dots1 with Dots -> [Elem `Dots] | NoDots -> []) @ map_nl_list (fun t -> `Typ t) ts @ map_nl_list (fun tc -> `TypCase tc) tcs @ - (match dots2 with Dots -> [Elem `Dots] | NoDots -> []) + [] (* (match dots2 with Dots -> [Elem `Dots] | NoDots -> []) *) ) in if env.config.display then @@ -1260,6 +1281,8 @@ and render_exp env e = | NumE _ -> assert false | TextE t -> render_text t | CvtE (e1, _) -> render_exp env e1 + | UnE (`NotOp, {it = MemE (e1, e2); _}) -> + render_exp env e1 ^ " \\notin " ^ render_exp env e2 | UnE (op, e2) -> "{" ^ render_unop op ^ render_exp env e2 ^ "}" | BinE (e1, `PowOp, ({it = ParenE e2; _ } | e2)) -> "{" ^ render_exp env e1 ^ "^{" ^ render_exp env e2 ^ "}}" @@ -1608,7 +1631,7 @@ and render_prod env prod : row list = ) and render_gram env gram : table = - let (dots1, prods, dots2) = gram.it in + let (dots1, prods, _dots2) = gram.it in let singleline = List.length prods > 1 && gram.at.left.line = gram.at.right.line || List.exists (function (Elem {it = RangeP _; _}) -> true | _ -> false) prods @@ -1626,7 +1649,7 @@ and render_gram env gram : table = render_nl_list env (`H, "~~|~~") render ( (match dots1 with Dots -> [Elem `Dots] | NoDots -> []) @ map_nl_list (fun p -> `Prod p) prods @ - (match dots2 with Dots -> [Elem `Dots] | NoDots -> []) + [] (* (match dots2 with Dots -> [Elem `Dots] | NoDots -> []) *) ) in if env.config.display then diff --git a/spectec/src/backend-prose/gen.ml b/spectec/src/backend-prose/gen.ml index 65630a805..4c88ce6b0 100644 --- a/spectec/src/backend-prose/gen.ml +++ b/spectec/src/backend-prose/gen.ml @@ -339,6 +339,14 @@ let rec prem_to_instrs prem = let s = Il.Print.string_of_prem prem in print_yet_prem prem "prem_to_instrs"; [ YetS s ] +let extract_args rule = + match rule.it with + | Ast.RuleD (_, _, _, exp, _) -> + match exp.it with + | Ast.TupE es -> es + | _ -> [exp] + + let extract_single_rule rule = match rule.it with | Ast.RuleD (_, _, _, exp, _) -> @@ -542,11 +550,26 @@ let proses_of_defaultable_rel cmpop = proses_of_rel (fun rule -> IsDefaultableS (exp_to_expr e, cmpop)) (** 9. Others **) -let proses_of_other_rel rel = ( match rel.it with +let proses_of_other_rel rel = + match rel.it with | Ast.RelD (rel_id, mixop, args, _) -> - "Untranslated relation " ^ rel_id.it ^ ": " ^ Print.string_of_mixop mixop ^ Print.string_of_typ args |> print_endline; - | _ -> ()); - [] + (match extract_rel_hint rel_id "prose" with + | Some hint -> + (* Relation with prose hint *) + proses_of_rel (fun rule -> + let args = extract_args rule in + RelS (hint, List.map exp_to_expr args) + ) rel + | None -> + "Untranslated relation " + ^ rel_id.it + ^ ": " + ^ Print.string_of_mixop mixop + ^ Print.string_of_typ args + |> print_endline; + [] + ) + | _ -> assert false (* RelD expected *) let prose_of_rel rel = match get_rel_kind rel with | ValidRel -> proses_of_valid_rel rel diff --git a/spectec/src/backend-prose/print.ml b/spectec/src/backend-prose/print.ml index a7d6a4c98..806f26958 100644 --- a/spectec/src/backend-prose/print.ml +++ b/spectec/src/backend-prose/print.ml @@ -86,6 +86,8 @@ and string_of_expr expr = sprintf "%s does not match %s" (string_of_expr e1) (string_of_expr e2) | UnE (`NotOp, { it = MemE (e1, e2); _ }) -> sprintf "%s is not contained in %s" (string_of_expr e1) (string_of_expr e2) + | UnE (`NotOp, { it = ContextKindE a; _ }) -> + sprintf "the first non-value entry of the stack is not a %s" (string_of_atom a) | UnE (`NotOp, e) -> sprintf "not %s" (string_of_expr e) | UnE (op, e) -> sprintf "(%s %s)" (string_of_unop op) (string_of_expr e) | BinE (op, e1, e2) -> diff --git a/spectec/src/backend-prose/prose_util.ml b/spectec/src/backend-prose/prose_util.ml index b612c7fa4..263465b41 100644 --- a/spectec/src/backend-prose/prose_util.ml +++ b/spectec/src/backend-prose/prose_util.ml @@ -84,7 +84,7 @@ let env_hintdef ?(partial = false) hd = let env_typ id t = let open El.Ast in match t.it with - | El.Ast.StrT l -> + | El.Ast.StrT (_, _, l, _) -> List.iter (function | Nl -> () | Elem (atom, _, hints) -> diff --git a/spectec/src/backend-prose/render.ml b/spectec/src/backend-prose/render.ml index 098fbed44..aa34ec1b2 100644 --- a/spectec/src/backend-prose/render.ml +++ b/spectec/src/backend-prose/render.ml @@ -628,6 +628,9 @@ and render_expr' env expr = let se1 = render_expr env e1 in let se2 = render_expr env e2 in sprintf "%s is not contained in %s" se1 se2 + | Al.Ast.UnE (`NotOp, { it = Al.Ast.ContextKindE a; _ }) -> + let sa = render_atom env a in + sprintf "the first non-value entry of the stack is not a %s" sa | Al.Ast.UnE (op, e) -> let sop = render_al_unop op in let se = render_expr env e in diff --git a/spectec/src/backend-splice/splice.ml b/spectec/src/backend-splice/splice.ml index 673cc8087..4704a157b 100644 --- a/spectec/src/backend-splice/splice.ml +++ b/spectec/src/backend-splice/splice.ml @@ -41,7 +41,7 @@ let try_with_error src i f x = { file = src.file; line = line + pos.line - 1; column = if line = 1 then column + pos.column - 1 else column} in let at' = {left = shift at.left; right = shift at.right} in -Printexc.print_backtrace stdout; + Printexc.print_backtrace stdout; raise (Error.Error (at', msg)) diff --git a/spectec/src/el/ast.ml b/spectec/src/el/ast.ml index c25f380cb..b56ee187a 100644 --- a/spectec/src/el/ast.ml +++ b/spectec/src/el/ast.ml @@ -46,7 +46,7 @@ and typ' = | TupT of typ list (* `(` list2(typ, `,`) `)` *) | IterT of typ * iter (* typ iter *) (* The forms below are only allowed in type definitions *) - | StrT of typfield nl_list (* `{` list(typfield,`,`') `}` *) + | StrT of dots * typ nl_list * typfield nl_list * dots (* `{` list(`...`|typ|typfield, `,`) `}` *) | CaseT of dots * typ nl_list * typcase nl_list * dots (* `|` list(`...`|typ|typcase, `|`) *) | ConT of typcon (* typ prem* *) | RangeT of typenum nl_list (* exp `|` `...` `|` exp *) diff --git a/spectec/src/el/convert.ml b/spectec/src/el/convert.ml index 39d9be46d..f3464870c 100644 --- a/spectec/src/el/convert.ml +++ b/spectec/src/el/convert.ml @@ -71,7 +71,7 @@ let rec typ_of_exp e = | ParenE e1 -> ParenT (typ_of_exp e1) | TupE es -> TupT (List.map typ_of_exp es) | IterE (e1, iter) -> IterT (typ_of_exp e1, iter) - | StrE efs -> StrT (map_nl_list typfield_of_expfield efs) + | StrE efs -> StrT (NoDots, [], map_nl_list typfield_of_expfield efs, NoDots) | AtomE atom -> AtomT atom | SeqE es -> SeqT (List.map typ_of_exp es) | InfixE (e1, atom, e2) -> InfixT (typ_of_exp e1, atom, typ_of_exp e2) @@ -90,12 +90,12 @@ let rec exp_of_typ t = | ParenT t1 -> ParenE (exp_of_typ t1) | TupT ts -> TupE (List.map exp_of_typ ts) | IterT (t1, iter) -> IterE (exp_of_typ t1, iter) - | StrT tfs -> StrE (map_nl_list expfield_of_typfield tfs) + | StrT (NoDots, [], tfs, NoDots) -> StrE (map_nl_list expfield_of_typfield tfs) | AtomT atom -> AtomE atom | SeqT ts -> SeqE (List.map exp_of_typ ts) | InfixT (t1, atom, t2) -> InfixE (exp_of_typ t1, atom, exp_of_typ t2) | BrackT (l, t1, r) -> BrackE (l, exp_of_typ t1, r) - | CaseT _ | ConT _ | RangeT _ -> error t.at "malformed expression" + | StrT _ | CaseT _ | ConT _ | RangeT _ -> error t.at "malformed expression" ) $ t.at and expfield_of_typfield (atom, (t, _prems), _) = diff --git a/spectec/src/el/eq.ml b/spectec/src/el/eq.ml index 93cb6db30..f012ed66a 100644 --- a/spectec/src/el/eq.ml +++ b/spectec/src/el/eq.ml @@ -47,7 +47,9 @@ and eq_typ t1 t2 = | TupT ts1, TupT ts2 -> eq_list eq_typ ts1 ts2 | IterT (t11, iter1), IterT (t21, iter2) -> eq_typ t11 t21 && eq_iter iter1 iter2 - | StrT tfs1, StrT tfs2 -> eq_nl_list eq_typfield tfs1 tfs2 + | StrT (dots11, ts1, tfs1, dots12), StrT (dots21, ts2, tfs2, dots22) -> + dots11 = dots21 && eq_nl_list eq_typ ts1 ts2 && + eq_nl_list eq_typfield tfs1 tfs2 && dots12 = dots22 | CaseT (dots11, ts1, tcs1, dots12), CaseT (dots21, ts2, tcs2, dots22) -> dots11 = dots21 && eq_nl_list eq_typ ts1 ts2 && eq_nl_list eq_typcase tcs1 tcs2 && dots12 = dots22 diff --git a/spectec/src/el/free.ml b/spectec/src/el/free.ml index 8fa9db6b2..731441e95 100644 --- a/spectec/src/el/free.ml +++ b/spectec/src/el/free.ml @@ -102,8 +102,9 @@ and free_typ t = | ParenT t1 -> free_typ t1 | TupT ts -> free_list free_typ ts | IterT (t1, iter) -> free_typ t1 + free_iter iter - | StrT tfs -> - free_nl_list (fun tf -> free_typfield tf - det_typfield tf) tfs + | StrT (_, ts, tfs, _) -> + free_nl_list free_typ ts + + free_nl_list (fun tf -> free_typfield tf - det_typfield tf) tfs | CaseT (_, ts, tcs, _) -> free_nl_list free_typ ts + free_nl_list (fun tc -> free_typcase tc - det_typcase tc) tcs diff --git a/spectec/src/el/iter.ml b/spectec/src/el/iter.ml index a9644a53d..521a0c8c0 100644 --- a/spectec/src/el/iter.ml +++ b/spectec/src/el/iter.ml @@ -100,7 +100,8 @@ and typ t = | ParenT t1 -> typ t1 | TupT ts -> list typ ts | IterT (t1, it) -> typ t1; iter it - | StrT tfs -> nl_list typfield tfs + | StrT (dots1, ts, tfs, dots2) -> + dots dots1; nl_list typ ts; nl_list typfield tfs; dots dots2 | CaseT (dots1, ts, tcs, dots2) -> dots dots1; nl_list typ ts; nl_list typcase tcs; dots dots2 | ConT tc -> typcon tc @@ -263,7 +264,7 @@ and clone_typ t = | SeqT ts -> SeqT (List.map clone_typ ts) | InfixT (t1, atom, t2) -> InfixT (clone_typ t1, clone_atom atom, clone_typ t2) | BrackT (atom1, t1, atom2) -> BrackT (clone_atom atom1, clone_typ t1, clone_atom atom2) - | StrT tfs -> StrT (Convert.map_nl_list clone_typfield tfs) + | StrT (dots1, ts, tfs, dots2) -> StrT (dots1, Convert.map_nl_list clone_typ ts, Convert.map_nl_list clone_typfield tfs, dots2) | CaseT (dots1, ts, tcs, dots2) -> CaseT (dots1, Convert.map_nl_list clone_typ ts, Convert.map_nl_list clone_typcase tcs, dots2) | ConT tc -> ConT (clone_typcon tc) | RangeT tes -> RangeT (Convert.map_nl_list clone_typenum tes) diff --git a/spectec/src/el/print.ml b/spectec/src/el/print.ml index 94686365f..37252b052 100644 --- a/spectec/src/el/print.ml +++ b/spectec/src/el/print.ml @@ -78,10 +78,20 @@ and string_of_typ ?(short=false) t = | ParenT t -> "(" ^ string_of_typ t ^ ")" | TupT ts -> "(" ^ string_of_typs ", " ts ^ ")" | IterT (t1, iter) -> string_of_typ t1 ^ string_of_iter iter - | StrT tfs when short && List.length tfs > 3 -> - "{" ^ concat ", " (map_filter_nl_list (string_of_typfield ~short) (Lib.List.take 3 tfs)) ^ ", ..}" - | StrT tfs -> - "{" ^ concat ", " (map_filter_nl_list (string_of_typfield ~short) tfs) ^ "}" + | StrT (dots1, ts, tfs, dots2) when short && List.length tfs > 3 -> + "{" ^ concat ", " ( + strings_of_dots dots1 @ + map_filter_nl_list string_of_typ ts @ + map_filter_nl_list (string_of_typfield ~short) (Lib.List.take 3 tfs) @ + ".." :: strings_of_dots dots2 + ) ^ "}" + | StrT (dots1, ts, tfs, dots2) -> + "{" ^ concat ", " ( + strings_of_dots dots1 @ + map_filter_nl_list string_of_typ ts @ + map_filter_nl_list (string_of_typfield ~short) tfs @ + strings_of_dots dots2 + ) ^ "}" | CaseT (dots1, ts, tcs, dots2) when short && List.length tcs > 3 -> "| " ^ concat " | " ( strings_of_dots dots1 @ diff --git a/spectec/src/el/subst.ml b/spectec/src/el/subst.ml index df0cdaf29..23fa722ac 100644 --- a/spectec/src/el/subst.ml +++ b/spectec/src/el/subst.ml @@ -102,7 +102,9 @@ and subst_typ s t = | ParenT t1 -> ParenT (subst_typ s t1) | TupT ts -> TupT (subst_list subst_typ s ts) | IterT (t1, iter) -> IterT (subst_typ s t1, subst_iter s iter) - | StrT tfs -> StrT (subst_nl_list subst_typfield s tfs) + | StrT (dots1, ts, tfs, dots2) -> + StrT (dots1, subst_nl_list subst_typ s ts, + subst_nl_list subst_typfield s tfs, dots2) | CaseT (dots1, ts, tcs, dots2) -> CaseT (dots1, subst_nl_list subst_typ s ts, subst_nl_list subst_typcase s tcs, dots2) diff --git a/spectec/src/frontend/dim.ml b/spectec/src/frontend/dim.ml index 1913fdf53..a671f4ab8 100644 --- a/spectec/src/frontend/dim.ml +++ b/spectec/src/frontend/dim.ml @@ -129,7 +129,8 @@ and check_typ env ctx t = | IterT (t1, iter) -> check_iter env ctx iter; check_typ env (strip_index iter::ctx) t1 - | StrT tfs -> + | StrT (_, ts, tfs, _) -> + iter_nl_list (check_typ env ctx) ts; iter_nl_list (fun (_, (tI, prems), _) -> let env' = ref Env.empty in check_typ env' ctx tI; diff --git a/spectec/src/frontend/elab.ml b/spectec/src/frontend/elab.ml index c8c085686..aebf818eb 100644 --- a/spectec/src/frontend/elab.ml +++ b/spectec/src/frontend/elab.ml @@ -506,14 +506,16 @@ let as_notation_typ phrase env dir t at : typ attempt = | VarT (id, args) -> as_notation_typid' phrase env id args at | _ -> fail_dir_typ env at phrase dir t "_ ... _" -let rec as_struct_typid' phrase env id args at : typfield list attempt = +let rec as_struct_typid' phrase env id args at : (typfield list * dots) attempt = match as_defined_typid' env id args at with | VarT (id', args'), `Alias -> as_struct_typid' phrase env id' args' at - | StrT tfs, _ -> Ok (filter_nl tfs) - | _ -> fail_dir_typ env at phrase Infer (VarT (id, args) $ id.at) "| ..." + | StrT (_dots1, ts, tfs, dots2), _ -> + let* tfss = map_attempt (fun t -> as_struct_typ "" env Infer t at) (filter_nl ts) in + Ok (List.concat (filter_nl tfs :: List.map fst tfss), dots2) + | _ -> fail_dir_typ env at phrase Infer (VarT (id, args) $ id.at) "{...}" | exception Error (at', msg) -> fail at' msg -let as_struct_typ phrase env dir t at : typfield list attempt = +and as_struct_typ phrase env dir t at : (typfield list * dots) attempt = match expand env t with | VarT (id, args) -> as_struct_typid' phrase env id args at | _ -> fail_dir_typ env at phrase dir t "{...}" @@ -522,8 +524,12 @@ let rec as_cat_typid' phrase env dir id args at = match as_defined_typid' env id args at with | VarT (id', args'), `Alias -> as_cat_typid' phrase env dir id' args' at | IterT _, _ -> Ok () - | StrT tfs, _ -> - iter_attempt (fun (_, (t, _), _) -> as_cat_typ phrase env dir t at) (filter_nl tfs) + | StrT (_dots1, ts, tfs, dots2), _ -> + let* tfss = map_attempt (fun t -> as_struct_typ "" env Infer t at) (filter_nl ts) in + let tfs' = List.concat (filter_nl tfs :: List.map fst tfss) in + if dots2 = Dots then + error at "used record type is only partially defined at this point"; + iter_attempt (fun (_, (t, _), _) -> as_cat_typ phrase env dir t at) tfs' | _ -> fail at (phrase ^ "'s type `" ^ string_of_typ ~short:true (VarT (id, args) $ id.at) ^ "` is not concatenable") @@ -539,9 +545,9 @@ and as_cat_typ phrase env dir t at = let rec as_variant_typid' phrase env id args at : (typcase list * dots) attempt = match as_defined_typid' env id args at with | VarT (id', args'), `Alias -> as_variant_typid' phrase env id' args' at - | CaseT (_dots1, ts, cases, dots2), _ -> - let* casess = map_attempt (fun t -> as_variant_typ "" env Infer t at) (filter_nl ts) in - Ok (List.concat (filter_nl cases :: List.map fst casess), dots2) + | CaseT (_dots1, ts, tcs, dots2), _ -> + let* tcss = map_attempt (fun t -> as_variant_typ "" env Infer t at) (filter_nl ts) in + Ok (List.concat (filter_nl tcs :: List.map fst tcss), dots2) | _ -> fail_dir_typ env id.at phrase Infer (VarT (id, args) $ id.at) "| ..." | exception Error (at', msg) -> fail at' msg @@ -753,27 +759,41 @@ and elab_typ_definition env tid t : Il.deftyp = ) @@ fun _ -> assert (valid_tid tid); (match t.it with - | StrT tfs -> - let tfs' = filter_nl tfs in + | StrT (dots1, ts, tfs, _dots2) -> + let tfs0 = + if dots1 = Dots then + fst (checkpoint (as_struct_typid' "own type" env tid [] t.at)) + else [] + in + let tfss = + map_filter_nl_list (fun t -> + let tfs, dots = checkpoint (as_struct_typ "parent type" env Infer t t.at) in + if dots = Dots then + error t.at "cannot include incomplete syntax type"; + List.map Iter.clone_typfield tfs (* ensure atom annotations are fresh *) + ) ts + in + let tfs1 = List.flatten (List.map Iter.clone_typfield tfs0 :: tfss @ [filter_nl tfs]) in + let tfs' = List.map (elab_typfield env tid t.at) tfs1 in check_atoms "record" "field" tfs' t.at; - Il.StructT (map_filter_nl_list (elab_typfield env tid t.at) tfs) - | CaseT (dots1, ts, cases, _dots2) -> - let cases0 = + Il.StructT tfs' + | CaseT (dots1, ts, tcs, _dots2) -> + let tcs0 = if dots1 = Dots then fst (checkpoint (as_variant_typid "own type" env tid [])) else [] in - let casess = + let tcss = map_filter_nl_list (fun t -> - let cases, dots = checkpoint (as_variant_typ "parent type" env Infer t t.at) in + let tcs, dots = checkpoint (as_variant_typ "parent type" env Infer t t.at) in if dots = Dots then error t.at "cannot include incomplete syntax type"; - List.map Iter.clone_typcase cases (* ensure atom annotations are fresh *) + List.map Iter.clone_typcase tcs (* ensure atom annotations are fresh *) ) ts in - let cases' = List.flatten (List.map Iter.clone_typcase cases0 :: casess @ [filter_nl cases]) in - let tcs' = List.map (elab_typcase env tid t.at) cases' in - check_atoms "variant" "case" cases' t.at; + let tcs1 = List.flatten (List.map Iter.clone_typcase tcs0 :: tcss @ [filter_nl tcs]) in + let tcs' = List.map (elab_typcase env tid t.at) tcs1 in + check_atoms "variant" "case" tcs1 t.at; Il.VariantT tcs' | ConT tc -> let tc' = elab_typcon env tid t.at tc in @@ -1078,14 +1098,18 @@ and infer_exp' env e : (Il.exp' * typ') attempt = fail_infer e.at "record" | DotE (e1, atom) -> let* e1', t1 = infer_exp env e1 in - let* tfs = as_struct_typ "expression" env Infer t1 e1.at in + let* tfs, dots1 = as_struct_typ "expression" env Infer t1 e1.at in + if dots1 = Dots then + error e1.at "used record type is only partially defined at this point"; let* t, prems = attempt (find_field tfs atom e1.at) t1 in let e' = Il.DotE (e1', elab_atom atom (expand_id env t1)) in let e'' = if prems = [] then e' else Il.ProjE (e' $$ e.at % elab_typ env t, 0) in Ok (e'', t.it) | CommaE (e1, e2) -> let* e1', t1 = infer_exp env e1 in - let* tfs = as_struct_typ "expression" env Infer t1 e1.at in + let* tfs, dots1 = as_struct_typ "expression" env Infer t1 e1.at in + if dots1 = Dots then + error e1.at "used record type is only partially defined at this point"; let* _ = as_cat_typ "expression" env Infer t1 e.at in (* TODO(4, rossberg): this is a bit of a hack, can we avoid it? *) (match e2.it with @@ -1266,12 +1290,16 @@ and elab_exp_plain' env e t : Il.exp' attempt = let* e2' = elab_exp env e2 t2 in Ok (Il.ExtE (e1', p', e2')) | StrE efs -> - let* tfs = as_struct_typ "record" env Check t e.at in + let* tfs, dots = as_struct_typ "record" env Check t e.at in + if dots = Dots then + error e.at "used record type is only partially defined at this point"; let* efs' = elab_expfields env (expand_id env t) (filter_nl efs) tfs t e.at in Ok (Il.StrE efs') | CommaE (e1, e2) -> let* e1' = elab_exp env e1 t in - let* tfs = as_struct_typ "expression" env Check t e1.at in + let* tfs, dots1 = as_struct_typ "expression" env Check t e1.at in + if dots1 = Dots then + error e1.at "used record type is only partially defined at this point"; let* _ = as_cat_typ "expression" env Check t e.at in (* TODO(4, rossberg): this is a bit of a hack, can we avoid it? *) (match e2.it with @@ -1589,7 +1617,9 @@ and elab_path' env p t : (Il.path' * typ) attempt = Ok (Il.SliceP (p1', e1', e2'), t1) | DotP (p1, atom) -> let* p1', t1 = elab_path env p1 t in - let* tfs = as_struct_typ "path" env Check t1 p1.at in + let* tfs, dots1 = as_struct_typ "path" env Check t1 p1.at in + if dots1 = Dots then + error p1.at "used record type is only partially defined at this point"; let* t', _prems = attempt (find_field tfs atom p1.at) t1 in Ok (Il.DotP (p1', elab_atom atom (expand_id env t1)), t') @@ -2324,9 +2354,9 @@ and infer_typ_notation env is_con t : typ = InfixT (infer_typ_notation env is_con t1, op, infer_typ_notation env is_con t2) | BrackT (l, t1, r) -> is_con := true; BrackT (l, infer_typ_notation env is_con t1, r) - | StrT tfs -> - StrT (Convert.map_nl_list (fun (a, (t, p), h) -> - a, (infer_typ_notation env is_con t, p), h) tfs) + | StrT (d1, ts, tfs, d2) -> + StrT (d1, ts, Convert.map_nl_list (fun (a, (t, p), h) -> + a, (infer_typ_notation env is_con t, p), h) tfs, d2) | CaseT (d1, ts, tcs, d2) -> CaseT (d1, ts, Convert.map_nl_list (fun (a, (t, p), h) -> a, (infer_typ_notation env is_con t, p), h) tcs, d2) @@ -2368,7 +2398,10 @@ let infer_typdef env d : def = if bound env.typs id1 then ( let _ps, k = find "syntax type" env.typs id1 in let extension = - match t.it with CaseT (Dots, _, _, _) -> true | _ -> false in + match t.it with + | CaseT (Dots, _, _, _) | StrT (Dots, _, _, _) -> true + | _ -> false + in if k <> Family [] && not extension then (* force error *) ignore (env.typs <- bind "syntax type" env.typs id1 ([], Family [])) ) @@ -2467,9 +2500,9 @@ let rec elab_def env d : Il.def list = let inst' = Il.InstD (bs', List.map (Dim.annot_arg dims') as', dt') $ d.at in let k1', closed = match k1, t.it with - | Opaque, CaseT (Dots, _, _, _) -> + | Opaque, (CaseT (Dots, _, _, _) | StrT (Dots, _, _, _)) -> error_id id1 "extension of not yet defined syntax type" - | Opaque, CaseT (NoDots, _, _, dots2) -> + | Opaque, (CaseT (NoDots, _, _, dots2) | StrT (NoDots, _, _, dots2)) -> Defined (t, [id2], dt'), dots2 = NoDots | (Opaque | Transp), _ -> Defined (t, [id2], dt'), true @@ -2483,11 +2516,22 @@ let rec elab_def env d : Il.def list = error d.at "syntax parameters differ from previous fragment"; let t1 = CaseT (dots1, ts1 @ ts2, tcs1 @ tcs2, dots2) $ over_region [at; t.at] in Defined (t1, id2::ids, dt'), dots2 = NoDots - | Defined _, CaseT (Dots, _, _, _) -> + | Defined ({it = StrT (dots1, ts1, tfs1, Dots); at; _}, ids, _), + StrT (Dots, ts2, tfs2, dots2) -> + let ps = List.map Convert.param_of_arg as_ in + if List.exists (fun id -> id.it = id2.it) ids then + error d.at ("duplicate syntax fragment name `" ^ id1.it ^ + (if id2.it = "" then "" else "/" ^ id2.it) ^ "`"); + if not Eq.(eq_list eq_param ps ps1) then + error d.at "syntax parameters differ from previous fragment"; + let t1 = StrT (dots1, ts1 @ ts2, tfs1 @ tfs2, dots2) $ over_region [at; t.at] in + Defined (t1, id2::ids, dt'), dots2 = NoDots + | Defined _, (CaseT (Dots, _, _, _) | StrT (Dots, _, _, _)) -> error_id id1 "extension of non-extensible syntax type" | Defined _, _ -> error_id id1 "duplicate declaration for syntax type"; - | Family _, CaseT (dots1, _, _, dots2) when dots1 = Dots || dots2 = Dots -> + | Family _, (CaseT (dots1, _, _, dots2) | StrT (dots1, _, _, dots2)) + when dots1 = Dots || dots2 = Dots -> error_id id1 "syntax type family cases are not extensible" | Family insts, _ -> Family (insts @ [(as_, t, inst')]), false @@ -2609,7 +2653,7 @@ let check_dots env = Map.iter (fun id (at, (_ps, k)) -> match k with | Transp | Opaque -> assert false - | Defined ({it = CaseT (_, _, _, Dots); _}, _, _) -> + | Defined ({it = (CaseT (_, _, _, Dots) | StrT (_, _, _, Dots)); _}, _, _) -> error_id (id $ at) "missing final extension to syntax type" | Family [] -> error_id (id $ at) "no defined cases for syntax type family" diff --git a/spectec/src/frontend/eval.ml b/spectec/src/frontend/eval.ml index 761f31655..d8be4a396 100644 --- a/spectec/src/frontend/eval.ml +++ b/spectec/src/frontend/eval.ml @@ -691,7 +691,8 @@ and equiv_typ env t1 t2 = equiv_typ env t11 t21 && atom1.it = atom2.it && equiv_typ env t12 t22 | BrackT (atom11, t11, atom12), BrackT (atom21, t21, atom22) -> atom11.it = atom21.it && equiv_typ env t11 t21 && atom12 = atom22 - | StrT tfs1, StrT tfs2 -> equiv_nl_list equiv_typfield env tfs1 tfs2 + | StrT (NoDots, [], tfs1, NoDots), StrT (NoDots, [], tfs2, NoDots) -> + equiv_nl_list equiv_typfield env tfs1 tfs2 | CaseT (NoDots, [], tcs1, NoDots), CaseT (NoDots, [], tcs2, NoDots) -> equiv_nl_list equiv_typcase env tcs1 tcs2 | ConT tc1, ConT tc2 -> equiv_typcon env tc1 tc2 @@ -773,7 +774,7 @@ and sub_typ env t1 t2 = let t2 = reduce_typ env t2 in match t1.it, t2.it with (*| NumT nt1, NumT nt2 -> Num.sub nt1 nt2*) - | StrT tfs1, StrT tfs2 -> + | StrT (NoDots, [], tfs1, NoDots), StrT (NoDots, [], tfs2, NoDots) -> El.Convert.forall_nl_list (fun (atom, (t2, prems2), _) -> match find_field tfs1 atom with | Some (t1, prems1) -> @@ -856,7 +857,7 @@ and disj_typ env t1 t2 = disj_typ env t11 t21 || atom1.it <> atom2.it || disj_typ env t12 t22 | BrackT (atom11, t11, atom12), BrackT (atom21, t21, atom22) -> atom11.it <> atom21.it || disj_typ env t11 t21 || atom12 = atom22 - | StrT tfs1, StrT tfs2 -> + | StrT (NoDots, [], tfs1, NoDots), StrT (NoDots, [], tfs2, NoDots) -> unordered (atoms tfs1) (atoms tfs2) || El.Convert.exists_nl_list (fun (atom, (t2, _prems2), _) -> match find_field tfs1 atom with diff --git a/spectec/src/frontend/lexer.mll b/spectec/src/frontend/lexer.mll index c5a2c90cc..d67f673c9 100644 --- a/spectec/src/frontend/lexer.mll +++ b/spectec/src/frontend/lexer.mll @@ -192,6 +192,7 @@ and token = parse | "-+" { MINUSPLUS } | "<-" { MEM } + | "" { ARROW } | "=>" { ARROW2 } | "->_" { ARROWSUB } diff --git a/spectec/src/frontend/parser.mly b/spectec/src/frontend/parser.mly index 9a2812d7f..2607b27f9 100644 --- a/spectec/src/frontend/parser.mly +++ b/spectec/src/frontend/parser.mly @@ -73,6 +73,19 @@ let is_post_exp e = | HoleE _ -> true | _ -> false +let is_atom t = + match t.it with + | AtomT _ -> true + | _ -> false + +let is_typfield t = + match t.it with + | SeqT [t1; _] -> is_atom t1 + | VarT _ | BoolT | NumT _ | TextT | TupT _ | SeqT _ + | AtomT _ | InfixT _ | BrackT _ + | ParenT _ | IterT _ -> false + | StrT _ | CaseT _ | ConT _ | RangeT _ -> assert false + let rec is_typcase t = match t.it with | AtomT _ | InfixT _ | BrackT _ -> true @@ -159,7 +172,7 @@ and short_alt_prod' = function %token NOT AND OR %token QUEST PLUS MINUS STAR SLASH BACKSLASH UP CAT PLUSMINUS MINUSPLUS %token ARROW ARROW2 ARROWSUB ARROW2SUB DARROW2 SQARROW SQARROWSUB SQARROWSTAR SQARROWSTARSUB -%token MEM PREC SUCC TURNSTILE TILESTURN TURNSTILESUB TILESTURNSUB +%token MEM NOTMEM PREC SUCC TURNSTILE TILESTURN TURNSTILESUB TILESTURNSUB %token DOLLAR TICK %token BOT TOP %token HOLE MULTIHOLE NOTHING FUSE FUSEFUSE LATEX @@ -182,7 +195,7 @@ and short_alt_prod' = function %right SQARROW SQARROWSUB SQARROWSTAR SQARROWSTARSUB PREC SUCC BIGAND BIGOR BIGADD BIGMUL BIGCAT %left COLON SUB SUP ASSIGN EQUIV APPROX COLONSUB EQUIVSUB APPROXSUB %left COMMA COMMA_NL -%right EQ NE LT GT LE GE MEM EQSUB +%right EQ NE LT GT LE GE MEM NOTMEM EQSUB %right ARROW ARROWSUB %left SEMICOLON %left DOT DOTDOT DOTDOTDOT @@ -231,20 +244,30 @@ nl_dash_list1(X) : | DASH DASH nl_dash_list(X) { Nl::$3 } | DASH X nl_dash_list(X) { (Elem $2)::$3 } -%inline dots : +%inline bar_dots : | DOTDOTDOT {} - | bar(dots) DOTDOTDOT {} + | bar(bar_dots) DOTDOTDOT {} -dots_list(X) : - | dots_list1(X) { let x, y = $1 in (NoDots, x, y) } - | bar(X) dots_list1(X) { let x, y = $2 in (NoDots, x, y) } - | dots bar(X) dots_list1(X) { let x, y = $3 in (Dots, $2 @ x, y) } +dots_bar_list(X) : + | dots_bar_list1(X) { let x, y = $1 in (NoDots, x, y) } + | bar(X) dots_bar_list1(X) { let x, y = $2 in (NoDots, x, y) } + | bar_dots bar(X) dots_bar_list1(X) { let x, y = $3 in (Dots, $2 @ x, y) } -dots_list1(X) : +dots_bar_list1(X) : | (* empty *) { [], NoDots } | DOTDOTDOT { [], Dots } | X { (Elem $1)::[], NoDots } - | X bar(X) dots_list1(X) { let x, y = $3 in (Elem $1)::$2 @ x, y } + | X bar(X) dots_bar_list1(X) { let x, y = $3 in (Elem $1)::$2 @ x, y } + +dots_comma_list(X) : + | dots_comma_list1(X) { let x, y = $1 in (NoDots, x, y) } + | DOTDOTDOT comma(X) dots_comma_list1(X) { let x, y = $3 in (Dots, $2 @ x, y) } + +dots_comma_list1(X) : + | (* empty *) { [], NoDots } + | DOTDOTDOT { [], Dots } + | X { (Elem $1)::[], NoDots } + | X comma(X) dots_comma_list1(X) { let x, y = $3 in (Elem $1)::$2 @ x, y } (* Identifiers *) @@ -296,6 +319,7 @@ atom_escape : | TICK LE { Atom.LessEqual } | TICK GE { Atom.GreaterEqual } | TICK MEM { Atom.Mem } + | TICK NOTMEM { Atom.NotMem } | TICK QUEST { Atom.Quest } | TICK PLUS { Atom.Plus } | TICK STAR { Atom.Star } @@ -443,8 +467,37 @@ typ : typ_post { $1 } deftyp : deftyp_ { $1 $ $sloc } deftyp_ : - | LBRACE comma_nl_list(fieldtyp) RBRACE { StrT $2 } - | dots_list(casetyp) + | LBRACE dots_comma_list(fieldtyp) RBRACE + { let dots1, tfs, dots2 = $2 in + match dots1, El.Convert.filter_nl tfs, dots2 with + | NoDots, [(t, prems, hints)], NoDots when not (is_typfield t) -> + if prems <> [] then + error t.at "misplaced premise" + else if hints <> [] then + error (List.hd hints).hintid.at "misplaced hint" + else + t.it + | _ -> + let y1, y2, _ = + List.fold_right + (fun elem (y1, y2, at) -> + (* at is the position of leftmost id element so far *) + match elem with + | Nl -> if at = None then y1, Nl::y2, at else Nl::y1, y2, at + | Elem (t, prems, hints) -> + match t.it with + | SeqT [{it = AtomT atom; _}; t2] when at = None -> + y1, (Elem (atom, (t2, prems), hints))::y2, None + | AtomT _ | InfixT _ | BrackT _ | SeqT _ -> + error t.at "malformed field type" + | _ when prems = [] && hints = [] -> + (Elem t)::y1, y2, Some t.at + | _ -> + let at = Option.value at ~default: t.at in + error at "misplaced type" + ) tfs ([], [], None) + in StrT (dots1, y1, y2, dots2) } + | dots_bar_list(casetyp) { let dots1, tcs, dots2 = $1 in match dots1, El.Convert.filter_nl tcs, dots2 with | NoDots, [(t, prems, hints)], NoDots when not (is_typcase t) -> @@ -469,12 +522,12 @@ deftyp_ : | SeqT ({it = AtomT atom; _}::_) | SeqT ({it = InfixT (_, atom, _); _}::_) | SeqT ({it = BrackT (atom, _, _); _}::_) when at = None -> - y1, (Elem (atom, (t, prems), hints))::y2, at + y1, (Elem (atom, (t, prems), hints))::y2, None | _ when prems = [] && hints = [] -> (Elem t)::y1, y2, Some t.at | _ -> - let at = Option.value at ~default:t.at in - error at "misplaced type"; + let at = Option.value at ~default: t.at in + error at "misplaced type" ) tcs ([], [], None) in CaseT (dots1, y1, y2, dots2) } | nl_bar_list1(enumtyp(enum1), enumtyp(arith)) { RangeT $1 } @@ -530,7 +583,7 @@ nottyp_rel_ : nottyp : nottyp_rel { $1 } fieldtyp : - | fieldid typ_post hint* prem_bin_list { ($1, ($2, $4), $3) } + | nottyp hint* prem_bin_list { $1, $3, $2 } casetyp : | nottyp hint* prem_list { $1, $3, $2 } @@ -652,6 +705,7 @@ exp_bin_ : | exp_bin boolop exp_bin { BinE ($1, $2, $3) } | exp_bin CAT exp_bin { CatE ($1, $3) } | exp_bin MEM exp_bin { MemE ($1, $3) } + | exp_bin NOTMEM exp_bin { UnE (`NotOp, MemE ($1, $3) $ $sloc) } exp_rel : exp_rel_ { $1 $ $sloc } exp_rel_ : @@ -720,6 +774,7 @@ arith_bin_ : | arith_bin boolop arith_bin { BinE ($1, $2, $3) } | arith_bin CAT arith_bin { CatE ($1, $3) } | arith_bin MEM arith_bin { MemE ($1, $3) } + | arith_bin NOTMEM arith_bin { UnE (`NotOp, MemE ($1, $3) $ $sloc) } arith : arith_bin { $1 } @@ -832,7 +887,7 @@ prod_ : | sym EQUIV sym prem_list { EquivP ($1, $3, $4) } gram : - | dots_list(prod) { $1 $ $sloc } + | dots_bar_list(prod) { $1 $ $sloc } prod_short : prod_short_ { $1 $ $sloc } @@ -843,18 +898,18 @@ prod_short_ : } gram_short : - | dots_list(prod_short) { $1 $ $sloc } + | dots_bar_list(prod_short) { $1 $ $sloc } *) gram : gram_ { $1 $ $sloc } -gram_ : (* dots * prod nl_list * dots *) - (* Inline and transform dots_list to avoid conflicts *) +gram_ : (* bar_dots * prod nl_list * bar_dots *) + (* Inline and transform dots_bar_list to avoid conflicts *) | gram_long_or_short { let x, y = $1 [] in (NoDots, x, y) } | bar(sym) gram_long_or_short { let x, y = $2 [] in (NoDots, x, y) } - | dots bar(gram) gram_long_or_short { let x, y = $3 [] in (Dots, $2 @ x, y) } + | bar_dots bar(gram) gram_long_or_short { let x, y = $3 [] in (Dots, $2 @ x, y) } -gram_long_or_short : (* prod nl_list * dots *) +gram_long_or_short : (* prod nl_list * bar_dots *) | gram_empty { fun alts -> short_alt_prod (alts, []), $1 } | gram_long1 { $1 } | gram_short1 { $1 } diff --git a/spectec/src/il/eval.ml b/spectec/src/il/eval.ml index f3600eb66..be9321624 100644 --- a/spectec/src/il/eval.ml +++ b/spectec/src/il/eval.ml @@ -365,12 +365,11 @@ and reduce_exp env e : exp = ) | _ -> e1' ) - | SubE (e1, t1, t2) when equiv_typ env t1 t2 -> - reduce_exp env e1 | SubE (e1, t1, t2) -> let e1' = reduce_exp env e1 in let t1' = reduce_typ env t1 in let t2' = reduce_typ env t2 in + if equiv_typ env t1' t2' then e1' else (match e1'.it with | SubE (e11', t11', _t12') -> reduce_exp env (SubE (e11', t11', t2') $> e) diff --git a/spectec/src/xl/atom.ml b/spectec/src/xl/atom.ml index 756ce1f9b..263effc22 100644 --- a/spectec/src/xl/atom.ml +++ b/spectec/src/xl/atom.ml @@ -16,6 +16,7 @@ and atom' = | Semicolon (* `;` *) | Backslash (* `\` *) | Mem (* `<-` *) + | NotMem (* `` *) | Arrow2 (* ``=>` *) | ArrowSub (* `->_` *) @@ -104,6 +105,7 @@ let to_string atom = | Semicolon -> ";" | Backslash -> "\\" | Mem -> "<-" + | NotMem -> " "->" | Arrow2 -> "=>" | ArrowSub -> "->_" @@ -168,6 +170,7 @@ let name atom = | Semicolon -> "semicolon" (* Latex: ; *) | Backslash -> "setminus" | Mem -> "in" + | NotMem -> "notin" | Arrow -> "arrow" (* Latex: \rightarrow *) | Arrow2 -> "darrow" (* Latex: \Rightarrow *) | ArrowSub -> "arrow_" (* Latex: \rightarrow with subscript *) diff --git a/spectec/test-frontend/TEST.md b/spectec/test-frontend/TEST.md index 26acafe10..80dc5cdc2 100644 --- a/spectec/test-frontend/TEST.md +++ b/spectec/test-frontend/TEST.md @@ -1921,7 +1921,7 @@ syntax vcvtop__(shape_1 : shape, shape_2 : shape) syntax memarg = { ALIGN{u32 : u32} u32, - OFFSET{u32 : u32} u32 + OFFSET{u64 : u64} u64 } ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec @@ -1945,7 +1945,7 @@ syntax vloadop_{vectype : vectype}(vectype) = ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec syntax blocktype = | _RESULT{`valtype?` : valtype?}(valtype?{valtype <- `valtype?`} : valtype?) - | _IDX{funcidx : funcidx}(funcidx : funcidx) + | _IDX{typeidx : typeidx}(typeidx : typeidx) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec syntax addr = nat @@ -2184,7 +2184,7 @@ syntax expr = instr* ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $memarg0 : memarg ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec - def $memarg0 = {ALIGN `%`_u32(0), OFFSET `%`_u32(0)} + def $memarg0 = {ALIGN `%`_u32(0), OFFSET `%`_u64(0)} ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $const(consttype : consttype, lit_ : lit_((consttype : consttype <: storagetype))) : instr @@ -2203,7 +2203,7 @@ def $free_blocktype(blocktype : blocktype) : free ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $free_blocktype{`valtype?` : valtype?}(_RESULT_blocktype(valtype?{valtype <- `valtype?`})) = $free_opt($free_valtype(valtype)?{valtype <- `valtype?`}) ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec - def $free_blocktype{funcidx : funcidx}(_IDX_blocktype(funcidx)) = $free_funcidx(funcidx) + def $free_blocktype{typeidx : typeidx}(_IDX_blocktype(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec rec { @@ -3318,6 +3318,14 @@ relation Defaultable: `|-%DEFAULTABLE`(valtype) `|-%DEFAULTABLE`(t) -- if ($default_(t) =/= ?()) +;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec +relation Memarg_ok: `|-%:%->%`(memarg, addrtype, N) + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec + rule _{n : n, m : m, at : addrtype, N : N}: + `|-%:%->%`({ALIGN `%`_u32(n), OFFSET `%`_u64(m)}, at, N) + -- if (((2 ^ n) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- if (m < (2 ^ $size((at : addrtype <: numtype)))) + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec def $is_packtype(storagetype : storagetype) : bool ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec @@ -3706,242 +3714,242 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) `%|-%:%`(C, ELEM.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) -- if (C.ELEMS_context[x!`%`_idx.0] = rt) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:408.1-410.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:416.1-418.32 rule memory.size{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.SIZE_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:412.1-414.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:420.1-422.32 rule memory.grow{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.GROW_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:416.1-418.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:424.1-426.32 rule memory.fill{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype (at : addrtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:420.1-423.38 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:428.1-431.38 rule memory.copy{C : context, x_1 : idx, x_2 : idx, at_1 : addrtype, at_2 : addrtype, lim_1 : limits, lim_2 : limits}: `%|-%:%`(C, MEMORY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([(at_1 : addrtype <: valtype) (at_2 : addrtype <: valtype) ($minat(at_1, at_2) : addrtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x_1!`%`_idx.0] = `%%PAGE`_memtype(at_1, lim_1)) -- if (C.MEMS_context[x_2!`%`_idx.0] = `%%PAGE`_memtype(at_2, lim_2)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:425.1-428.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:433.1-436.24 rule memory.init{C : context, x : idx, y : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.INIT_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype I32_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:430.1-432.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:438.1-440.24 rule data.drop{C : context, x : idx}: `%|-%:%`(C, DATA.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) -- if (C.DATAS_context[x!`%`_idx.0] = OK_datatype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:443.1-446.43 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:451.1-454.44 rule `load-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, LOAD_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $size(nt)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:448.1-451.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:456.1-459.36 rule `load-pack`{C : context, Inn : Inn, M : M, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(M), sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(Inn : Inn <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, M) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:462.1-465.43 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:470.1-473.44 rule `store-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, STORE_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $size(nt)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:467.1-470.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:475.1-478.36 rule `store-pack`{C : context, Inn : Inn, M : M, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(M))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (Inn : Inn <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, M) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:472.1-475.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:480.1-483.47 rule `vload-val`{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $vsize(V128_vectype)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:477.1-480.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:485.1-488.41 rule `vload-pack`{C : context, M : M, N : N, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), N, sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (((M : nat <:> rat) / (8 : nat <:> rat)) * (N : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, (M * N)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:482.1-485.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:490.1-493.36 rule `vload-splat`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:487.1-490.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:495.1-498.36 rule `vload-zero`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:492.1-496.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:500.1-504.21 rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:498.1-501.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:506.1-509.47 rule vstore{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VSTORE_instr(V128_vectype, x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $vsize(V128_vectype)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:503.1-507.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:511.1-515.21 rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: `%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:512.1-513.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:520.1-521.33 rule const{C : context, nt : numtype, c_nt : num_(nt)}: `%|-%:%`(C, CONST_instr(nt, c_nt), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:515.1-516.34 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:523.1-524.34 rule unop{C : context, nt : numtype, unop_nt : unop_(nt)}: `%|-%:%`(C, UNOP_instr(nt, unop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:518.1-519.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:526.1-527.39 rule binop{C : context, nt : numtype, binop_nt : binop_(nt)}: `%|-%:%`(C, BINOP_instr(nt, binop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:521.1-522.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:529.1-530.39 rule testop{C : context, nt : numtype, testop_nt : testop_(nt)}: `%|-%:%`(C, TESTOP_instr(nt, testop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:524.1-525.40 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:532.1-533.40 rule relop{C : context, nt : numtype, relop_nt : relop_(nt)}: `%|-%:%`(C, RELOP_instr(nt, relop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:527.1-528.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:535.1-536.44 rule cvtop{C : context, nt_1 : numtype, nt_2 : numtype, cvtop : cvtop__(nt_2, nt_1)}: `%|-%:%`(C, CVTOP_instr(nt_1, nt_2, cvtop), `%->_%%`_instrtype(`%`_resulttype([(nt_2 : numtype <: valtype)]), [], `%`_resulttype([(nt_1 : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:533.1-534.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:541.1-542.35 rule vconst{C : context, c : vec_(V128_Vnn)}: `%|-%:%`(C, VCONST_instr(V128_vectype, c), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:536.1-537.41 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:544.1-545.41 rule vvunop{C : context, vvunop : vvunop}: `%|-%:%`(C, VVUNOP_instr(V128_vectype, vvunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:539.1-540.48 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:547.1-548.48 rule vvbinop{C : context, vvbinop : vvbinop}: `%|-%:%`(C, VVBINOP_instr(V128_vectype, vvbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:542.1-543.55 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:550.1-551.55 rule vvternop{C : context, vvternop : vvternop}: `%|-%:%`(C, VVTERNOP_instr(V128_vectype, vvternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:545.1-546.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:553.1-554.44 rule vvtestop{C : context, vvtestop : vvtestop}: `%|-%:%`(C, VVTESTOP_instr(V128_vectype, vvtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:548.1-549.37 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:556.1-557.37 rule vunop{C : context, sh : shape, vunop : vunop_(sh)}: `%|-%:%`(C, VUNOP_instr(sh, vunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:551.1-552.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:559.1-560.44 rule vbinop{C : context, sh : shape, vbinop : vbinop_(sh)}: `%|-%:%`(C, VBINOP_instr(sh, vbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:554.1-555.51 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:562.1-563.51 rule vternop{C : context, sh : shape, vternop : vternop_(sh)}: `%|-%:%`(C, VTERNOP_instr(sh, vternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:557.1-558.40 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:565.1-566.40 rule vtestop{C : context, sh : shape, vtestop : vtestop_(sh)}: `%|-%:%`(C, VTESTOP_instr(sh, vtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:560.1-561.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:568.1-569.44 rule vrelop{C : context, sh : shape, vrelop : vrelop_(sh)}: `%|-%:%`(C, VRELOP_instr(sh, vrelop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:563.1-564.47 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:571.1-572.47 rule vshiftop{C : context, sh : ishape, vshiftop : vshiftop_(sh)}: `%|-%:%`(C, VSHIFTOP_instr(sh, vshiftop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype I32_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:566.1-567.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:574.1-575.33 rule vbitmask{C : context, sh : ishape}: `%|-%:%`(C, VBITMASK_instr(sh), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:569.1-570.50 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:577.1-578.50 rule vswizzlop{C : context, sh : bshape, vswizzlop : vswizzlop_(sh)}: `%|-%:%`(C, VSWIZZLOP_instr(sh, vswizzlop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:572.1-574.29 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:580.1-582.29 rule vshuffle{C : context, sh : bshape, `i*` : laneidx*}: `%|-%:%`(C, VSHUFFLE_instr(sh, i*{i <- `i*`}), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) -- (if (i!`%`_laneidx.0 < (2 * $dim(sh!`%`_bshape.0)!`%`_dim.0)))*{i <- `i*`} - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:576.1-577.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:584.1-585.44 rule vsplat{C : context, sh : shape}: `%|-%:%`(C, VSPLAT_instr(sh), `%->_%%`_instrtype(`%`_resulttype([($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:579.1-581.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:587.1-589.21 rule vextract_lane{C : context, sh : shape, `sx?` : sx?, i : laneidx}: `%|-%:%`(C, VEXTRACT_LANE_instr(sh, sx?{sx <- `sx?`}, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([($unpackshape(sh) : numtype <: valtype)]))) -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:583.1-585.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:591.1-593.21 rule vreplace_lane{C : context, sh : shape, i : laneidx}: `%|-%:%`(C, VREPLACE_LANE_instr(sh, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype ($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:587.1-588.50 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:595.1-596.50 rule vextunop{C : context, sh_1 : ishape, sh_2 : ishape, vextunop : vextunop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTUNOP_instr(sh_1, sh_2, vextunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:590.1-591.57 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:598.1-599.57 rule vextbinop{C : context, sh_1 : ishape, sh_2 : ishape, vextbinop : vextbinop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTBINOP_instr(sh_1, sh_2, vextbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:593.1-594.64 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:601.1-602.64 rule vextternop{C : context, sh_1 : ishape, sh_2 : ishape, vextternop : vextternop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTTERNOP_instr(sh_1, sh_2, vextternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:596.1-597.48 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:604.1-605.48 rule vnarrow{C : context, sh_1 : ishape, sh_2 : ishape, sx : sx}: `%|-%:%`(C, VNARROW_instr(sh_1, sh_2, sx), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:599.1-600.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:607.1-608.46 rule vcvtop{C : context, sh_1 : shape, sh_2 : shape, vcvtop : vcvtop__(sh_2, sh_1)}: `%|-%:%`(C, VCVTOP_instr(sh_1, sh_2, vcvtop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:6.1-6.96 relation Instrs_ok: `%|-%:%`(context, instr*, instrtype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:605.1-606.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:613.1-614.24 rule empty{C : context}: `%|-%:%`(C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:609.1-613.82 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:617.1-621.82 rule seq{C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: `%|-%:%`(C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) -- Instr_ok: `%|-%:%`(C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} -- Instrs_ok: `%|-%:%`($with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:615.1-619.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:623.1-627.33 rule sub{C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: `%|-%:%`(C, instr*{instr <- `instr*`}, it') -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, it) -- Instrtype_sub: `%|-%<:%`(C, it, it') -- Instrtype_ok: `%|-%:OK`(C, it') - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:622.1-625.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:630.1-633.33 rule frame{C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) @@ -5028,20 +5036,6 @@ def $fvternop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N), fN : fN(N)) -- if (c_3*{c_3 <- `c_3*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_3)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Fnn : Fnn <: lanetype)), $f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2, c_3)*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`})) -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : u32*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c!`%`_u32.0*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) - -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : u32*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c!`%`_u32.0*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -5200,11 +5194,6 @@ def $vternop_(shape : shape, vternop_ : vternop_(shape), vec_ : vec_(V128_Vnn), ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vternop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), RELAXED_NMADD_vternop_, v_1, v_2, v_3) = $fvternop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $frelaxed_nmadd_, v_1, v_2, v_3) -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $vtestop_(shape : shape, vtestop_ : vtestop_(shape), vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $vtestop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_, v) = $ivtestop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $inez_, v) - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vrelop_(shape : shape, vrelop_ : vrelop_(shape), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -6213,7 +6202,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule vvtestop{c_1 : vec_(V128_Vnn), c : num_(I32_numtype)}: `%~>%`([VCONST_instr(V128_vectype, c_1) VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop)], [CONST_instr(I32_numtype, c)]) - -- if (c = $ine_($vsize(V128_vectype), c_1, `%`_iN(0))) + -- if (c = $inez_($vsize(V128_vectype), c_1)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vunop-val`{c_1 : vec_(V128_Vnn), sh : shape, vunop : vunop_(sh), c : vec_(V128_Vnn)}: @@ -6246,9 +6235,10 @@ relation Step_pure: `%~>%`(instr*, instr*) -- if ($vternop_(sh, vternop, c_1, c_2, c_3) = []) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec - rule vtestop{c_1 : vec_(V128_Vnn), sh : shape, vtestop : vtestop_(sh), i : num_(I32_numtype)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(sh, vtestop)], [CONST_instr(I32_numtype, i)]) - -- if (i = $vtestop_(sh, vtestop, c_1)) + rule vtestop{c_1 : vec_(V128_Vnn), Jnn : Jnn, M : M, c : num_(I32_numtype), `i*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}: + `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_)], [CONST_instr(I32_numtype, c)]) + -- if (i*{i <- `i*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)) + -- if (c!`%`_num_.0 = $prod($inez_($jsizenn(Jnn), i)!`%`_u32.0*{i <- `i*`})) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule vrelop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : shape, vrelop : vrelop_(sh), c : vec_(V128_Vnn)}: @@ -6535,53 +6525,53 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg, c : num_(nt)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [CONST_instr(nt, c)]) - -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(n), sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg, c : iN(n)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(n), sx)), x, ao)]), [CONST_instr((Inn : Inn <: numtype), $extend__(n, $size((Inn : Inn <: numtype)), sx, c))]) - -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg, c : vec_(V128_Vnn)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg, c : vec_(V128_Vnn), `j*` : iN(M)*, `k*` : nat*, Jnn : Jnn}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- (if ($ibytes_(M, j) = $mem(z, x).BYTES_meminst[((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((k * M) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-splat-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N), Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $inv_lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) @@ -6589,23 +6579,23 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-zero-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-zero-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (c = $extend__(N, 128, U_sx, j)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, c : vec_(V128_Vnn), k : iN(N), Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $inv_lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) @@ -6949,41 +6939,41 @@ relation Step: `%~>%`(config, config) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:494.1-497.60 rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:499.1-503.29 rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $nbytes_(nt, c)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:505.1-508.52 rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:510.1-514.52 rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:516.1-519.63 rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:521.1-524.31 rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:527.1-530.50 rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + N) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:532.1-537.49 rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) @@ -7631,7 +7621,7 @@ grammar Bblocktype : blocktype ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec prod{t : valtype} t:Bvaltype => _RESULT_blocktype(?(t)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_funcidx((i!`%`_s33.0 : int <:> nat))) + prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_typeidx((i!`%`_s33.0 : int <:> nat))) -- if (i!`%`_s33.0 >= (0 : nat <:> int)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec @@ -7651,10 +7641,10 @@ syntax memidxop = (memidx, memarg) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec grammar Bmemarg : memidxop ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{n : n, m : m} {{`%`_u32(n):Bu32} {`%`_u32(m):Bu32}} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u32(m)}) + prod{n : n, m : m} {{`%`_u32(n):Bu32} {`%`_u64(m):Bu64}} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u64(m)}) -- if (n < (2 ^ 6)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{n : n, x : idx, m : m} {{`%`_u32(n):Bu32} {x:Bmemidx} {`%`_u32(m):Bu32}} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u32(m)}) + prod{n : n, x : idx, m : m} {{`%`_u32(n):Bu32} {x:Bmemidx} {`%`_u64(m):Bu64}} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u64(m)}) -- if (((2 ^ 6) <= n) /\ (n < (2 ^ 7))) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec @@ -9379,7 +9369,7 @@ syntax idctxt = LOCALS{`name?*` : name?*} name?*, LABELS{`name?*` : name?*} name?*, FIELDS{`name?**` : name?**} name?**, - TYPEDEFS{`subtype?*` : subtype?*} subtype?* + TYPEDEFS{`deftype?*` : deftype?*} deftype?* } ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec @@ -9388,7 +9378,7 @@ syntax I = idctxt ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec rec { -;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:155.1-155.57 +;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:155.1-155.56 def $concat_idctxt(idctxt*) : idctxt ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:156.1-156.29 def $concat_idctxt([]) = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []} @@ -9641,12 +9631,14 @@ grammar Tlimits : limits ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec grammar Ttypeuse_(I : I) : (typeidx, idctxt) ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec - prod{x : idx, I' : I, `t_1*` : valtype*, `t_2*` : valtype*} {{"("} {"type"} {x:Ttypeidx_(I)} {")"}} => (x, I') - -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))))) + prod{x : idx, I' : I, `st*` : subtype*, i : n, `t_1*` : valtype*, `t_2*` : valtype*} {{"("} {"type"} {x:Ttypeidx_(I)} {")"}} => (x, I') + -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(_DEF_deftype(REC_rectype(`%`_list(st*{st <- `st*`})), i))) + -- if (st*{st <- `st*`}[i] = SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) -- if (I' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS ?(`%`_name([]))^|t_1*{t_1 <- `t_1*`}|{}, LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec - prod{x : idx, `t_1*` : valtype*, `id?*` : char?*, `t_2*` : valtype*, I' : I} {{"("} {"type"} {x:Ttypeidx_(I)} {")"} {(t_1, ?(`%`_name(lift(id?{id <- `id?`}))))*{`id?` <- `id?*`, t_1 <- `t_1*`}:Tparam_(I)*{}} {t_2*{t_2 <- `t_2*`}:Tresult_(I)*{}}} => (x, I') - -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))))) + prod{x : idx, `t_1*` : valtype*, `id?*` : char?*, `t_2*` : valtype*, I' : I, `st*` : subtype*, i : n} {{"("} {"type"} {x:Ttypeidx_(I)} {")"} {(t_1, ?(`%`_name(lift(id?{id <- `id?`}))))*{`id?` <- `id?*`, t_1 <- `t_1*`}:Tparam_(I)*{}} {t_2*{t_2 <- `t_2*`}:Tresult_(I)*{}}} => (x, I') + -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(_DEF_deftype(REC_rectype(`%`_list(st*{st <- `st*`})), i))) + -- if (st*{st <- `st*`}[i] = SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) -- if (I' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS ?(`%`_name(lift(id?{id <- `id?`})))*{`id?` <- `id?*`}, LABELS [], FIELDS [], TYPEDEFS []}) -- Idctxt_ok: `|-%:OK`(I') @@ -9715,6 +9707,9 @@ grammar Tcatch_(I : I) : catch ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{l : labelidx} {{"("} {"catch_all_ref"} {l:Tlabelidx_(I)} {")"}} => CATCH_ALL_REF_catch(l) +;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec +grammar Tfoldedinstr_(I : I) : instr* + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tlaneidx : laneidx ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -9725,16 +9720,20 @@ grammar Talign_(N : N) : u64 ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{m : m, n : n} {{"align="} {`%`_u64(m):Tu64}} => `%`_u64(m) -- if (m = (2 ^ n)) + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec + prod eps => `%`_u64(N) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Toffset : u64 ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{n : n} {{"offset="} {`%`_u64(n):Tu64}} => `%`_u64(n) + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec + prod eps => `%`_u64(0) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tmemarg_(N : N) : memarg ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{n : n, m : m} {{`%`_u64(n):Toffset} {`%`_u64(m):Talign_(N)}} => {ALIGN `%`_u32(n), OFFSET `%`_u32(m)} + prod{n : n, m : m} {{`%`_u64(n):Toffset} {`%`_u64(m):Talign_(N)}} => {ALIGN `%`_u32(n), OFFSET `%`_u64(m)} ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tplaininstr_(I : I) : instr @@ -9745,7 +9744,7 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "drop" => DROP_instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{`t?` : valtype?} {{"select"} {t?{t <- `t?`}:Tresult_(I)?{}}} => SELECT_instr(?(lift(t?{t <- `t?`}))) + prod{`t*?` : valtype*?} {{"select"} {t*{t <- `t*`}:Tresult_(I)*{}?{`t*` <- `t*?`}}} => SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`}) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{l : labelidx} {{"br"} {l:Tlabelidx_(I)}} => BR_instr(l) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -10283,33 +10282,33 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "f64x2.splat" => VSPLAT_instr(`%X%`_shape(F64_lanetype, `%`_dim(2))) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.extract_lane_s"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.extract_lane_s"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.extract_lane_u"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.extract_lane_u"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.extract_lane_s"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.extract_lane_s"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.extract_lane_u"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.extract_lane_u"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i32x4.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i32x4.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i64x2.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i64x2.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f32x4.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f32x4.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f64x2.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f64x2.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i32x4.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i32x4.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i64x2.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i64x2.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f32x4.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f32x4.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f64x2.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f64x2.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "v128.any_true" => VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -10744,31 +10743,18 @@ grammar Tinstrs_(I : I) : instr* ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:24.5-24.52 prod{`in**` : instr**} in*{in <- `in*`}*{`in*` <- `in**`}:Tfoldedinstr_(I)*{} => $concat_(syntax instr, in*{in <- `in*`}*{`in*` <- `in**`}) -;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:31.1-41.24 -grammar Tfoldedinstr_(I : I) : instr* - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:28.5-28.59 - prod{in : instr, `in'*` : instr*} {{"("} {in:Tplaininstr_(I)} {in'*{in' <- `in'*`}:Tinstrs_(I)} {")"}} => in'*{in' <- `in'*`} ++ [in] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:32.5-33.17 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*} {{"("} {"block"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [BLOCK_instr(bt, in*{in <- `in*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:34.5-35.16 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*} {{"("} {"loop"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [LOOP_instr(bt, in*{in <- `in*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:36.5-39.33 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `in_1*` : instr*, `in_2*` : instr*} {{"("} {"if"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"("} {"then"} {in_1*{in_1 <- `in_1*`}:Tinstrs_(I')} {")"} {{{"("} {"else"} {in_2*{in_2 <- `in_2*`}:Tinstrs_(I')} {")"}}?{}} {")"}} => in*{in <- `in*`} ++ [`IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:40.5-41.24 - prod{`id?` : char?, I' : I, bt : blocktype, `c*` : catch*, `in*` : instr*} {{"("} {"try_table"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {c*{c <- `c*`}:Tcatch_(I)*{}} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`})] - -;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:75.1-77.65 +;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:88.1-90.65 grammar Tblockinstr_(I : I) : instr - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:61.5-63.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:63.5-67.35 prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `id'?` : char?} {{"block"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => BLOCK_instr(bt, in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:64.5-66.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:68.5-72.35 prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `id'?` : char?} {{"loop"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => LOOP_instr(bt, in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:67.5-69.71 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:73.5-79.71 prod{`id?` : char?, I' : I, bt : blocktype, `in_1*` : instr*, `id_1?` : char?, `in_2*` : instr*, `id_2?` : char?} {{"if"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in_1*{in_1 <- `in_1*`}:Tinstrs_(I')} {"else"} {?(`%`_name(lift(id_1?{id_1 <- `id_1?`}))):Tid?{}} {in_2*{in_2 <- `in_2*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id_2?{id_2 <- `id_2?`}))):Tid?{}}} => `IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`}) -- if (((id_1?{id_1 <- `id_1?`} = ?()) \/ (id_1?{id_1 <- `id_1?`} = id?{id <- `id?`})) /\ ((id_2?{id_2 <- `id_2?`} = ?()) \/ (id_2?{id_2 <- `id_2?`} = id?{id <- `id?`}))) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:70.5-72.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:80.5-85.35 prod{`id?` : char?, I' : I, bt : blocktype, `c*` : catch*, `in*` : instr*, `id'?` : char?} {{"try_table"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {c*{c <- `c*`}:Tcatch_(I)*{}} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) } @@ -10781,9 +10767,9 @@ grammar Texpr_(I : I) : expr ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Ttype_(I : I) : (type, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{qt : rectype, I' : I, I'' : I, st : subtype, n : n} (qt, I'):Trectype_(I) => (TYPE_type(qt), I' +++ I'') - -- if (qt = REC_rectype(`%`_list(st^n{}))) - -- if (((n = 1) /\ (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS [?(st)]})) \/ ((n =/= 1) /\ (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS ?()^n{}}))) + prod{qt : rectype, I' : I, I'' : I, `st*` : subtype*, n : n, `i*` : nat*} (qt, I'):Trectype_(I) => (TYPE_type(qt), I' +++ I'') + -- if (qt = REC_rectype(`%`_list(st^n{st <- `st*`}))) + -- if (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS ?(_DEF_deftype(qt, i))^(i x - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod eps => `%`_memidx(0) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Toffset_(I : I) : expr @@ -10839,7 +10823,7 @@ grammar Tdata_(I : I) : (data, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, `b*` : byte*} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {b*{b <- `b*`}:Tdatastring} {")"}} => (DATA_data(b*{b <- `b*`}, PASSIVE_datamode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{`id?` : char?, `b*` : byte*, x : idx, e : expr} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {b*{b <- `b*`}:Tdatastring} {x:Tmemuse_(I)} {e:Toffset_(I)} {")"}} => (DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) + prod{`id?` : char?, x : idx, e : expr, `b*` : byte*} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {x:Tmemuse_(I)} {e:Toffset_(I)} {b*{b <- `b*`}:Tdatastring} {")"}} => (DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telemlist_(I : I) : (reftype, expr*) @@ -10850,15 +10834,13 @@ grammar Telemlist_(I : I) : (reftype, expr*) grammar Ttableuse_(I : I) : tableidx ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{x : idx} {{"("} {"table"} {x:Ttableidx_(I)} {")"}} => x - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod eps => `%`_tableidx(0) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telem_(I : I) : (elem, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{`id?` : char?, rt : reftype, `e*` : expr*, x : idx, e' : expr} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {(rt, e*{e <- `e*`}):Telemlist_(I)} {x:Ttableuse_(I)} {e':Toffset_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, ACTIVE_elemmode(x, e')), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) + prod{`id?` : char?, x : idx, e' : expr, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {x:Ttableuse_(I)} {e':Toffset_(I)} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, ACTIVE_elemmode(x, e')), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {"declare"} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) @@ -10892,6 +10874,9 @@ grammar Timportdots : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`` : ()} ``:{{"("} {"import"} {Tname} {Tname} {")"}} => (``, ()).1 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec +def $dots : () + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Texporttagdots_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec @@ -10907,7 +10892,7 @@ grammar Texportglobaldots_(I : I) : () prod{`` : ()} ``:{{Texportdots*{}} Timportdots {Tglobaltype_(I)}} => (``, ()).1 ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Texportmemorydots_(I : I) : () +grammar Texportmemdots_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`` : ()} ``:{{Texportdots*{}} {Tmemtype_(I)}} => (``, ()).1 ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec @@ -10938,7 +10923,7 @@ grammar Texporttag_(I : I) : () grammar Texportglobal_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Texportmemory_(I : I) : () +grammar Texportmem_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Texporttable_(I : I) : () @@ -10947,7 +10932,7 @@ grammar Texporttable_(I : I) : () grammar Texportfunc_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Tdatamemory_(I : I) : () +grammar Tdatamem_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telemtable_(I : I) : () @@ -10969,13 +10954,13 @@ syntax decl = ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:226.1-226.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:258.1-258.76 def $typesd(decl*) : type* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:238.1-238.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:270.1-270.23 def $typesd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:239.1-239.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:271.1-271.48 def $typesd{type : type, `decl'*` : decl*}([(type : type <: decl)] ++ decl'*{decl' <- `decl'*`}) = [type] ++ $typesd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:240.1-240.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:272.1-272.57 def $typesd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $typesd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -10983,13 +10968,13 @@ def $typesd(decl*) : type* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:227.1-227.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:259.1-259.78 def $importsd(decl*) : import* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:242.1-242.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:274.1-274.25 def $importsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:243.1-243.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:275.1-275.56 def $importsd{import : import, `decl'*` : decl*}([(import : import <: decl)] ++ decl'*{decl' <- `decl'*`}) = [import] ++ $importsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:244.1-244.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:276.1-276.61 def $importsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $importsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -10997,13 +10982,13 @@ def $importsd(decl*) : import* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:228.1-228.75 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:260.1-260.75 def $tagsd(decl*) : tag* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:246.1-246.22 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:278.1-278.22 def $tagsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:247.1-247.44 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:279.1-279.44 def $tagsd{tag : tag, `decl'*` : decl*}([(tag : tag <: decl)] ++ decl'*{decl' <- `decl'*`}) = [tag] ++ $tagsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:248.1-248.55 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:280.1-280.55 def $tagsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $tagsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11011,13 +10996,13 @@ def $tagsd(decl*) : tag* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:229.1-229.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:261.1-261.78 def $globalsd(decl*) : global* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:250.1-250.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:282.1-282.25 def $globalsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:251.1-251.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:283.1-283.56 def $globalsd{global : global, `decl'*` : decl*}([(global : global <: decl)] ++ decl'*{decl' <- `decl'*`}) = [global] ++ $globalsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:252.1-252.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:284.1-284.61 def $globalsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $globalsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11025,13 +11010,13 @@ def $globalsd(decl*) : global* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:230.1-230.75 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:262.1-262.75 def $memsd(decl*) : mem* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:254.1-254.22 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:286.1-286.22 def $memsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:255.1-255.44 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:287.1-287.44 def $memsd{mem : mem, `decl'*` : decl*}([(mem : mem <: decl)] ++ decl'*{decl' <- `decl'*`}) = [mem] ++ $memsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:256.1-256.55 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:288.1-288.55 def $memsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $memsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11039,13 +11024,13 @@ def $memsd(decl*) : mem* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:231.1-231.77 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:263.1-263.77 def $tablesd(decl*) : table* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:258.1-258.24 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:290.1-290.24 def $tablesd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:259.1-259.52 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:291.1-291.52 def $tablesd{table : table, `decl'*` : decl*}([(table : table <: decl)] ++ decl'*{decl' <- `decl'*`}) = [table] ++ $tablesd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:260.1-260.59 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:292.1-292.59 def $tablesd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $tablesd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11053,13 +11038,13 @@ def $tablesd(decl*) : table* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:232.1-232.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:264.1-264.76 def $funcsd(decl*) : func* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:262.1-262.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:294.1-294.23 def $funcsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:263.1-263.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:295.1-295.48 def $funcsd{func : func, `decl'*` : decl*}([(func : func <: decl)] ++ decl'*{decl' <- `decl'*`}) = [func] ++ $funcsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:264.1-264.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:296.1-296.57 def $funcsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $funcsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11067,13 +11052,13 @@ def $funcsd(decl*) : func* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:233.1-233.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:265.1-265.76 def $datasd(decl*) : data* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:266.1-266.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:298.1-298.23 def $datasd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:267.1-267.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:299.1-299.48 def $datasd{data : data, `decl'*` : decl*}([(data : data <: decl)] ++ decl'*{decl' <- `decl'*`}) = [data] ++ $datasd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:268.1-268.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:300.1-300.57 def $datasd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $datasd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11081,13 +11066,13 @@ def $datasd(decl*) : data* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:234.1-234.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:266.1-266.76 def $elemsd(decl*) : elem* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:270.1-270.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:302.1-302.23 def $elemsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:271.1-271.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:303.1-303.48 def $elemsd{elem : elem, `decl'*` : decl*}([(elem : elem <: decl)] ++ decl'*{decl' <- `decl'*`}) = [elem] ++ $elemsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:272.1-272.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:304.1-304.57 def $elemsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $elemsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11095,13 +11080,13 @@ def $elemsd(decl*) : elem* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:235.1-235.77 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:267.1-267.77 def $startsd(decl*) : start* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:274.1-274.24 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:306.1-306.24 def $startsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:275.1-275.52 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:307.1-307.52 def $startsd{start : start, `decl'*` : decl*}([(start : start <: decl)] ++ decl'*{decl' <- `decl'*`}) = [start] ++ $startsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:276.1-276.59 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:308.1-308.59 def $startsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $startsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11109,13 +11094,13 @@ def $startsd(decl*) : start* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:236.1-236.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:268.1-268.78 def $exportsd(decl*) : export* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:278.1-278.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:310.1-310.25 def $exportsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:279.1-279.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:311.1-311.56 def $exportsd{export : export, `decl'*` : decl*}([(export : export <: decl)] ++ decl'*{decl' <- `decl'*`}) = [export] ++ $exportsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:280.1-280.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:312.1-312.61 def $exportsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $exportsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11123,9 +11108,8 @@ def $exportsd(decl*) : export* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec def $ordered(decl*) : bool ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - def $ordered([]) = true - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - def $ordered{`decl'*` : decl*}(decl'*{decl' <- `decl'*`}) = ($importsd(decl'*{decl' <- `decl'*`}) = []) + def $ordered{`decl'*` : decl*}(decl'*{decl' <- `decl'*`}) = true + -- if ($importsd(decl'*{decl' <- `decl'*`}) = []) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec def $ordered{`decl_1*` : decl*, import : import, `decl_2*` : decl*}(decl_1*{decl_1 <- `decl_1*`} ++ [(import : import <: decl)] ++ decl_2*{decl_2 <- `decl_2*`}) = (((((($importsd(decl_1*{decl_1 <- `decl_1*`}) = []) /\ ($tagsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($globalsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($memsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($tablesd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($funcsd(decl_1*{decl_1 <- `decl_1*`}) = [])) @@ -11173,6 +11157,11 @@ grammar Tmodule : module -- if (export*{export <- `export*`} = $exportsd(decl*{decl <- `decl*`})) -- if $ordered(decl*{decl <- `decl*`}) +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec +grammar Tdecldots_(I : I) : (decl, idctxt)* + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec + prod{`` : (decl, idctxt)} [``]:Tdecl_(I)*{} => [``] + ;; ../../../../specification/wasm-3.0/X.1-notation.syntax.spectec syntax A = nat diff --git a/spectec/test-interpreter/TEST.md b/spectec/test-interpreter/TEST.md index c7b7dc40e..d3d82e5ef 100644 --- a/spectec/test-interpreter/TEST.md +++ b/spectec/test-interpreter/TEST.md @@ -11,7 +11,6 @@ spectec 0.5 generator == Translating to AL... == Initializing interpreter... == Interpreting... -===== ../test-interpreter/sample.wat ===== 42 == Complete. $ ../src/exe-spectec/main.exe ../../../_specification/wasm-3.0/*.spectec -v -l --interpreter ../test-interpreter/sample.wasm addTwo 40 2 2>&1 @@ -24,7 +23,6 @@ spectec 0.5 generator == Translating to AL... == Initializing interpreter... == Interpreting... -===== ../test-interpreter/sample.wasm ===== 42 == Complete. $ ../src/exe-spectec/main.exe ../../../_specification/wasm-3.0/*.spectec -v -l --interpreter ../test-interpreter/sample.wast 2>&1 @@ -37,10 +35,7 @@ spectec 0.5 generator == Translating to AL... == Initializing interpreter... == Interpreting... -===== ../test-interpreter/sample.wast ===== - print_i32: 10 -- 32/32 (100.00%) - == Complete. $ for v in 1 2 3; do ( \ > echo "Running test for Wasm $v.0..." && \ @@ -56,234 +51,29 @@ spectec 0.5 generator == Translating to AL... == Initializing interpreter... == Interpreting... -===== ../test-interpreter/spec-test-1/address.wast ===== -- 246/246 (100.00%) - -===== ../test-interpreter/spec-test-1/align.wast ===== -- 98/98 (100.00%) - -===== ../test-interpreter/spec-test-1/binary-leb128.wast ===== -- 50/50 (100.00%) - -===== ../test-interpreter/spec-test-1/binary.wast ===== -- 32/32 (100.00%) - -===== ../test-interpreter/spec-test-1/block.wast ===== -- 43/43 (100.00%) - -===== ../test-interpreter/spec-test-1/br.wast ===== -- 65/65 (100.00%) - -===== ../test-interpreter/spec-test-1/br_if.wast ===== -- 90/90 (100.00%) - -===== ../test-interpreter/spec-test-1/br_table.wast ===== -- 148/148 (100.00%) - -===== ../test-interpreter/spec-test-1/break-drop.wast ===== -- 5/5 (100.00%) - -===== ../test-interpreter/spec-test-1/call.wast ===== -- 63/63 (100.00%) - -===== ../test-interpreter/spec-test-1/call_indirect.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-1/comments.wast ===== -- 8/8 (100.00%) - -===== ../test-interpreter/spec-test-1/const.wast ===== -- 976/976 (100.00%) - -===== ../test-interpreter/spec-test-1/conversions.wast ===== - Failed to parse ../test-interpreter/spec-test-1/conversions.wast -===== ../test-interpreter/spec-test-1/custom.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-1/data.wast ===== - Failed to parse ../test-interpreter/spec-test-1/data.wast -===== ../test-interpreter/spec-test-1/elem.wast ===== - Failed to parse ../test-interpreter/spec-test-1/elem.wast -===== ../test-interpreter/spec-test-1/endianness.wast ===== -- 70/70 (100.00%) - -===== ../test-interpreter/spec-test-1/exports.wast ===== -- 114/114 (100.00%) - -===== ../test-interpreter/spec-test-1/f32.wast ===== - Failed to parse ../test-interpreter/spec-test-1/f32.wast -===== ../test-interpreter/spec-test-1/f32_bitwise.wast ===== -- 362/362 (100.00%) - -===== ../test-interpreter/spec-test-1/f32_cmp.wast ===== -- 2402/2402 (100.00%) - -===== ../test-interpreter/spec-test-1/f64.wast ===== - Failed to parse ../test-interpreter/spec-test-1/f64.wast -===== ../test-interpreter/spec-test-1/f64_bitwise.wast ===== -- 362/362 (100.00%) - -===== ../test-interpreter/spec-test-1/f64_cmp.wast ===== -- 2402/2402 (100.00%) - -===== ../test-interpreter/spec-test-1/fac.wast ===== -- 7/7 (100.00%) - -===== ../test-interpreter/spec-test-1/float_exprs.wast ===== - Failed to parse ../test-interpreter/spec-test-1/float_exprs.wast -===== ../test-interpreter/spec-test-1/float_literals.wast ===== -- 87/87 (100.00%) - -===== ../test-interpreter/spec-test-1/float_memory.wast ===== -- 96/96 (100.00%) - -===== ../test-interpreter/spec-test-1/float_misc.wast ===== - Failed to parse ../test-interpreter/spec-test-1/float_misc.wast -===== ../test-interpreter/spec-test-1/forward.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-1/func.wast ===== -- 79/79 (100.00%) - -===== ../test-interpreter/spec-test-1/func_ptrs.wast ===== - print_i32: 83 -- 32/32 (100.00%) - -===== ../test-interpreter/spec-test-1/globals.wast ===== -- 56/56 (100.00%) - -===== ../test-interpreter/spec-test-1/i32.wast ===== -- 361/361 (100.00%) - -===== ../test-interpreter/spec-test-1/i64.wast ===== -- 361/361 (100.00%) - -===== ../test-interpreter/spec-test-1/if.wast ===== -- 90/90 (100.00%) - -===== ../test-interpreter/spec-test-1/imports.wast ===== - Failed to parse ../test-interpreter/spec-test-1/imports.wast -===== ../test-interpreter/spec-test-1/inline-module.wast ===== -- 1/1 (100.00%) - -===== ../test-interpreter/spec-test-1/int_exprs.wast ===== -- 127/127 (100.00%) - -===== ../test-interpreter/spec-test-1/int_literals.wast ===== -- 32/32 (100.00%) - -===== ../test-interpreter/spec-test-1/labels.wast ===== -- 27/27 (100.00%) - -===== ../test-interpreter/spec-test-1/left-to-right.wast ===== -- 97/97 (100.00%) - -===== ../test-interpreter/spec-test-1/linking.wast ===== -- 129/129 (100.00%) - -===== ../test-interpreter/spec-test-1/load.wast ===== -- 39/39 (100.00%) - -===== ../test-interpreter/spec-test-1/local_get.wast ===== -- 21/21 (100.00%) - -===== ../test-interpreter/spec-test-1/local_set.wast ===== -- 21/21 (100.00%) - -===== ../test-interpreter/spec-test-1/local_tee.wast ===== -- 57/57 (100.00%) - -===== ../test-interpreter/spec-test-1/loop.wast ===== -- 68/68 (100.00%) - -===== ../test-interpreter/spec-test-1/memory.wast ===== -- 61/61 (100.00%) - -===== ../test-interpreter/spec-test-1/memory_grow.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-1/memory_redundancy.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-1/memory_size.wast ===== -- 44/44 (100.00%) - -===== ../test-interpreter/spec-test-1/memory_trap.wast ===== -- 175/175 (100.00%) - -===== ../test-interpreter/spec-test-1/names.wast ===== - print_i32: 42 - print_i32: 123 -- 487/487 (100.00%) - -===== ../test-interpreter/spec-test-1/nop.wast ===== -- 85/85 (100.00%) - -===== ../test-interpreter/spec-test-1/return.wast ===== -- 65/65 (100.00%) - -===== ../test-interpreter/spec-test-1/select.wast ===== -- 96/96 (100.00%) - -===== ../test-interpreter/spec-test-1/skip-stack-guard-page.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-1/stack.wast ===== -- 7/7 (100.00%) - -===== ../test-interpreter/spec-test-1/start.wast ===== - print_i32: 1 - print_i32: 2 - print: () -- 22/22 (100.00%) - -===== ../test-interpreter/spec-test-1/store.wast ===== -- 11/11 (100.00%) - -===== ../test-interpreter/spec-test-1/switch.wast ===== -- 28/28 (100.00%) - -===== ../test-interpreter/spec-test-1/token.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-1/traps.wast ===== -- 40/40 (100.00%) - -===== ../test-interpreter/spec-test-1/type.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-1/unreachable.wast ===== -- 63/63 (100.00%) - -===== ../test-interpreter/spec-test-1/unreached-invalid.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-1/unwind.wast ===== -- 51/51 (100.00%) - -===== ../test-interpreter/spec-test-1/utf8-custom-section-id.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-1/utf8-import-field.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-1/utf8-import-module.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-1/utf8-invalid-encoding.wast ===== -- 0/0 (100.00%) - 8 parsing fail -Total [10584/10584] (100.00%) - == Complete. Running test for Wasm 2.0... spectec 0.5 generator @@ -295,119 +85,7 @@ spectec 0.5 generator == Translating to AL... == Initializing interpreter... == Interpreting... -===== ../test-interpreter/spec-test-2/address.wast ===== -- 263/263 (100.00%) - -===== ../test-interpreter/spec-test-2/align.wast ===== -- 98/98 (100.00%) - -===== ../test-interpreter/spec-test-2/binary-leb128.wast ===== -- 52/52 (100.00%) - -===== ../test-interpreter/spec-test-2/binary.wast ===== -- 76/76 (100.00%) - -===== ../test-interpreter/spec-test-2/block.wast ===== -- 54/54 (100.00%) - -===== ../test-interpreter/spec-test-2/br.wast ===== -- 78/78 (100.00%) - -===== ../test-interpreter/spec-test-2/br_if.wast ===== -- 90/90 (100.00%) - -===== ../test-interpreter/spec-test-2/br_table.wast ===== -- 151/151 (100.00%) - -===== ../test-interpreter/spec-test-2/bulk.wast ===== -- 130/130 (100.00%) - -===== ../test-interpreter/spec-test-2/call.wast ===== -- 72/72 (100.00%) - -===== ../test-interpreter/spec-test-2/call_indirect.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/comments.wast ===== -- 8/8 (100.00%) - -===== ../test-interpreter/spec-test-2/const.wast ===== -- 1104/1104 (100.00%) - -===== ../test-interpreter/spec-test-2/conversions.wast ===== -- 595/595 (100.00%) - -===== ../test-interpreter/spec-test-2/custom.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-2/data.wast ===== -- 78/78 (100.00%) - -===== ../test-interpreter/spec-test-2/elem.wast ===== -- 107/107 (100.00%) - -===== ../test-interpreter/spec-test-2/endianness.wast ===== -- 70/70 (100.00%) - -===== ../test-interpreter/spec-test-2/exports.wast ===== -- 121/121 (100.00%) - -===== ../test-interpreter/spec-test-2/f32.wast ===== -- 2502/2502 (100.00%) - -===== ../test-interpreter/spec-test-2/f32_bitwise.wast ===== -- 362/362 (100.00%) - -===== ../test-interpreter/spec-test-2/f32_cmp.wast ===== -- 2402/2402 (100.00%) - -===== ../test-interpreter/spec-test-2/f64.wast ===== -- 2502/2502 (100.00%) - -===== ../test-interpreter/spec-test-2/f64_bitwise.wast ===== -- 362/362 (100.00%) - -===== ../test-interpreter/spec-test-2/f64_cmp.wast ===== -- 2402/2402 (100.00%) - -===== ../test-interpreter/spec-test-2/fac.wast ===== -- 8/8 (100.00%) - -===== ../test-interpreter/spec-test-2/float_exprs.wast ===== -- 996/996 (100.00%) - -===== ../test-interpreter/spec-test-2/float_literals.wast ===== -- 87/87 (100.00%) - -===== ../test-interpreter/spec-test-2/float_memory.wast ===== -- 96/96 (100.00%) - -===== ../test-interpreter/spec-test-2/float_misc.wast ===== -- 442/442 (100.00%) - -===== ../test-interpreter/spec-test-2/forward.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-2/func.wast ===== -- 104/104 (100.00%) - -===== ../test-interpreter/spec-test-2/func_ptrs.wast ===== - print_i32: 83 -- 32/32 (100.00%) - -===== ../test-interpreter/spec-test-2/global.wast ===== -- 68/68 (100.00%) - -===== ../test-interpreter/spec-test-2/i32.wast ===== -- 376/376 (100.00%) - -===== ../test-interpreter/spec-test-2/i64.wast ===== -- 386/386 (100.00%) - -===== ../test-interpreter/spec-test-2/if.wast ===== -- 125/125 (100.00%) - -===== ../test-interpreter/spec-test-2/imports.wast ===== - print_i32: 13 - print_i32_f32: 14 42 - print_i32: 13 @@ -421,342 +99,11 @@ spectec 0.5 generator - print_f64: 24 - print_f64: 24 - print_i32: 13 -- 213/213 (100.00%) - -===== ../test-interpreter/spec-test-2/inline-module.wast ===== -- 1/1 (100.00%) - -===== ../test-interpreter/spec-test-2/int_exprs.wast ===== -- 127/127 (100.00%) - -===== ../test-interpreter/spec-test-2/int_literals.wast ===== -- 32/32 (100.00%) - -===== ../test-interpreter/spec-test-2/labels.wast ===== -- 27/27 (100.00%) - -===== ../test-interpreter/spec-test-2/left-to-right.wast ===== -- 97/97 (100.00%) - -===== ../test-interpreter/spec-test-2/linking.wast ===== -- 151/151 (100.00%) - -===== ../test-interpreter/spec-test-2/load.wast ===== -- 39/39 (100.00%) - -===== ../test-interpreter/spec-test-2/local_get.wast ===== -- 21/21 (100.00%) - -===== ../test-interpreter/spec-test-2/local_set.wast ===== -- 21/21 (100.00%) - -===== ../test-interpreter/spec-test-2/local_tee.wast ===== -- 57/57 (100.00%) - -===== ../test-interpreter/spec-test-2/loop.wast ===== -- 79/79 (100.00%) - -===== ../test-interpreter/spec-test-2/memory.wast ===== -- 65/65 (100.00%) - -===== ../test-interpreter/spec-test-2/memory_copy.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/memory_fill.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/memory_grow.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/memory_init.wast ===== -- 197/197 (100.00%) - -===== ../test-interpreter/spec-test-2/memory_redundancy.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-2/memory_size.wast ===== -- 44/44 (100.00%) - -===== ../test-interpreter/spec-test-2/memory_trap.wast ===== -- 184/184 (100.00%) - -===== ../test-interpreter/spec-test-2/names.wast ===== - print_i32: 42 - print_i32: 123 -- 490/490 (100.00%) - -===== ../test-interpreter/spec-test-2/nop.wast ===== -- 85/85 (100.00%) - -===== ../test-interpreter/spec-test-2/ref_func.wast ===== -- 16/16 (100.00%) - -===== ../test-interpreter/spec-test-2/ref_is_null.wast ===== -- 15/15 (100.00%) - -===== ../test-interpreter/spec-test-2/ref_null.wast ===== -- 4/4 (100.00%) - -===== ../test-interpreter/spec-test-2/return.wast ===== -- 65/65 (100.00%) - -===== ../test-interpreter/spec-test-2/select.wast ===== -- 122/122 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_address.wast ===== -- 48/48 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_align.wast ===== -- 100/100 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_bit_shift.wast ===== -- 215/215 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_bitwise.wast ===== -- 143/143 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_boolean.wast ===== -- 263/263 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_const.wast ===== -- 889/889 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_conversions.wast ===== -- 236/236 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f32x4.wast ===== -- 776/776 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f32x4_arith.wast ===== -- 1809/1809 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f32x4_cmp.wast ===== -- 2585/2585 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f32x4_pmin_pmax.wast ===== -- 3874/3874 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f32x4_rounding.wast ===== -- 178/178 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f64x2.wast ===== -- 797/797 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f64x2_arith.wast ===== -- 1812/1812 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f64x2_cmp.wast ===== -- 2663/2663 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f64x2_pmin_pmax.wast ===== -- 3874/3874 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_f64x2_rounding.wast ===== -- 178/178 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i16x8_arith.wast ===== -- 185/185 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i16x8_arith2.wast ===== -- 155/155 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i16x8_cmp.wast ===== -- 437/437 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i16x8_extadd_pairwise_i8x16.wast ===== -- 18/18 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i16x8_extmul_i8x16.wast ===== -- 106/106 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i16x8_q15mulr_sat_s.wast ===== -- 28/28 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i16x8_sat_arith.wast ===== -- 208/208 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i32x4_arith.wast ===== -- 185/185 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i32x4_arith2.wast ===== -- 125/125 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i32x4_cmp.wast ===== -- 437/437 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i32x4_dot_i16x8.wast ===== -- 28/28 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i32x4_extadd_pairwise_i16x8.wast ===== -- 18/18 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i32x4_extmul_i16x8.wast ===== -- 106/106 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i32x4_trunc_sat_f32x4.wast ===== -- 104/104 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i32x4_trunc_sat_f64x2.wast ===== -- 104/104 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i64x2_arith.wast ===== -- 191/191 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i64x2_arith2.wast ===== -- 25/25 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i64x2_cmp.wast ===== -- 104/104 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i64x2_extmul_i32x4.wast ===== -- 106/106 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i8x16_arith.wast ===== -- 125/125 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i8x16_arith2.wast ===== -- 188/188 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i8x16_cmp.wast ===== -- 417/417 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_i8x16_sat_arith.wast ===== -- 192/192 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_int_to_int_extend.wast ===== -- 230/230 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_lane.wast ===== -- 298/298 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_linking.wast ===== -- 4/4 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_load.wast ===== -- 45/45 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_load16_lane.wast ===== -- 34/34 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_load32_lane.wast ===== -- 22/22 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_load64_lane.wast ===== -- 14/14 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_load8_lane.wast ===== -- 50/50 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_load_extend.wast ===== -- 88/88 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_load_splat.wast ===== -- 116/116 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_load_zero.wast ===== -- 31/31 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_splat.wast ===== -- 166/166 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_store.wast ===== -- 21/21 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_store16_lane.wast ===== -- 34/34 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_store32_lane.wast ===== -- 22/22 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_store64_lane.wast ===== -- 14/14 (100.00%) - -===== ../test-interpreter/spec-test-2/simd/simd_store8_lane.wast ===== -- 50/50 (100.00%) - -===== ../test-interpreter/spec-test-2/skip-stack-guard-page.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-2/stack.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-2/start.wast ===== - print_i32: 1 - print_i32: 2 - print: () -- 22/22 (100.00%) - -===== ../test-interpreter/spec-test-2/store.wast ===== -- 11/11 (100.00%) - -===== ../test-interpreter/spec-test-2/switch.wast ===== -- 28/28 (100.00%) - -===== ../test-interpreter/spec-test-2/table-sub.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/table.wast ===== -- 18/18 (100.00%) - -===== ../test-interpreter/spec-test-2/table_copy.wast ===== -- 1779/1779 (100.00%) - -===== ../test-interpreter/spec-test-2/table_fill.wast ===== -- 37/37 (100.00%) - -===== ../test-interpreter/spec-test-2/table_get.wast ===== -- 12/12 (100.00%) - -===== ../test-interpreter/spec-test-2/table_grow.wast ===== -- 48/48 (100.00%) - -===== ../test-interpreter/spec-test-2/table_init.wast ===== -- 747/747 (100.00%) - -===== ../test-interpreter/spec-test-2/table_set.wast ===== -- 20/20 (100.00%) - -===== ../test-interpreter/spec-test-2/table_size.wast ===== -- 38/38 (100.00%) - -===== ../test-interpreter/spec-test-2/token.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/tokens.wast ===== -- 70/70 (100.00%) - -===== ../test-interpreter/spec-test-2/traps.wast ===== -- 40/40 (100.00%) - -===== ../test-interpreter/spec-test-2/type.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-2/unreachable.wast ===== -- 65/65 (100.00%) - -===== ../test-interpreter/spec-test-2/unreached-invalid.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/unreached-valid.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-2/unwind.wast ===== -- 51/51 (100.00%) - -===== ../test-interpreter/spec-test-2/utf8-custom-section-id.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/utf8-import-field.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/utf8-import-module.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-2/utf8-invalid-encoding.wast ===== -- 0/0 (100.00%) - -Total [46851/46851] (100.00%) - == Complete. Running test for Wasm 3.0... spectec 0.5 generator @@ -768,218 +115,7 @@ spectec 0.5 generator == Translating to AL... == Initializing interpreter... == Interpreting... -===== ../test-interpreter/spec-test-3/address.wast ===== -- 264/264 (100.00%) - -===== ../test-interpreter/spec-test-3/align.wast ===== -- 142/142 (100.00%) - -===== ../test-interpreter/spec-test-3/annotations.wast ===== -- 20/20 (100.00%) - -===== ../test-interpreter/spec-test-3/binary-leb128.wast ===== -- 66/66 (100.00%) - -===== ../test-interpreter/spec-test-3/binary.wast ===== -- 40/40 (100.00%) - -===== ../test-interpreter/spec-test-3/block.wast ===== -- 209/209 (100.00%) - -===== ../test-interpreter/spec-test-3/br.wast ===== -- 98/98 (100.00%) - -===== ../test-interpreter/spec-test-3/br_if.wast ===== -- 120/120 (100.00%) - -===== ../test-interpreter/spec-test-3/br_on_non_null.wast ===== -- 15/15 (100.00%) - -===== ../test-interpreter/spec-test-3/br_on_null.wast ===== -- 13/13 (100.00%) - -===== ../test-interpreter/spec-test-3/br_table.wast ===== -- 187/187 (100.00%) - -===== ../test-interpreter/spec-test-3/bulk-memory/bulk.wast ===== -- 130/130 (100.00%) - -===== ../test-interpreter/spec-test-3/bulk-memory/memory_copy.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/bulk-memory/memory_fill.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/bulk-memory/memory_init.wast ===== -- 264/264 (100.00%) - -===== ../test-interpreter/spec-test-3/bulk-memory/table-sub.wast ===== -- 4/4 (100.00%) - -===== ../test-interpreter/spec-test-3/bulk-memory/table_copy.wast ===== -- 1779/1779 (100.00%) - -===== ../test-interpreter/spec-test-3/bulk-memory/table_fill.wast ===== -- 46/46 (100.00%) - -===== ../test-interpreter/spec-test-3/bulk-memory/table_init.wast ===== -- 814/814 (100.00%) - -===== ../test-interpreter/spec-test-3/call.wast ===== -- 90/90 (100.00%) - -===== ../test-interpreter/spec-test-3/call_indirect.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/call_ref.wast ===== -- 39/39 (100.00%) - -===== ../test-interpreter/spec-test-3/comments.wast ===== -- 13/13 (100.00%) - -===== ../test-interpreter/spec-test-3/const.wast ===== -- 1104/1104 (100.00%) - -===== ../test-interpreter/spec-test-3/conversions.wast ===== -- 620/620 (100.00%) - -===== ../test-interpreter/spec-test-3/custom.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-3/data.wast ===== -- 110/110 (100.00%) - -===== ../test-interpreter/spec-test-3/elem.wast ===== -- 236/236 (100.00%) - -===== ../test-interpreter/spec-test-3/endianness.wast ===== -- 70/70 (100.00%) - -===== ../test-interpreter/spec-test-3/exceptions/tag.wast ===== -- 12/12 (100.00%) - -===== ../test-interpreter/spec-test-3/exceptions/throw.wast ===== -- 14/14 (100.00%) - -===== ../test-interpreter/spec-test-3/exceptions/throw_ref.wast ===== -- 16/16 (100.00%) - -===== ../test-interpreter/spec-test-3/exceptions/try_table.wast ===== -- 64/64 (100.00%) - -===== ../test-interpreter/spec-test-3/exports.wast ===== -- 153/153 (100.00%) - -===== ../test-interpreter/spec-test-3/f32.wast ===== -- 2513/2513 (100.00%) - -===== ../test-interpreter/spec-test-3/f32_bitwise.wast ===== -- 365/365 (100.00%) - -===== ../test-interpreter/spec-test-3/f32_cmp.wast ===== -- 2408/2408 (100.00%) - -===== ../test-interpreter/spec-test-3/f64.wast ===== -- 2513/2513 (100.00%) - -===== ../test-interpreter/spec-test-3/f64_bitwise.wast ===== -- 365/365 (100.00%) - -===== ../test-interpreter/spec-test-3/f64_cmp.wast ===== -- 2408/2408 (100.00%) - -===== ../test-interpreter/spec-test-3/fac.wast ===== -- 8/8 (100.00%) - -===== ../test-interpreter/spec-test-3/float_exprs.wast ===== -- 1025/1025 (100.00%) - -===== ../test-interpreter/spec-test-3/float_literals.wast ===== -- 103/103 (100.00%) - -===== ../test-interpreter/spec-test-3/float_memory.wast ===== -- 96/96 (100.00%) - -===== ../test-interpreter/spec-test-3/float_misc.wast ===== -- 472/472 (100.00%) - -===== ../test-interpreter/spec-test-3/forward.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-3/func.wast ===== -- 156/156 (100.00%) - -===== ../test-interpreter/spec-test-3/func_ptrs.wast ===== - print_i32: 83 -- 39/39 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/array.wast ===== -- 61/61 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/array_copy.wast ===== -- 36/36 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/array_fill.wast ===== -- 18/18 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/array_init_data.wast ===== -- 48/48 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/array_init_elem.wast ===== -- 24/24 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/array_new_data.wast ===== -- 33/33 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/array_new_elem.wast ===== -- 26/26 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/binary-gc.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/br_on_cast.wast ===== -- 40/40 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/br_on_cast_fail.wast ===== -- 40/40 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/extern.wast ===== -- 19/19 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/i31.wast ===== -- 79/79 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/ref_cast.wast ===== -- 47/47 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/ref_eq.wast ===== -- 90/90 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/ref_test.wast ===== -- 73/73 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/struct.wast ===== -- 35/35 (100.00%) - -===== ../test-interpreter/spec-test-3/gc/type-subtyping.wast ===== -- 151/151 (100.00%) - -===== ../test-interpreter/spec-test-3/global.wast ===== -- 125/125 (100.00%) - -===== ../test-interpreter/spec-test-3/i32.wast ===== -- 459/459 (100.00%) - -===== ../test-interpreter/spec-test-3/i64.wast ===== -- 415/415 (100.00%) - -===== ../test-interpreter/spec-test-3/id.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-3/if.wast ===== -- 218/218 (100.00%) - -===== ../test-interpreter/spec-test-3/imports.wast ===== - print_i32: 13 - print_i32_f32: 14 42 - print_i32: 13 @@ -993,575 +129,10 @@ spectec 0.5 generator - print_f64: 24 - print_f64: 24 - print_i32: 13 -- 264/264 (100.00%) - -===== ../test-interpreter/spec-test-3/inline-module.wast ===== -- 1/1 (100.00%) - -===== ../test-interpreter/spec-test-3/instance.wast ===== -- 23/23 (100.00%) - -===== ../test-interpreter/spec-test-3/int_exprs.wast ===== -- 127/127 (100.00%) - -===== ../test-interpreter/spec-test-3/int_literals.wast ===== -- 32/32 (100.00%) - -===== ../test-interpreter/spec-test-3/labels.wast ===== -- 30/30 (100.00%) - -===== ../test-interpreter/spec-test-3/left-to-right.wast ===== -- 97/97 (100.00%) - -===== ../test-interpreter/spec-test-3/linking.wast ===== -- 182/182 (100.00%) - -===== ../test-interpreter/spec-test-3/load.wast ===== -- 85/85 (100.00%) - -===== ../test-interpreter/spec-test-3/local_get.wast ===== -- 37/37 (100.00%) - -===== ../test-interpreter/spec-test-3/local_init.wast ===== -- 12/12 (100.00%) - -===== ../test-interpreter/spec-test-3/local_set.wast ===== -- 54/54 (100.00%) - -===== ../test-interpreter/spec-test-3/local_tee.wast ===== -- 99/99 (100.00%) - -===== ../test-interpreter/spec-test-3/loop.wast ===== -- 106/106 (100.00%) - -===== ../test-interpreter/spec-test-3/memory.wast ===== -- 98/98 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/address64.wast ===== -- 246/246 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/align64.wast ===== -- 137/137 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/binary_leb128_64.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/bulk64.wast ===== -- 75/75 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/call_indirect64.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/endianness64.wast ===== -- 70/70 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/float_memory64.wast ===== -- 96/96 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/load64.wast ===== -- 85/85 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/memory64-imports.wast ===== -- 110/110 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/memory64.wast ===== -- 78/78 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/memory_copy64.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/memory_fill64.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/memory_grow64.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/memory_init64.wast ===== -- 264/264 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/memory_redundancy64.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/memory_trap64.wast ===== -- 174/174 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table64.wast ===== -- 25/25 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table_copy64.wast ===== -- 1779/1779 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table_copy_mixed.wast ===== -- 5/5 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table_fill64.wast ===== -- 81/81 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table_get64.wast ===== -- 12/12 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table_grow64.wast ===== -- 23/23 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table_init64.wast ===== -- 913/913 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table_set64.wast ===== -- 20/20 (100.00%) - -===== ../test-interpreter/spec-test-3/memory64/table_size64.wast ===== -- 38/38 (100.00%) - -===== ../test-interpreter/spec-test-3/memory_grow.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/memory_redundancy.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-3/memory_size.wast ===== -- 46/46 (100.00%) - -===== ../test-interpreter/spec-test-3/memory_trap.wast ===== -- 184/184 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/address0.wast ===== -- 93/93 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/address1.wast ===== -- 128/128 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/align0.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/binary0.wast ===== -- 10/10 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/data0.wast ===== -- 14/14 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/data1.wast ===== -- 28/28 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/data_drop0.wast ===== -- 12/12 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/exports0.wast ===== -- 16/16 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/float_exprs0.wast ===== -- 15/15 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/float_exprs1.wast ===== -- 4/4 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/float_memory0.wast ===== -- 32/32 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/imports0.wast ===== -- 8/8 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/imports1.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/imports2.wast ===== -- 24/24 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/imports3.wast ===== -- 10/10 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/imports4.wast ===== -- 18/18 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/linking0.wast ===== -- 7/7 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/linking1.wast ===== -- 19/19 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/linking2.wast ===== -- 12/12 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/linking3.wast ===== -- 17/17 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/load0.wast ===== -- 4/4 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/load1.wast ===== -- 19/19 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/load2.wast ===== -- 39/39 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory-multi.wast ===== -- 8/8 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_copy0.wast ===== -- 30/30 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_copy1.wast ===== -- 15/15 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_fill0.wast ===== -- 17/17 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_grow.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_init0.wast ===== -- 14/14 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_size0.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_size1.wast ===== -- 16/16 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_size2.wast ===== -- 22/22 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_size3.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_size_import.wast ===== -- 8/8 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_trap0.wast ===== -- 15/15 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/memory_trap1.wast ===== -- 169/169 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/start0.wast ===== -- 10/10 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/store0.wast ===== -- 6/6 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/store1.wast ===== -- 14/14 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/store2.wast ===== -- 26/26 (100.00%) - -===== ../test-interpreter/spec-test-3/multi-memory/traps0.wast ===== -- 16/16 (100.00%) - -===== ../test-interpreter/spec-test-3/names.wast ===== - print_i32: 42 - print_i32: 123 -- 490/490 (100.00%) - -===== ../test-interpreter/spec-test-3/nop.wast ===== -- 89/89 (100.00%) - -===== ../test-interpreter/spec-test-3/obsolete-keywords.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/ref.wast ===== -- 14/14 (100.00%) - -===== ../test-interpreter/spec-test-3/ref_as_non_null.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-3/ref_func.wast ===== -- 19/19 (100.00%) - -===== ../test-interpreter/spec-test-3/ref_is_null.wast ===== -- 24/24 (100.00%) - -===== ../test-interpreter/spec-test-3/ref_null.wast ===== -- 36/36 (100.00%) - -===== ../test-interpreter/spec-test-3/relaxed-simd/i16x8_relaxed_q15mulr_s.wast ===== -- 4/4 (100.00%) - -===== ../test-interpreter/spec-test-3/relaxed-simd/i32x4_relaxed_trunc.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-3/relaxed-simd/i8x16_relaxed_swizzle.wast ===== -- 7/7 (100.00%) - -===== ../test-interpreter/spec-test-3/relaxed-simd/relaxed_dot_product.wast ===== -- 12/12 (100.00%) - -===== ../test-interpreter/spec-test-3/relaxed-simd/relaxed_laneselect.wast ===== -- 13/13 (100.00%) - -===== ../test-interpreter/spec-test-3/relaxed-simd/relaxed_madd_nmadd.wast ===== -- 21/21 (100.00%) - -===== ../test-interpreter/spec-test-3/relaxed-simd/relaxed_min_max.wast ===== -- 26/26 (100.00%) - -===== ../test-interpreter/spec-test-3/return.wast ===== -- 85/85 (100.00%) - -===== ../test-interpreter/spec-test-3/return_call.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/return_call_indirect.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/return_call_ref.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/select.wast ===== -- 160/160 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_address.wast ===== -- 50/50 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_align.wast ===== -- 112/112 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_bit_shift.wast ===== -- 239/239 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_bitwise.wast ===== -- 171/171 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_boolean.wast ===== -- 275/275 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_const.wast ===== -- 889/889 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_conversions.wast ===== -- 254/254 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f32x4.wast ===== -- 784/784 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f32x4_arith.wast ===== -- 1825/1825 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f32x4_cmp.wast ===== -- 2603/2603 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f32x4_pmin_pmax.wast ===== -- 3880/3880 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f32x4_rounding.wast ===== -- 186/186 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f64x2.wast ===== -- 805/805 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f64x2_arith.wast ===== -- 1828/1828 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f64x2_cmp.wast ===== -- 2681/2681 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f64x2_pmin_pmax.wast ===== -- 3880/3880 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_f64x2_rounding.wast ===== -- 186/186 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i16x8_arith.wast ===== -- 196/196 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i16x8_arith2.wast ===== -- 172/172 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i16x8_cmp.wast ===== -- 467/467 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i16x8_extadd_pairwise_i8x16.wast ===== -- 22/22 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i16x8_extmul_i8x16.wast ===== -- 118/118 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i16x8_q15mulr_sat_s.wast ===== -- 31/31 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i16x8_sat_arith.wast ===== -- 220/220 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i32x4_arith.wast ===== -- 196/196 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i32x4_arith2.wast ===== -- 139/139 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i32x4_cmp.wast ===== -- 467/467 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i32x4_dot_i16x8.wast ===== -- 33/33 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i32x4_extadd_pairwise_i16x8.wast ===== -- 22/22 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i32x4_extmul_i16x8.wast ===== -- 118/118 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i32x4_trunc_sat_f32x4.wast ===== -- 108/108 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i32x4_trunc_sat_f64x2.wast ===== -- 108/108 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i64x2_arith.wast ===== -- 202/202 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i64x2_arith2.wast ===== -- 27/27 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i64x2_cmp.wast ===== -- 114/114 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i64x2_extmul_i32x4.wast ===== -- 118/118 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i8x16_arith.wast ===== -- 133/133 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i8x16_arith2.wast ===== -- 207/207 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i8x16_cmp.wast ===== -- 447/447 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_i8x16_sat_arith.wast ===== -- 204/204 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_int_to_int_extend.wast ===== -- 254/254 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_lane.wast ===== -- 381/381 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_linking.wast ===== -- 4/4 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_load.wast ===== -- 50/50 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_load16_lane.wast ===== -- 37/37 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_load32_lane.wast ===== -- 25/25 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_load64_lane.wast ===== -- 17/17 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_load8_lane.wast ===== -- 53/53 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_load_extend.wast ===== -- 100/100 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_load_splat.wast ===== -- 124/124 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_load_zero.wast ===== -- 35/35 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_memory-multi.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_select.wast ===== -- 8/8 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_splat.wast ===== -- 188/188 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_store.wast ===== -- 27/27 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_store16_lane.wast ===== -- 37/37 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_store32_lane.wast ===== -- 25/25 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_store64_lane.wast ===== -- 17/17 (100.00%) - -===== ../test-interpreter/spec-test-3/simd/simd_store8_lane.wast ===== -- 53/53 (100.00%) - -===== ../test-interpreter/spec-test-3/skip-stack-guard-page.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-3/stack.wast ===== -- 9/9 (100.00%) - -===== ../test-interpreter/spec-test-3/start.wast ===== - print_i32: 1 - print_i32: 2 - print: () -- 25/25 (100.00%) - -===== ../test-interpreter/spec-test-3/store.wast ===== -- 62/62 (100.00%) - -===== ../test-interpreter/spec-test-3/switch.wast ===== -- 29/29 (100.00%) - -===== ../test-interpreter/spec-test-3/table.wast ===== -- 59/59 (100.00%) - -===== ../test-interpreter/spec-test-3/table_get.wast ===== -- 17/17 (100.00%) - -===== ../test-interpreter/spec-test-3/table_grow.wast ===== -- 64/64 (100.00%) - -===== ../test-interpreter/spec-test-3/table_set.wast ===== -- 27/27 (100.00%) - -===== ../test-interpreter/spec-test-3/table_size.wast ===== -- 40/40 (100.00%) - -===== ../test-interpreter/spec-test-3/token.wast ===== -- 70/70 (100.00%) - -===== ../test-interpreter/spec-test-3/traps.wast ===== -- 40/40 (100.00%) - -===== ../test-interpreter/spec-test-3/type-canon.wast ===== -- 4/4 (100.00%) - -===== ../test-interpreter/spec-test-3/type-equivalence.wast ===== -- 47/47 (100.00%) - -===== ../test-interpreter/spec-test-3/type-rec.wast ===== -- 37/37 (100.00%) - -===== ../test-interpreter/spec-test-3/type.wast ===== -- 2/2 (100.00%) - -===== ../test-interpreter/spec-test-3/unreachable.wast ===== -- 65/65 (100.00%) - -===== ../test-interpreter/spec-test-3/unreached-invalid.wast ===== -- 121/121 (100.00%) - -===== ../test-interpreter/spec-test-3/unreached-valid.wast ===== -- 16/16 (100.00%) - -===== ../test-interpreter/spec-test-3/unwind.wast ===== -- 51/51 (100.00%) - -===== ../test-interpreter/spec-test-3/utf8-custom-section-id.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/utf8-import-field.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/utf8-import-module.wast ===== -- 0/0 (100.00%) - -===== ../test-interpreter/spec-test-3/utf8-invalid-encoding.wast ===== -- 0/0 (100.00%) - -Total [55692/55692] (100.00%) - == Complete. ``` diff --git a/spectec/test-latex/TEST.md b/spectec/test-latex/TEST.md index f6bcb528f..af9ef0e67 100644 --- a/spectec/test-latex/TEST.md +++ b/spectec/test-latex/TEST.md @@ -881,18 +881,17 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}} -& {\mathit{dotstypex}} & ::= & {\mathit{argh}} ~~|~~ \mathsf{dx{\scriptstyle 1}} ~~|~~ \dots \\ -& {\mathit{dotstypey}} & ::= & {\mathit{argh}} ~~|~~ \mathsf{dy{\scriptstyle 1}} ~~|~~ \dots \\ -& {\mathit{dotstypex}} & ::= & \dots ~~|~~ {\mathit{borg}} ~~|~~ \mathsf{dx{\scriptstyle 2}} ~~|~~ \dots \\ +& {\mathit{dotstypex}} & ::= & {\mathit{argh}} ~~|~~ \mathsf{dx{\scriptstyle 1}} \\ +& {\mathit{dotstypey}} & ::= & {\mathit{argh}} ~~|~~ \mathsf{dy{\scriptstyle 1}} \\ +& {\mathit{dotstypex}} & ::= & \dots ~~|~~ {\mathit{borg}} ~~|~~ \mathsf{dx{\scriptstyle 2}} \\ & {\mathit{dotstypesep}} & ::= & {\mathit{borg}} \\ & {\mathit{dotstypex}} & ::= & \dots \\ & & | & {\mathit{curb}} ~~|~~ \mathsf{dx{\scriptstyle 3}} \\ & & | & \mathsf{dx{\scriptstyle 4}} ~~|~~ \mathsf{dx{\scriptstyle 5}} \\ -& & | & \mathsf{dx{\scriptstyle 6}} ~~|~~ \dots \\ +& & | & \mathsf{dx{\scriptstyle 6}} \\ & {\mathit{dotstypey}} & ::= & \dots \\ & & | & {\mathit{borg}} ~~|~~ \mathsf{dy{\scriptstyle 2}} \\ & & | & \mathsf{dy{\scriptstyle 3}} ~~|~~ \mathsf{dy{\scriptstyle 4}} \\ -& & | & \dots \\ & {\mathit{dotstypex}} & ::= & \dots ~~|~~ {\mathit{dork}} ~~|~~ \mathsf{dx{\scriptstyle 7}} \\ & {\mathit{dotstypey}} & ::= & \dots \\ & & | & {\mathit{dork}} \\ @@ -950,29 +949,29 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{gram}} & ::= & \mbox{‘}\mathtt{GA}\mbox{’}~~\mbox{‘}\mathtt{GB}\mbox{’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ -& & | & \mbox{‘}\mathtt{GB}\mbox{’}~~\mbox{‘}\mathtt{GC}\mbox{’}~~\mbox{‘}\mathtt{GD}\mbox{’} & \quad\Rightarrow\quad{} & 0 \\ -& & | & \mbox{‘}\mathtt{GC}\mbox{’}~~\mbox{‘}\mathtt{GD}\mbox{’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ -& & | & \mbox{‘}\mathtt{GD}\mbox{’}~~\mbox{‘}\mathtt{GE}\mbox{’} & \quad\Rightarrow\quad{} & 0 & \quad +& {\mathtt{gram}} & ::= & \mbox{‘\texttt{GA}’}~~\mbox{‘\texttt{GB}’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ +& & | & \mbox{‘\texttt{GB}’}~~\mbox{‘\texttt{GC}’}~~\mbox{‘\texttt{GD}’} & \quad\Rightarrow\quad{} & 0 \\ +& & | & \mbox{‘\texttt{GC}’}~~\mbox{‘\texttt{GD}’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ +& & | & \mbox{‘\texttt{GD}’}~~\mbox{‘\texttt{GE}’} & \quad\Rightarrow\quad{} & 0 & \quad \begin{array}[t]{@{}l@{}} \mbox{if}~ 0 < 1 \\ {\land}~ 1 > 0 \\ \end{array} \\ -& & | & \mbox{‘}\mathtt{GE}\mbox{’}~~\mbox{‘}\mathtt{GF}\mbox{’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ -& & | & \mbox{‘}\mathtt{GFA}\mbox{’}~~\mbox{‘}\mathtt{GF}\mbox{’} ~\Rightarrow~ 0 ~~|~~ \mbox{‘}\mathtt{GFB}\mbox{’}~~\mbox{‘}\mathtt{GF}\mbox{’} ~\Rightarrow~ 1 ~~|~~ \mbox{‘}\mathtt{GFC}\mbox{’} & \quad\Rightarrow\quad{} & 2 \\ -& & | & \mbox{‘}\mathtt{GG}\mbox{’} & \quad\Rightarrow\quad{} & & \\ +& & | & \mbox{‘\texttt{GE}’}~~\mbox{‘\texttt{GF}’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ +& & | & \mbox{‘\texttt{GFA}’}~~\mbox{‘\texttt{GF}’} ~\Rightarrow~ 0 ~~|~~ \mbox{‘\texttt{GFB}’}~~\mbox{‘\texttt{GF}’} ~\Rightarrow~ 1 ~~|~~ \mbox{‘\texttt{GFC}’} & \quad\Rightarrow\quad{} & 2 \\ +& & | & \mbox{‘\texttt{GG}’} & \quad\Rightarrow\quad{} & & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \begin{array}[t]{@{}l@{}l@{}} 0 & \quad \mbox{if}~ 1 > 0 \\ \end{array} } \\ -& & | & \mbox{‘}\mathtt{GH}\mbox{’} & \quad\Rightarrow\quad{} & & \\ +& & | & \mbox{‘\texttt{GH}’} & \quad\Rightarrow\quad{} & & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \begin{array}[t]{@{}l@{}l@{}} 0 & \quad \mbox{if}~ 1 > 0 \\ \end{array} } \\ -& & | & \mbox{‘}\mathtt{GI}\mbox{’} & \quad\Rightarrow\quad{} & & \\ +& & | & \mbox{‘\texttt{GI}’} & \quad\Rightarrow\quad{} & & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \begin{array}[t]{@{}l@{}l@{}} \begin{array}[t]{@{}l@{}} 0 \\ @@ -984,15 +983,15 @@ $$ \end{array} \\ \end{array} } \\ -& & | & \begin{array}[t]{@{}l@{}} \mbox{‘}\mathtt{GJ}\mbox{’}~~\mbox{‘}\mathtt{GJ}\mbox{’} \\ - \mbox{‘}\mathtt{G}\mbox{’}~~\mbox{‘}\mathtt{J}\mbox{’} \end{array} & \quad\Rightarrow\quad{} & 0 \\ -& & | & \begin{array}[t]{@{}l@{}} \mbox{‘}\mathtt{GK}\mbox{’}~~\mbox{‘}\mathtt{GJ}\mbox{’} \\ - \mbox{‘}\mathtt{G}\mbox{’}~~\mbox{‘}\mathtt{J}\mbox{’} \end{array} & \quad\Rightarrow\quad{} & 0 & \quad +& & | & \begin{array}[t]{@{}l@{}} \mbox{‘\texttt{GJ}’}~~\mbox{‘\texttt{GJ}’} \\ + \mbox{‘\texttt{G}’}~~\mbox{‘\texttt{J}’} \end{array} & \quad\Rightarrow\quad{} & 0 \\ +& & | & \begin{array}[t]{@{}l@{}} \mbox{‘\texttt{GK}’}~~\mbox{‘\texttt{GJ}’} \\ + \mbox{‘\texttt{G}’}~~\mbox{‘\texttt{J}’} \end{array} & \quad\Rightarrow\quad{} & 0 & \quad \begin{array}[t]{@{}l@{}} \mbox{if}~ 0 < 1 \\ {\land}~ 1 > 0 \\ \end{array} \\ -& & | & \mbox{‘}\mathtt{GI}\mbox{’} & \quad\Rightarrow\quad{} & 0~1~2 & \\ +& & | & \mbox{‘\texttt{GI}’} & \quad\Rightarrow\quad{} & 0~1~2 & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \quad \begin{array}[t]{@{}l@{}} @@ -1000,7 +999,7 @@ $$ {\land}~ 1 > 0 \\ \end{array} } \\ -& & | & \mbox{‘}\mathtt{GI}\mbox{’} & \quad\Rightarrow\quad{} & & \\ +& & | & \mbox{‘\texttt{GI}’} & \quad\Rightarrow\quad{} & & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \begin{array}[t]{@{}l@{}l@{}l@{}} \begin{array}[t]{@{}l@{}} 0 \\ @@ -2066,18 +2065,17 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}} -& {\dotstypex} & ::= & {\argh} ~~|~~ \DX1 ~~|~~ \dots \\ -& {\dotstypey} & ::= & {\argh} ~~|~~ \DY1 ~~|~~ \dots \\ -& {\dotstypex} & ::= & \dots ~~|~~ {\borg} ~~|~~ \DX2 ~~|~~ \dots \\ +& {\dotstypex} & ::= & {\argh} ~~|~~ \DX1 \\ +& {\dotstypey} & ::= & {\argh} ~~|~~ \DY1 \\ +& {\dotstypex} & ::= & \dots ~~|~~ {\borg} ~~|~~ \DX2 \\ & {\dotstypesep} & ::= & {\borg} \\ & {\dotstypex} & ::= & \dots \\ & & | & {\curb} ~~|~~ \DX3 \\ & & | & \DX4 ~~|~~ \DX5 \\ -& & | & \DX6 ~~|~~ \dots \\ +& & | & \DX6 \\ & {\dotstypey} & ::= & \dots \\ & & | & {\borg} ~~|~~ \DY2 \\ & & | & \DY3 ~~|~~ \DY4 \\ -& & | & \dots \\ & {\dotstypex} & ::= & \dots ~~|~~ {\dork} ~~|~~ \DX7 \\ & {\dotstypey} & ::= & \dots \\ & & | & {\dork} \\ @@ -2135,29 +2133,29 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\gram} & ::= & \mbox{‘}\mathtt{GA}\mbox{’}~~\mbox{‘}\mathtt{GB}\mbox{’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ -& & | & \mbox{‘}\mathtt{GB}\mbox{’}~~\mbox{‘}\mathtt{GC}\mbox{’}~~\mbox{‘}\mathtt{GD}\mbox{’} & \quad\Rightarrow\quad{} & 0 \\ -& & | & \mbox{‘}\mathtt{GC}\mbox{’}~~\mbox{‘}\mathtt{GD}\mbox{’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ -& & | & \mbox{‘}\mathtt{GD}\mbox{’}~~\mbox{‘}\mathtt{GE}\mbox{’} & \quad\Rightarrow\quad{} & 0 & \quad +& {\gram} & ::= & \mbox{‘\texttt{GA}’}~~\mbox{‘\texttt{GB}’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ +& & | & \mbox{‘\texttt{GB}’}~~\mbox{‘\texttt{GC}’}~~\mbox{‘\texttt{GD}’} & \quad\Rightarrow\quad{} & 0 \\ +& & | & \mbox{‘\texttt{GC}’}~~\mbox{‘\texttt{GD}’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ +& & | & \mbox{‘\texttt{GD}’}~~\mbox{‘\texttt{GE}’} & \quad\Rightarrow\quad{} & 0 & \quad \begin{array}[t]{@{}l@{}} \mbox{if}~ 0 < 1 \\ {\land}~ 1 > 0 \\ \end{array} \\ -& & | & \mbox{‘}\mathtt{GE}\mbox{’}~~\mbox{‘}\mathtt{GF}\mbox{’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ -& & | & \mbox{‘}\mathtt{GFA}\mbox{’}~~\mbox{‘}\mathtt{GF}\mbox{’} ~\Rightarrow~ 0 ~~|~~ \mbox{‘}\mathtt{GFB}\mbox{’}~~\mbox{‘}\mathtt{GF}\mbox{’} ~\Rightarrow~ 1 ~~|~~ \mbox{‘}\mathtt{GFC}\mbox{’} & \quad\Rightarrow\quad{} & 2 \\ -& & | & \mbox{‘}\mathtt{GG}\mbox{’} & \quad\Rightarrow\quad{} & & \\ +& & | & \mbox{‘\texttt{GE}’}~~\mbox{‘\texttt{GF}’} & \quad\Rightarrow\quad{} & 0 & \quad \mbox{if}~ 0 < 1 \\ +& & | & \mbox{‘\texttt{GFA}’}~~\mbox{‘\texttt{GF}’} ~\Rightarrow~ 0 ~~|~~ \mbox{‘\texttt{GFB}’}~~\mbox{‘\texttt{GF}’} ~\Rightarrow~ 1 ~~|~~ \mbox{‘\texttt{GFC}’} & \quad\Rightarrow\quad{} & 2 \\ +& & | & \mbox{‘\texttt{GG}’} & \quad\Rightarrow\quad{} & & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \begin{array}[t]{@{}l@{}l@{}} 0 & \quad \mbox{if}~ 1 > 0 \\ \end{array} } \\ -& & | & \mbox{‘}\mathtt{GH}\mbox{’} & \quad\Rightarrow\quad{} & & \\ +& & | & \mbox{‘\texttt{GH}’} & \quad\Rightarrow\quad{} & & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \begin{array}[t]{@{}l@{}l@{}} 0 & \quad \mbox{if}~ 1 > 0 \\ \end{array} } \\ -& & | & \mbox{‘}\mathtt{GI}\mbox{’} & \quad\Rightarrow\quad{} & & \\ +& & | & \mbox{‘\texttt{GI}’} & \quad\Rightarrow\quad{} & & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \begin{array}[t]{@{}l@{}l@{}} \begin{array}[t]{@{}l@{}} 0 \\ @@ -2169,15 +2167,15 @@ $$ \end{array} \\ \end{array} } \\ -& & | & \begin{array}[t]{@{}l@{}} \mbox{‘}\mathtt{GJ}\mbox{’}~~\mbox{‘}\mathtt{GJ}\mbox{’} \\ - \mbox{‘}\mathtt{G}\mbox{’}~~\mbox{‘}\mathtt{J}\mbox{’} \end{array} & \quad\Rightarrow\quad{} & 0 \\ -& & | & \begin{array}[t]{@{}l@{}} \mbox{‘}\mathtt{GK}\mbox{’}~~\mbox{‘}\mathtt{GJ}\mbox{’} \\ - \mbox{‘}\mathtt{G}\mbox{’}~~\mbox{‘}\mathtt{J}\mbox{’} \end{array} & \quad\Rightarrow\quad{} & 0 & \quad +& & | & \begin{array}[t]{@{}l@{}} \mbox{‘\texttt{GJ}’}~~\mbox{‘\texttt{GJ}’} \\ + \mbox{‘\texttt{G}’}~~\mbox{‘\texttt{J}’} \end{array} & \quad\Rightarrow\quad{} & 0 \\ +& & | & \begin{array}[t]{@{}l@{}} \mbox{‘\texttt{GK}’}~~\mbox{‘\texttt{GJ}’} \\ + \mbox{‘\texttt{G}’}~~\mbox{‘\texttt{J}’} \end{array} & \quad\Rightarrow\quad{} & 0 & \quad \begin{array}[t]{@{}l@{}} \mbox{if}~ 0 < 1 \\ {\land}~ 1 > 0 \\ \end{array} \\ -& & | & \mbox{‘}\mathtt{GI}\mbox{’} & \quad\Rightarrow\quad{} & 0~1~2 & \\ +& & | & \mbox{‘\texttt{GI}’} & \quad\Rightarrow\quad{} & 0~1~2 & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \quad \begin{array}[t]{@{}l@{}} @@ -2185,7 +2183,7 @@ $$ {\land}~ 1 > 0 \\ \end{array} } \\ -& & | & \mbox{‘}\mathtt{GI}\mbox{’} & \quad\Rightarrow\quad{} & & \\ +& & | & \mbox{‘\texttt{GI}’} & \quad\Rightarrow\quad{} & & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \begin{array}[t]{@{}l@{}l@{}l@{}} \begin{array}[t]{@{}l@{}} 0 \\ @@ -3878,7 +3876,7 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}} \mbox{(memory argument)} & {\mathit{memarg}} & ::= & \{ \begin{array}[t]{@{}l@{}l@{}} -\mathsf{align}~{\mathit{u{\kern-0.1em\scriptstyle 32}}} , \mathsf{offset}~{\mathit{u{\kern-0.1em\scriptstyle 32}}} \} \\ +\mathsf{align}~{\mathit{u{\kern-0.1em\scriptstyle 32}}} , \mathsf{offset}~{\mathit{u{\kern-0.1em\scriptstyle 64}}} \} \\ \end{array} \\ \end{array} $$ @@ -3903,7 +3901,7 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}} \mbox{(block type)} & {\mathit{blocktype}} & ::= & {{\mathit{valtype}}^?} \\ -& & | & {\mathit{funcidx}} \\ +& & | & {\mathit{typeidx}} \\ \end{array} $$ @@ -3935,7 +3933,6 @@ $$ & & | & \mathsf{throw}~{\mathit{tagidx}} \\ & & | & \mathsf{throw\_ref} \\ & & | & \mathsf{try\_table}~{\mathit{blocktype}}~{\mathit{list}}({\mathit{catch}})~{{\mathit{instr}}^\ast} \\ -& & | & \dots \\ \mbox{(catch clause)} & {\mathit{catch}} & ::= & \mathsf{catch}~{\mathit{tagidx}}~{\mathit{labelidx}} \\ & & | & \mathsf{catch\_ref}~{\mathit{tagidx}}~{\mathit{labelidx}} \\ & & | & \mathsf{catch\_all}~{\mathit{labelidx}} \\ @@ -4021,7 +4018,6 @@ $$ & & | & {\mathit{shape}}{.}\mathsf{splat} \\ & & | & {{\mathit{shape}}{.}\mathsf{extract\_lane}}{\mathsf{\_}}{{{\mathit{sx}}^?}}~{\mathit{laneidx}} & \quad \mbox{if}~ {{\mathit{sx}}^?} = \epsilon \Leftrightarrow {\mathrm{lanetype}}({\mathit{shape}}) \in \mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 64}}~\mathsf{f{\scriptstyle 32}}~\mathsf{f{\scriptstyle 64}} \\ & & | & {\mathit{shape}}{.}\mathsf{replace\_lane}~{\mathit{laneidx}} \\ -& & | & \dots \\ \end{array} $$ @@ -4063,7 +4059,7 @@ $$ $$ \begin{array}[t]{@{}lcl@{}l@{}} {\mathrm{free}}_{\mathit{blocktype}}({{\mathit{valtype}}^?}) & = & {\mathrm{free}}_{\mathit{opt}}({{\mathrm{free}}_{\mathit{valtype}}({\mathit{valtype}})^?}) \\ -{\mathrm{free}}_{\mathit{blocktype}}({\mathit{funcidx}}) & = & {\mathrm{free}}_{\mathit{funcidx}}({\mathit{funcidx}}) \\ +{\mathrm{free}}_{\mathit{blocktype}}({\mathit{typeidx}}) & = & {\mathrm{free}}_{\mathit{typeidx}}({\mathit{typeidx}}) \\ \end{array} $$ @@ -5786,7 +5782,7 @@ $$ \frac{ }{ C \vdash \mathsf{nop} : \epsilon \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}nop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}nop}]} \qquad \end{array} $$ @@ -5797,7 +5793,7 @@ $$ C \vdash {t_1^\ast} \rightarrow {t_2^\ast} : \mathsf{ok} }{ C \vdash \mathsf{unreachable} : {t_1^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}unreachable}]} +} \, {[\textsc{\scriptsize T{-}instr{-}unreachable}]} \qquad \end{array} $$ @@ -5808,7 +5804,7 @@ $$ C \vdash t : \mathsf{ok} }{ C \vdash \mathsf{drop} : t \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}drop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}drop}]} \qquad \end{array} $$ @@ -5819,7 +5815,7 @@ $$ C \vdash t : \mathsf{ok} }{ C \vdash \mathsf{select}~t : t~t~\mathsf{i{\scriptstyle 32}} \rightarrow t -} \, {[\textsc{\scriptsize T{-}select{-}expl}]} +} \, {[\textsc{\scriptsize T{-}instr{-}select{-}expl}]} \qquad \end{array} $$ @@ -5834,7 +5830,7 @@ C \vdash t \leq {t'} {t'} = {\mathit{numtype}} \lor {t'} = {\mathit{vectype}} }{ C \vdash \mathsf{select} : t~t~\mathsf{i{\scriptstyle 32}} \rightarrow t -} \, {[\textsc{\scriptsize T{-}select{-}impl}]} +} \, {[\textsc{\scriptsize T{-}instr{-}select{-}impl}]} \qquad \end{array} $$ @@ -5875,7 +5871,7 @@ C \vdash {\mathit{bt}} : {t_1^\ast} \rightarrow {t_2^\ast} \{ \mathsf{labels}~({t_2^\ast}) \} \oplus C \vdash {{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow_{{x^\ast}} {t_2^\ast} }{ C \vdash \mathsf{block}~{\mathit{bt}}~{{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}block}]} +} \, {[\textsc{\scriptsize T{-}instr{-}block}]} \qquad \end{array} $$ @@ -5888,7 +5884,7 @@ C \vdash {\mathit{bt}} : {t_1^\ast} \rightarrow {t_2^\ast} \{ \mathsf{labels}~({t_1^\ast}) \} \oplus C \vdash {{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow_{{x^\ast}} {t_2^\ast} }{ C \vdash \mathsf{loop}~{\mathit{bt}}~{{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}loop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}loop}]} \qquad \end{array} $$ @@ -5903,7 +5899,7 @@ C \vdash {\mathit{bt}} : {t_1^\ast} \rightarrow {t_2^\ast} \{ \mathsf{labels}~({t_2^\ast}) \} \oplus C \vdash {{\mathit{instr}}_2^\ast} : {t_1^\ast} \rightarrow_{{x_2^\ast}} {t_2^\ast} }{ C \vdash \mathsf{if}~{\mathit{bt}}~{{\mathit{instr}}_1^\ast}~\mathsf{else}~{{\mathit{instr}}_2^\ast} : {t_1^\ast}~\mathsf{i{\scriptstyle 32}} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}if}]} +} \, {[\textsc{\scriptsize T{-}instr{-}if}]} \qquad \end{array} $$ @@ -5918,7 +5914,7 @@ C{.}\mathsf{labels}{}[l] = {t^\ast} C \vdash {t_1^\ast} \rightarrow {t_2^\ast} : \mathsf{ok} }{ C \vdash \mathsf{br}~l : {t_1^\ast}~{t^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}br}]} +} \, {[\textsc{\scriptsize T{-}instr{-}br}]} \qquad \end{array} $$ @@ -5929,7 +5925,7 @@ $$ C{.}\mathsf{labels}{}[l] = {t^\ast} }{ C \vdash \mathsf{br\_if}~l : {t^\ast}~\mathsf{i{\scriptstyle 32}} \rightarrow {t^\ast} -} \, {[\textsc{\scriptsize T{-}br\_if}]} +} \, {[\textsc{\scriptsize T{-}instr{-}br\_if}]} \qquad \end{array} $$ @@ -5944,7 +5940,7 @@ C \vdash {t^\ast} \leq C{.}\mathsf{labels}{}[{l'}] C \vdash {t_1^\ast}~{t^\ast}~\mathsf{i{\scriptstyle 32}} \rightarrow {t_2^\ast} : \mathsf{ok} }{ C \vdash \mathsf{br\_table}~{l^\ast}~{l'} : {t_1^\ast}~{t^\ast}~\mathsf{i{\scriptstyle 32}} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}br\_table}]} +} \, {[\textsc{\scriptsize T{-}instr{-}br\_table}]} \qquad \end{array} $$ @@ -5957,7 +5953,7 @@ C{.}\mathsf{labels}{}[l] = {t^\ast} C \vdash {\mathit{ht}} : \mathsf{ok} }{ C \vdash \mathsf{br\_on\_null}~l : {t^\ast}~(\mathsf{ref}~\mathsf{null}~{\mathit{ht}}) \rightarrow {t^\ast}~(\mathsf{ref}~{\mathit{ht}}) -} \, {[\textsc{\scriptsize T{-}br\_on\_null}]} +} \, {[\textsc{\scriptsize T{-}instr{-}br\_on\_null}]} \qquad \end{array} $$ @@ -5968,7 +5964,7 @@ $$ C{.}\mathsf{labels}{}[l] = {t^\ast}~(\mathsf{ref}~{\mathsf{null}^?}~{\mathit{ht}}) }{ C \vdash \mathsf{br\_on\_non\_null}~l : {t^\ast}~(\mathsf{ref}~\mathsf{null}~{\mathit{ht}}) \rightarrow {t^\ast} -} \, {[\textsc{\scriptsize T{-}br\_on\_non\_null}]} +} \, {[\textsc{\scriptsize T{-}instr{-}br\_on\_non\_null}]} \qquad \end{array} $$ @@ -5987,7 +5983,7 @@ C \vdash {\mathit{rt}}_2 \leq {\mathit{rt}}_1 C \vdash {\mathit{rt}}_2 \leq {\mathit{rt}} }{ C \vdash \mathsf{br\_on\_cast}~l~{\mathit{rt}}_1~{\mathit{rt}}_2 : {t^\ast}~{\mathit{rt}}_1 \rightarrow {t^\ast}~({\mathit{rt}}_1 \setminus {\mathit{rt}}_2) -} \, {[\textsc{\scriptsize T{-}br\_on\_cast}]} +} \, {[\textsc{\scriptsize T{-}instr{-}br\_on\_cast}]} \qquad \end{array} $$ @@ -6006,7 +6002,7 @@ C \vdash {\mathit{rt}}_2 \leq {\mathit{rt}}_1 C \vdash {\mathit{rt}}_1 \setminus {\mathit{rt}}_2 \leq {\mathit{rt}} }{ C \vdash \mathsf{br\_on\_cast\_fail}~l~{\mathit{rt}}_1~{\mathit{rt}}_2 : {t^\ast}~{\mathit{rt}}_1 \rightarrow {t^\ast}~{\mathit{rt}}_2 -} \, {[\textsc{\scriptsize T{-}br\_on\_cast\_fail}]} +} \, {[\textsc{\scriptsize T{-}instr{-}br\_on\_cast\_fail}]} \qquad \end{array} $$ @@ -6019,7 +6015,7 @@ $$ C{.}\mathsf{funcs}{}[x] \approx \mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast} }{ C \vdash \mathsf{call}~x : {t_1^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}call}]} +} \, {[\textsc{\scriptsize T{-}instr{-}call}]} \qquad \end{array} $$ @@ -6030,7 +6026,7 @@ $$ C{.}\mathsf{types}{}[x] \approx \mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast} }{ C \vdash \mathsf{call\_ref}~x : {t_1^\ast}~(\mathsf{ref}~\mathsf{null}~x) \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}call\_ref}]} +} \, {[\textsc{\scriptsize T{-}instr{-}call\_ref}]} \qquad \end{array} $$ @@ -6045,7 +6041,7 @@ C \vdash {\mathit{rt}} \leq (\mathsf{ref}~\mathsf{null}~\mathsf{func}) C{.}\mathsf{types}{}[y] \approx \mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast} }{ C \vdash \mathsf{call\_indirect}~x~y : {t_1^\ast}~{\mathit{at}} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}call\_indirect}]} +} \, {[\textsc{\scriptsize T{-}instr{-}call\_indirect}]} \qquad \end{array} $$ @@ -6058,7 +6054,7 @@ C{.}\mathsf{return} = ({t^\ast}) C \vdash {t_1^\ast} \rightarrow {t_2^\ast} : \mathsf{ok} }{ C \vdash \mathsf{return} : {t_1^\ast}~{t^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}return}]} +} \, {[\textsc{\scriptsize T{-}instr{-}return}]} \qquad \end{array} $$ @@ -6075,7 +6071,7 @@ C \vdash {t_2^\ast} \leq {{t'}_2^\ast} C \vdash {t_3^\ast} \rightarrow {t_4^\ast} : \mathsf{ok} }{ C \vdash \mathsf{return\_call}~x : {t_3^\ast}~{t_1^\ast} \rightarrow {t_4^\ast} -} \, {[\textsc{\scriptsize T{-}return\_call}]} +} \, {[\textsc{\scriptsize T{-}instr{-}return\_call}]} \qquad \end{array} $$ @@ -6092,7 +6088,7 @@ C \vdash {t_2^\ast} \leq {{t'}_2^\ast} C \vdash {t_3^\ast} \rightarrow {t_4^\ast} : \mathsf{ok} }{ C \vdash \mathsf{return\_call\_ref}~x : {t_3^\ast}~{t_1^\ast}~(\mathsf{ref}~\mathsf{null}~x) \rightarrow {t_4^\ast} -} \, {[\textsc{\scriptsize T{-}return\_call\_ref}]} +} \, {[\textsc{\scriptsize T{-}instr{-}return\_call\_ref}]} \qquad \end{array} $$ @@ -6115,7 +6111,7 @@ C \vdash {t_3^\ast} \rightarrow {t_4^\ast} : \mathsf{ok} \end{array} }{ C \vdash \mathsf{return\_call\_indirect}~x~y : {t_3^\ast}~{t_1^\ast}~{\mathit{at}} \rightarrow {t_4^\ast} -} \, {[\textsc{\scriptsize T{-}return\_call\_indirect}]} +} \, {[\textsc{\scriptsize T{-}instr{-}return\_call\_indirect}]} \qquad \end{array} $$ @@ -6132,7 +6128,7 @@ C{.}\mathsf{tags}{}[x] \approx \mathsf{func}~{t^\ast} \rightarrow \epsilon C \vdash {t_1^\ast} \rightarrow {t_2^\ast} : \mathsf{ok} }{ C \vdash \mathsf{throw}~x : {t_1^\ast}~{t^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}throw}]} +} \, {[\textsc{\scriptsize T{-}instr{-}throw}]} \qquad \end{array} $$ @@ -6143,7 +6139,7 @@ $$ C \vdash {t_1^\ast} \rightarrow {t_2^\ast} : \mathsf{ok} }{ C \vdash \mathsf{throw\_ref} : {t_1^\ast}~(\mathsf{ref}~\mathsf{null}~\mathsf{exn}) \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}throw\_ref}]} +} \, {[\textsc{\scriptsize T{-}instr{-}throw\_ref}]} \qquad \end{array} $$ @@ -6158,7 +6154,7 @@ C \vdash {\mathit{bt}} : {t_1^\ast} \rightarrow {t_2^\ast} (C \vdash {\mathit{catch}} : \mathsf{ok})^\ast }{ C \vdash \mathsf{try\_table}~{\mathit{bt}}~{{\mathit{catch}}^\ast}~{{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}try\_table}]} +} \, {[\textsc{\scriptsize T{-}instr{-}try\_table}]} \qquad \end{array} $$ @@ -6219,7 +6215,7 @@ $$ C \vdash {\mathit{ht}} : \mathsf{ok} }{ C \vdash \mathsf{ref{.}null}~{\mathit{ht}} : \epsilon \rightarrow (\mathsf{ref}~\mathsf{null}~{\mathit{ht}}) -} \, {[\textsc{\scriptsize T{-}ref.null}]} +} \, {[\textsc{\scriptsize T{-}instr{-}ref.null}]} \qquad \end{array} $$ @@ -6232,7 +6228,7 @@ C{.}\mathsf{funcs}{}[x] = {\mathit{dt}} x \in C{.}\mathsf{refs} }{ C \vdash \mathsf{ref{.}func}~x : \epsilon \rightarrow (\mathsf{ref}~{\mathit{dt}}) -} \, {[\textsc{\scriptsize T{-}ref.func}]} +} \, {[\textsc{\scriptsize T{-}instr{-}ref.func}]} \qquad \end{array} $$ @@ -6242,7 +6238,7 @@ $$ \frac{ }{ C \vdash \mathsf{ref{.}i{\scriptstyle 31}} : \mathsf{i{\scriptstyle 32}} \rightarrow (\mathsf{ref}~\mathsf{i{\scriptstyle 31}}) -} \, {[\textsc{\scriptsize T{-}ref.i31}]} +} \, {[\textsc{\scriptsize T{-}instr{-}ref.i31}]} \qquad \end{array} $$ @@ -6253,7 +6249,7 @@ $$ C \vdash {\mathit{ht}} : \mathsf{ok} }{ C \vdash \mathsf{ref{.}is\_null} : (\mathsf{ref}~\mathsf{null}~{\mathit{ht}}) \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}ref.is\_null}]} +} \, {[\textsc{\scriptsize T{-}instr{-}ref.is\_null}]} \qquad \end{array} $$ @@ -6264,7 +6260,7 @@ $$ C \vdash {\mathit{ht}} : \mathsf{ok} }{ C \vdash \mathsf{ref{.}as\_non\_null} : (\mathsf{ref}~\mathsf{null}~{\mathit{ht}}) \rightarrow (\mathsf{ref}~{\mathit{ht}}) -} \, {[\textsc{\scriptsize T{-}ref.as\_non\_null}]} +} \, {[\textsc{\scriptsize T{-}instr{-}ref.as\_non\_null}]} \qquad \end{array} $$ @@ -6274,7 +6270,7 @@ $$ \frac{ }{ C \vdash \mathsf{ref{.}eq} : (\mathsf{ref}~\mathsf{null}~\mathsf{eq})~(\mathsf{ref}~\mathsf{null}~\mathsf{eq}) \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}ref.eq}]} +} \, {[\textsc{\scriptsize T{-}instr{-}ref.eq}]} \qquad \end{array} $$ @@ -6289,7 +6285,7 @@ C \vdash {\mathit{rt}'} : \mathsf{ok} C \vdash {\mathit{rt}} \leq {\mathit{rt}'} }{ C \vdash \mathsf{ref{.}test}~{\mathit{rt}} : {\mathit{rt}'} \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}ref.test}]} +} \, {[\textsc{\scriptsize T{-}instr{-}ref.test}]} \qquad \end{array} $$ @@ -6304,7 +6300,7 @@ C \vdash {\mathit{rt}'} : \mathsf{ok} C \vdash {\mathit{rt}} \leq {\mathit{rt}'} }{ C \vdash \mathsf{ref{.}cast}~{\mathit{rt}} : {\mathit{rt}'} \rightarrow {\mathit{rt}} -} \, {[\textsc{\scriptsize T{-}ref.cast}]} +} \, {[\textsc{\scriptsize T{-}instr{-}ref.cast}]} \qquad \end{array} $$ @@ -6316,7 +6312,7 @@ $$ \frac{ }{ C \vdash {\mathsf{i{\scriptstyle 31}{.}get}}{\mathsf{\_}}{{\mathit{sx}}} : (\mathsf{ref}~\mathsf{null}~\mathsf{i{\scriptstyle 31}}) \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}i31.get}]} +} \, {[\textsc{\scriptsize T{-}instr{-}i31.get}]} \qquad \end{array} $$ @@ -6329,7 +6325,7 @@ $$ C{.}\mathsf{types}{}[x] \approx \mathsf{struct}~{({\mathsf{mut}^?}~{\mathit{zt}})^\ast} }{ C \vdash \mathsf{struct{.}new}~x : {{\mathrm{unpack}}({\mathit{zt}})^\ast} \rightarrow (\mathsf{ref}~x) -} \, {[\textsc{\scriptsize T{-}struct.new}]} +} \, {[\textsc{\scriptsize T{-}instr{-}struct.new}]} \qquad \end{array} $$ @@ -6342,7 +6338,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{struct}~{({\mathsf{mut}^?}~{\mathit{zt}} ({{\mathrm{default}}}_{{\mathrm{unpack}}({\mathit{zt}})} \neq \epsilon)^\ast }{ C \vdash \mathsf{struct{.}new\_default}~x : \epsilon \rightarrow (\mathsf{ref}~x) -} \, {[\textsc{\scriptsize T{-}struct.new\_default}]} +} \, {[\textsc{\scriptsize T{-}instr{-}struct.new\_default}]} \qquad \end{array} $$ @@ -6363,7 +6359,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{struct}~{{\mathit{ft}}^\ast} {{\mathit{sx}}^?} = \epsilon \Leftrightarrow {\mathit{zt}} = {\mathrm{unpack}}({\mathit{zt}}) }{ C \vdash {\mathsf{struct{.}get}}{\mathsf{\_}}{{{\mathit{sx}}^?}}~x~i : (\mathsf{ref}~\mathsf{null}~x) \rightarrow {\mathrm{unpack}}({\mathit{zt}}) -} \, {[\textsc{\scriptsize T{-}struct.get}]} +} \, {[\textsc{\scriptsize T{-}instr{-}struct.get}]} \qquad \end{array} $$ @@ -6376,7 +6372,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{struct}~{{\mathit{ft}}^\ast} {{\mathit{ft}}^\ast}{}[i] = \mathsf{mut}~{\mathit{zt}} }{ C \vdash \mathsf{struct{.}set}~x~i : (\mathsf{ref}~\mathsf{null}~x)~{\mathrm{unpack}}({\mathit{zt}}) \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}struct.set}]} +} \, {[\textsc{\scriptsize T{-}instr{-}struct.set}]} \qquad \end{array} $$ @@ -6389,7 +6385,7 @@ $$ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{zt}}) }{ C \vdash \mathsf{array{.}new}~x : {\mathrm{unpack}}({\mathit{zt}})~\mathsf{i{\scriptstyle 32}} \rightarrow (\mathsf{ref}~x) -} \, {[\textsc{\scriptsize T{-}array.new}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.new}]} \qquad \end{array} $$ @@ -6402,7 +6398,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{zt}}) {{\mathrm{default}}}_{{\mathrm{unpack}}({\mathit{zt}})} \neq \epsilon }{ C \vdash \mathsf{array{.}new\_default}~x : \mathsf{i{\scriptstyle 32}} \rightarrow (\mathsf{ref}~x) -} \, {[\textsc{\scriptsize T{-}array.new\_default}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.new\_default}]} \qquad \end{array} $$ @@ -6413,7 +6409,7 @@ $$ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{zt}}) }{ C \vdash \mathsf{array{.}new\_fixed}~x~n : {{\mathrm{unpack}}({\mathit{zt}})^{n}} \rightarrow (\mathsf{ref}~x) -} \, {[\textsc{\scriptsize T{-}array.new\_fixed}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.new\_fixed}]} \qquad \end{array} $$ @@ -6426,7 +6422,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{rt}}) C \vdash C{.}\mathsf{elems}{}[y] \leq {\mathit{rt}} }{ C \vdash \mathsf{array{.}new\_elem}~x~y : \mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}} \rightarrow (\mathsf{ref}~x) -} \, {[\textsc{\scriptsize T{-}array.new\_elem}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.new\_elem}]} \qquad \end{array} $$ @@ -6441,7 +6437,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{zt}}) C{.}\mathsf{datas}{}[y] = \mathsf{ok} }{ C \vdash \mathsf{array{.}new\_data}~x~y : \mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}} \rightarrow (\mathsf{ref}~x) -} \, {[\textsc{\scriptsize T{-}array.new\_data}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.new\_data}]} \qquad \end{array} $$ @@ -6454,7 +6450,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{zt}}) {{\mathit{sx}}^?} = \epsilon \Leftrightarrow {\mathit{zt}} = {\mathrm{unpack}}({\mathit{zt}}) }{ C \vdash {\mathsf{array{.}get}}{\mathsf{\_}}{{{\mathit{sx}}^?}}~x : (\mathsf{ref}~\mathsf{null}~x)~\mathsf{i{\scriptstyle 32}} \rightarrow {\mathrm{unpack}}({\mathit{zt}}) -} \, {[\textsc{\scriptsize T{-}array.get}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.get}]} \qquad \end{array} $$ @@ -6465,7 +6461,7 @@ $$ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~(\mathsf{mut}~{\mathit{zt}}) }{ C \vdash \mathsf{array{.}set}~x : (\mathsf{ref}~\mathsf{null}~x)~\mathsf{i{\scriptstyle 32}}~{\mathrm{unpack}}({\mathit{zt}}) \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}array.set}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.set}]} \qquad \end{array} $$ @@ -6475,7 +6471,7 @@ $$ \frac{ }{ C \vdash \mathsf{array{.}len} : (\mathsf{ref}~\mathsf{null}~\mathsf{array}) \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}array.len}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.len}]} \qquad \end{array} $$ @@ -6486,7 +6482,7 @@ $$ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~(\mathsf{mut}~{\mathit{zt}}) }{ C \vdash \mathsf{array{.}fill}~x : (\mathsf{ref}~\mathsf{null}~x)~\mathsf{i{\scriptstyle 32}}~{\mathrm{unpack}}({\mathit{zt}})~\mathsf{i{\scriptstyle 32}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}array.fill}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.fill}]} \qquad \end{array} $$ @@ -6501,7 +6497,7 @@ C{.}\mathsf{types}{}[x_2] \approx \mathsf{array}~({\mathsf{mut}^?}~{\mathit{zt}} C \vdash {\mathit{zt}}_2 \leq {\mathit{zt}}_1 }{ C \vdash \mathsf{array{.}copy}~x_1~x_2 : (\mathsf{ref}~\mathsf{null}~x_1)~\mathsf{i{\scriptstyle 32}}~(\mathsf{ref}~\mathsf{null}~x_2)~\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}array.copy}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.copy}]} \qquad \end{array} $$ @@ -6514,7 +6510,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~(\mathsf{mut}~{\mathit{zt}}) C \vdash C{.}\mathsf{elems}{}[y] \leq {\mathit{zt}} }{ C \vdash \mathsf{array{.}init\_elem}~x~y : (\mathsf{ref}~\mathsf{null}~x)~\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}array.init\_elem}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.init\_elem}]} \qquad \end{array} $$ @@ -6529,7 +6525,7 @@ C{.}\mathsf{types}{}[x] \approx \mathsf{array}~(\mathsf{mut}~{\mathit{zt}}) C{.}\mathsf{datas}{}[y] = \mathsf{ok} }{ C \vdash \mathsf{array{.}init\_data}~x~y : (\mathsf{ref}~\mathsf{null}~x)~\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}array.init\_data}]} +} \, {[\textsc{\scriptsize T{-}instr{-}array.init\_data}]} \qquad \end{array} $$ @@ -6542,7 +6538,7 @@ $$ {{\mathsf{null}}_1^?} = {{\mathsf{null}}_2^?} }{ C \vdash \mathsf{extern{.}convert\_any} : (\mathsf{ref}~{{\mathsf{null}}_1^?}~\mathsf{any}) \rightarrow (\mathsf{ref}~{{\mathsf{null}}_2^?}~\mathsf{extern}) -} \, {[\textsc{\scriptsize T{-}extern.convert\_any}]} +} \, {[\textsc{\scriptsize T{-}instr{-}extern.convert\_any}]} \qquad \end{array} $$ @@ -6553,7 +6549,7 @@ $$ {{\mathsf{null}}_1^?} = {{\mathsf{null}}_2^?} }{ C \vdash \mathsf{any{.}convert\_extern} : (\mathsf{ref}~{{\mathsf{null}}_1^?}~\mathsf{extern}) \rightarrow (\mathsf{ref}~{{\mathsf{null}}_2^?}~\mathsf{any}) -} \, {[\textsc{\scriptsize T{-}any.convert\_extern}]} +} \, {[\textsc{\scriptsize T{-}instr{-}any.convert\_extern}]} \qquad \end{array} $$ @@ -6566,7 +6562,7 @@ $$ C{.}\mathsf{locals}{}[x] = \mathsf{set}~t }{ C \vdash \mathsf{local{.}get}~x : \epsilon \rightarrow t -} \, {[\textsc{\scriptsize T{-}local.get}]} +} \, {[\textsc{\scriptsize T{-}instr{-}local.get}]} \qquad \end{array} $$ @@ -6577,7 +6573,7 @@ $$ C{.}\mathsf{locals}{}[x] = {\mathit{init}}~t }{ C \vdash \mathsf{local{.}set}~x : t \rightarrow_{x} \epsilon -} \, {[\textsc{\scriptsize T{-}local.set}]} +} \, {[\textsc{\scriptsize T{-}instr{-}local.set}]} \qquad \end{array} $$ @@ -6588,7 +6584,7 @@ $$ C{.}\mathsf{locals}{}[x] = {\mathit{init}}~t }{ C \vdash \mathsf{local{.}tee}~x : t \rightarrow_{x} t -} \, {[\textsc{\scriptsize T{-}local.tee}]} +} \, {[\textsc{\scriptsize T{-}instr{-}local.tee}]} \qquad \end{array} $$ @@ -6601,7 +6597,7 @@ $$ C{.}\mathsf{globals}{}[x] = {\mathsf{mut}^?}~t }{ C \vdash \mathsf{global{.}get}~x : \epsilon \rightarrow t -} \, {[\textsc{\scriptsize T{-}global.get}]} +} \, {[\textsc{\scriptsize T{-}instr{-}global.get}]} \qquad \end{array} $$ @@ -6612,7 +6608,7 @@ $$ C{.}\mathsf{globals}{}[x] = \mathsf{mut}~t }{ C \vdash \mathsf{global{.}set}~x : t \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}global.set}]} +} \, {[\textsc{\scriptsize T{-}instr{-}global.set}]} \qquad \end{array} $$ @@ -6625,7 +6621,7 @@ $$ C{.}\mathsf{tables}{}[x] = {\mathit{at}}~{\mathit{lim}}~{\mathit{rt}} }{ C \vdash \mathsf{table{.}get}~x : {\mathit{at}} \rightarrow {\mathit{rt}} -} \, {[\textsc{\scriptsize T{-}table.get}]} +} \, {[\textsc{\scriptsize T{-}instr{-}table.get}]} \qquad \end{array} $$ @@ -6636,7 +6632,7 @@ $$ C{.}\mathsf{tables}{}[x] = {\mathit{at}}~{\mathit{lim}}~{\mathit{rt}} }{ C \vdash \mathsf{table{.}set}~x : {\mathit{at}}~{\mathit{rt}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}table.set}]} +} \, {[\textsc{\scriptsize T{-}instr{-}table.set}]} \qquad \end{array} $$ @@ -6647,7 +6643,7 @@ $$ C{.}\mathsf{tables}{}[x] = {\mathit{at}}~{\mathit{lim}}~{\mathit{rt}} }{ C \vdash \mathsf{table{.}size}~x : \epsilon \rightarrow {\mathit{at}} -} \, {[\textsc{\scriptsize T{-}table.size}]} +} \, {[\textsc{\scriptsize T{-}instr{-}table.size}]} \qquad \end{array} $$ @@ -6658,7 +6654,7 @@ $$ C{.}\mathsf{tables}{}[x] = {\mathit{at}}~{\mathit{lim}}~{\mathit{rt}} }{ C \vdash \mathsf{table{.}grow}~x : {\mathit{rt}}~{\mathit{at}} \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}table.grow}]} +} \, {[\textsc{\scriptsize T{-}instr{-}table.grow}]} \qquad \end{array} $$ @@ -6669,7 +6665,7 @@ $$ C{.}\mathsf{tables}{}[x] = {\mathit{at}}~{\mathit{lim}}~{\mathit{rt}} }{ C \vdash \mathsf{table{.}fill}~x : {\mathit{at}}~{\mathit{rt}}~{\mathit{at}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}table.fill}]} +} \, {[\textsc{\scriptsize T{-}instr{-}table.fill}]} \qquad \end{array} $$ @@ -6684,7 +6680,7 @@ C{.}\mathsf{tables}{}[x_2] = {\mathit{at}}_2~{\mathit{lim}}_2~{\mathit{rt}}_2 C \vdash {\mathit{rt}}_2 \leq {\mathit{rt}}_1 }{ C \vdash \mathsf{table{.}copy}~x_1~x_2 : {\mathit{at}}_1~{\mathit{at}}_2~{\mathrm{min}}({\mathit{at}}_1, {\mathit{at}}_2) \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}table.copy}]} +} \, {[\textsc{\scriptsize T{-}instr{-}table.copy}]} \qquad \end{array} $$ @@ -6699,7 +6695,7 @@ C{.}\mathsf{elems}{}[y] = {\mathit{rt}}_2 C \vdash {\mathit{rt}}_2 \leq {\mathit{rt}}_1 }{ C \vdash \mathsf{table{.}init}~x~y : {\mathit{at}}~\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}table.init}]} +} \, {[\textsc{\scriptsize T{-}instr{-}table.init}]} \qquad \end{array} $$ @@ -6710,7 +6706,24 @@ $$ C{.}\mathsf{elems}{}[x] = {\mathit{rt}} }{ C \vdash \mathsf{elem{.}drop}~x : \epsilon \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}elem.drop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}elem.drop}]} +\qquad +\end{array} +$$ + +\vspace{1ex} + +$\boxed{{\vdash}\, {\mathit{memarg}} : {\mathit{addrtype}} \rightarrow N}$ + +$$ +\begin{array}{@{}c@{}}\displaystyle +\frac{ +{2^{n}} \leq N / 8 + \qquad +m < {2^{{|{\mathit{at}}|}}} +}{ +{\vdash}\, \{ \mathsf{align}~n,\;\allowbreak \mathsf{offset}~m \} : {\mathit{at}} \rightarrow N +} \, {[\textsc{\scriptsize T{-}memarg}]} \qquad \end{array} $$ @@ -6723,7 +6736,7 @@ $$ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} }{ C \vdash \mathsf{memory{.}size}~x : \epsilon \rightarrow {\mathit{at}} -} \, {[\textsc{\scriptsize T{-}memory.size}]} +} \, {[\textsc{\scriptsize T{-}instr{-}memory.size}]} \qquad \end{array} $$ @@ -6734,7 +6747,7 @@ $$ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} }{ C \vdash \mathsf{memory{.}grow}~x : {\mathit{at}} \rightarrow {\mathit{at}} -} \, {[\textsc{\scriptsize T{-}memory.grow}]} +} \, {[\textsc{\scriptsize T{-}instr{-}memory.grow}]} \qquad \end{array} $$ @@ -6745,7 +6758,7 @@ $$ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} }{ C \vdash \mathsf{memory{.}fill}~x : {\mathit{at}}~\mathsf{i{\scriptstyle 32}}~{\mathit{at}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}memory.fill}]} +} \, {[\textsc{\scriptsize T{-}instr{-}memory.fill}]} \qquad \end{array} $$ @@ -6758,7 +6771,7 @@ C{.}\mathsf{mems}{}[x_1] = {\mathit{at}}_1~{\mathit{lim}}_1~\mathsf{page} C{.}\mathsf{mems}{}[x_2] = {\mathit{at}}_2~{\mathit{lim}}_2~\mathsf{page} }{ C \vdash \mathsf{memory{.}copy}~x_1~x_2 : {\mathit{at}}_1~{\mathit{at}}_2~{\mathrm{min}}({\mathit{at}}_1, {\mathit{at}}_2) \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}memory.copy}]} +} \, {[\textsc{\scriptsize T{-}instr{-}memory.copy}]} \qquad \end{array} $$ @@ -6771,7 +6784,7 @@ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} C{.}\mathsf{datas}{}[y] = \mathsf{ok} }{ C \vdash \mathsf{memory{.}init}~x~y : {\mathit{at}}~\mathsf{i{\scriptstyle 32}}~\mathsf{i{\scriptstyle 32}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}memory.init}]} +} \, {[\textsc{\scriptsize T{-}instr{-}memory.init}]} \qquad \end{array} $$ @@ -6782,7 +6795,7 @@ $$ C{.}\mathsf{datas}{}[x] = \mathsf{ok} }{ C \vdash \mathsf{data{.}drop}~x : \epsilon \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}data.drop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}data.drop}]} \qquad \end{array} $$ @@ -6792,10 +6805,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq {|{\mathit{nt}}|} / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow {|{\mathit{nt}}|} }{ C \vdash {\mathit{nt}}{.}\mathsf{load}~x~{\mathit{memarg}} : {\mathit{at}} \rightarrow {\mathit{nt}} -} \, {[\textsc{\scriptsize T{-}load{-}val}]} +} \, {[\textsc{\scriptsize T{-}instr{-}load{-}val}]} \qquad \end{array} $$ @@ -6805,10 +6818,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq M / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow M }{ C \vdash {{\mathsf{i}}{N}{.}\mathsf{load}}{{M}{\mathsf{\_}}{{\mathit{sx}}}}~x~{\mathit{memarg}} : {\mathit{at}} \rightarrow {\mathsf{i}}{N} -} \, {[\textsc{\scriptsize T{-}load{-}pack}]} +} \, {[\textsc{\scriptsize T{-}instr{-}load{-}pack}]} \qquad \end{array} $$ @@ -6818,10 +6831,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq {|{\mathit{nt}}|} / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow {|{\mathit{nt}}|} }{ C \vdash {\mathit{nt}}{.}\mathsf{store}~x~{\mathit{memarg}} : {\mathit{at}}~{\mathit{nt}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}store{-}val}]} +} \, {[\textsc{\scriptsize T{-}instr{-}store{-}val}]} \qquad \end{array} $$ @@ -6831,10 +6844,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq M / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow M }{ C \vdash {{\mathsf{i}}{N}{.}\mathsf{store}}{M}~x~{\mathit{memarg}} : {\mathit{at}}~{\mathsf{i}}{N} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}store{-}pack}]} +} \, {[\textsc{\scriptsize T{-}instr{-}store{-}pack}]} \qquad \end{array} $$ @@ -6844,10 +6857,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq {|\mathsf{v{\scriptstyle 128}}|} / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow {|\mathsf{v{\scriptstyle 128}}|} }{ C \vdash \mathsf{v{\scriptstyle 128}}{.}\mathsf{load}~x~{\mathit{memarg}} : {\mathit{at}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vload{-}val}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vload{-}val}]} \qquad \end{array} $$ @@ -6857,10 +6870,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq M / 8 \cdot N +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow M \cdot N }{ C \vdash {\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{{M}{\mathsf{x}}{N}{\mathsf{\_}}{{\mathit{sx}}}}~x~{\mathit{memarg}} : {\mathit{at}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vload{-}pack}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vload{-}pack}]} \qquad \end{array} $$ @@ -6870,10 +6883,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq N / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow N }{ C \vdash {\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{{N}{\mathsf{\_}}{\mathsf{splat}}}~x~{\mathit{memarg}} : {\mathit{at}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vload{-}splat}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vload{-}splat}]} \qquad \end{array} $$ @@ -6883,10 +6896,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq N / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow N }{ C \vdash {\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{{N}{\mathsf{\_}}{\mathsf{zero}}}~x~{\mathit{memarg}} : {\mathit{at}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vload{-}zero}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vload{-}zero}]} \qquad \end{array} $$ @@ -6896,12 +6909,12 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq N / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow N \qquad i < 128 / N }{ C \vdash {\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{N}{\mathsf{\_}}{\mathsf{lane}}~x~{\mathit{memarg}}~i : {\mathit{at}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vload\_lane}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vload\_lane}]} \qquad \end{array} $$ @@ -6911,10 +6924,10 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq {|\mathsf{v{\scriptstyle 128}}|} / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow {|\mathsf{v{\scriptstyle 128}}|} }{ C \vdash \mathsf{v{\scriptstyle 128}}{.}\mathsf{store}~x~{\mathit{memarg}} : {\mathit{at}}~\mathsf{v{\scriptstyle 128}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}vstore}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vstore}]} \qquad \end{array} $$ @@ -6924,12 +6937,12 @@ $$ \frac{ C{.}\mathsf{mems}{}[x] = {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \qquad -{2^{{\mathit{memarg}}{.}\mathsf{align}}} \leq N / 8 +{\vdash}\, {\mathit{memarg}} : {\mathit{at}} \rightarrow N \qquad i < 128 / N }{ C \vdash {\mathsf{v{\scriptstyle 128}}{.}\mathsf{store}}{N}{\mathsf{\_}}{\mathsf{lane}}~x~{\mathit{memarg}}~i : {\mathit{at}}~\mathsf{v{\scriptstyle 128}} \rightarrow \epsilon -} \, {[\textsc{\scriptsize T{-}vstore\_lane}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vstore\_lane}]} \qquad \end{array} $$ @@ -6941,7 +6954,7 @@ $$ \frac{ }{ C \vdash {\mathit{nt}}{.}\mathsf{const}~c_{\mathit{nt}} : \epsilon \rightarrow {\mathit{nt}} -} \, {[\textsc{\scriptsize T{-}const}]} +} \, {[\textsc{\scriptsize T{-}instr{-}const}]} \qquad \end{array} $$ @@ -6951,7 +6964,7 @@ $$ \frac{ }{ C \vdash {\mathit{nt}} {.} {\mathit{unop}}_{\mathit{nt}} : {\mathit{nt}} \rightarrow {\mathit{nt}} -} \, {[\textsc{\scriptsize T{-}unop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}unop}]} \qquad \end{array} $$ @@ -6961,7 +6974,7 @@ $$ \frac{ }{ C \vdash {\mathit{nt}} {.} {\mathit{binop}}_{\mathit{nt}} : {\mathit{nt}}~{\mathit{nt}} \rightarrow {\mathit{nt}} -} \, {[\textsc{\scriptsize T{-}binop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}binop}]} \qquad \end{array} $$ @@ -6971,7 +6984,7 @@ $$ \frac{ }{ C \vdash {\mathit{nt}} {.} {\mathit{testop}}_{\mathit{nt}} : {\mathit{nt}} \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}testop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}testop}]} \qquad \end{array} $$ @@ -6981,7 +6994,7 @@ $$ \frac{ }{ C \vdash {\mathit{nt}} {.} {\mathit{relop}}_{\mathit{nt}} : {\mathit{nt}}~{\mathit{nt}} \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}relop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}relop}]} \qquad \end{array} $$ @@ -6991,7 +7004,7 @@ $$ \frac{ }{ C \vdash {\mathit{nt}}_1 {.} {{\mathit{cvtop}}}{\mathsf{\_}}{{\mathit{nt}}_2} : {\mathit{nt}}_2 \rightarrow {\mathit{nt}}_1 -} \, {[\textsc{\scriptsize T{-}cvtop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}cvtop}]} \qquad \end{array} $$ @@ -7003,7 +7016,7 @@ $$ \frac{ }{ C \vdash \mathsf{v{\scriptstyle 128}}{.}\mathsf{const}~c : \epsilon \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vconst}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vconst}]} \qquad \end{array} $$ @@ -7013,7 +7026,7 @@ $$ \frac{ }{ C \vdash \mathsf{v{\scriptstyle 128}} {.} {\mathit{vvunop}} : \mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vvunop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vvunop}]} \qquad \end{array} $$ @@ -7023,7 +7036,7 @@ $$ \frac{ }{ C \vdash \mathsf{v{\scriptstyle 128}} {.} {\mathit{vvbinop}} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vvbinop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vvbinop}]} \qquad \end{array} $$ @@ -7033,7 +7046,7 @@ $$ \frac{ }{ C \vdash \mathsf{v{\scriptstyle 128}} {.} {\mathit{vvternop}} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vvternop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vvternop}]} \qquad \end{array} $$ @@ -7043,7 +7056,7 @@ $$ \frac{ }{ C \vdash \mathsf{v{\scriptstyle 128}} {.} {\mathit{vvtestop}} : \mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}vvtestop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vvtestop}]} \qquad \end{array} $$ @@ -7053,7 +7066,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}} {.} {\mathit{vunop}} : \mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vunop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vunop}]} \qquad \end{array} $$ @@ -7063,7 +7076,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}} {.} {\mathit{vbinop}} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vbinop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vbinop}]} \qquad \end{array} $$ @@ -7073,7 +7086,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}} {.} {\mathit{vternop}} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vternop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vternop}]} \qquad \end{array} $$ @@ -7083,7 +7096,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}} {.} {\mathit{vtestop}} : \mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}vtestop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vtestop}]} \qquad \end{array} $$ @@ -7093,7 +7106,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}} {.} {\mathit{vrelop}} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vrelop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vrelop}]} \qquad \end{array} $$ @@ -7103,7 +7116,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}} {.} {\mathit{vshiftop}} : \mathsf{v{\scriptstyle 128}}~\mathsf{i{\scriptstyle 32}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vshiftop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vshiftop}]} \qquad \end{array} $$ @@ -7113,7 +7126,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}}{.}\mathsf{bitmask} : \mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{i{\scriptstyle 32}} -} \, {[\textsc{\scriptsize T{-}vbitmask}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vbitmask}]} \qquad \end{array} $$ @@ -7123,7 +7136,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}} {.} {\mathit{vswizzlop}} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vswizzlop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vswizzlop}]} \qquad \end{array} $$ @@ -7134,7 +7147,7 @@ $$ (i < 2 \cdot {\mathrm{dim}}({\mathit{sh}}))^\ast }{ C \vdash {\mathit{sh}}{.}\mathsf{shuffle}~{i^\ast} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vshuffle}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vshuffle}]} \qquad \end{array} $$ @@ -7144,7 +7157,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}}{.}\mathsf{splat} : {\mathrm{unpack}}({\mathit{sh}}) \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vsplat}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vsplat}]} \qquad \end{array} $$ @@ -7155,7 +7168,7 @@ $$ i < {\mathrm{dim}}({\mathit{sh}}) }{ C \vdash {{\mathit{sh}}{.}\mathsf{extract\_lane}}{\mathsf{\_}}{{{\mathit{sx}}^?}}~i : \mathsf{v{\scriptstyle 128}} \rightarrow {\mathrm{unpack}}({\mathit{sh}}) -} \, {[\textsc{\scriptsize T{-}vextract\_lane}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vextract\_lane}]} \qquad \end{array} $$ @@ -7166,7 +7179,7 @@ $$ i < {\mathrm{dim}}({\mathit{sh}}) }{ C \vdash {\mathit{sh}}{.}\mathsf{replace\_lane}~i : \mathsf{v{\scriptstyle 128}}~{\mathrm{unpack}}({\mathit{sh}}) \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vreplace\_lane}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vreplace\_lane}]} \qquad \end{array} $$ @@ -7176,7 +7189,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}}_1 {.} {{\mathit{vextunop}}}{\mathsf{\_}}{{\mathit{sh}}_2} : \mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vextunop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vextunop}]} \qquad \end{array} $$ @@ -7186,7 +7199,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}}_1 {.} {{\mathit{vextbinop}}}{\mathsf{\_}}{{\mathit{sh}}_2} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vextbinop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vextbinop}]} \qquad \end{array} $$ @@ -7196,7 +7209,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}}_1 {.} {{\mathit{vextternop}}}{\mathsf{\_}}{{\mathit{sh}}_2} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vextternop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vextternop}]} \qquad \end{array} $$ @@ -7206,7 +7219,7 @@ $$ \frac{ }{ C \vdash {{\mathit{sh}}_1{.}\mathsf{narrow}}{\mathsf{\_}}{{\mathit{sh}}_2}{\mathsf{\_}}{{\mathit{sx}}} : \mathsf{v{\scriptstyle 128}}~\mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vnarrow}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vnarrow}]} \qquad \end{array} $$ @@ -7216,7 +7229,7 @@ $$ \frac{ }{ C \vdash {\mathit{sh}}_1 {.} {{\mathit{vcvtop}}}{\mathsf{\_}}{{\mathit{sh}}_2} : \mathsf{v{\scriptstyle 128}} \rightarrow \mathsf{v{\scriptstyle 128}} -} \, {[\textsc{\scriptsize T{-}vcvtop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}vcvtop}]} \qquad \end{array} $$ @@ -8449,28 +8462,6 @@ $$ \vspace{1ex} -$$ -\begin{array}[t]{@{}lcl@{}l@{}} -{{\mathrm{ivtestop}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}({\mathrm{f}}, v_1) & = & {\Pi}\, {c^\ast} & \quad -\begin{array}[t]{@{}l@{}} -\mbox{if}~ {c_1^\ast} = {{\mathrm{lanes}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}(v_1) \\ -{\land}~ {c^\ast} = {{{\mathrm{f}}}_{N}(c_1)^\ast} \\ -\end{array} \\ -\end{array} -$$ - -$$ -\begin{array}[t]{@{}lcl@{}l@{}} -{{\mathrm{fvtestop}}}_{{{\mathsf{f}}{N}}{\mathsf{x}}{M}}({\mathrm{f}}, v_1) & = & {\Pi}\, {c^\ast} & \quad -\begin{array}[t]{@{}l@{}} -\mbox{if}~ {c_1^\ast} = {{\mathrm{lanes}}}_{{{\mathsf{f}}{N}}{\mathsf{x}}{M}}(v_1) \\ -{\land}~ {c^\ast} = {{{\mathrm{f}}}_{N}(c_1)^\ast} \\ -\end{array} \\ -\end{array} -$$ - -\vspace{1ex} - $$ \begin{array}[t]{@{}lcl@{}l@{}} {{\mathrm{ivrelop}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}({\mathrm{f}}, v_1, v_2) & = & {{{{\mathrm{lanes}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}^{{-1}}}}{({c^\ast})} & \quad @@ -8638,12 +8629,6 @@ $$ \end{array} $$ -$$ -\begin{array}[t]{@{}lcl@{}l@{}} -{\mathsf{all\_true}}{{}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}(v)} & = & {{\mathrm{ivtestop}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}({\mathrm{inez}}, v) \\ -\end{array} -$$ - $$ \begin{array}[t]{@{}lcl@{}l@{}} {\mathsf{eq}}{{}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}(v_1, v_2)} & = & {{\mathrm{ivrelop}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}({\mathrm{ieq}}, v_1, v_2) \\ @@ -10730,7 +10715,7 @@ $$ $$ \begin{array}[t]{@{}lrcl@{}l@{}} -{[\textsc{\scriptsize E{-}vvtestop}]} \quad & (\mathsf{v{\scriptstyle 128}}{.}\mathsf{const}~c_1)~(\mathsf{v{\scriptstyle 128}} {.} \mathsf{any\_true}) & \hookrightarrow & (\mathsf{i{\scriptstyle 32}}{.}\mathsf{const}~c) & \quad \mbox{if}~ c = {{\mathrm{ine}}}_{{|\mathsf{v{\scriptstyle 128}}|}}(c_1, 0) \\ +{[\textsc{\scriptsize E{-}vvtestop}]} \quad & (\mathsf{v{\scriptstyle 128}}{.}\mathsf{const}~c_1)~(\mathsf{v{\scriptstyle 128}} {.} \mathsf{any\_true}) & \hookrightarrow & (\mathsf{i{\scriptstyle 32}}{.}\mathsf{const}~c) & \quad \mbox{if}~ c = {{\mathrm{inez}}}_{{|\mathsf{v{\scriptstyle 128}}|}}(c_1) \\ \end{array} $$ @@ -10765,7 +10750,11 @@ $$ $$ \begin{array}[t]{@{}lrcl@{}l@{}} -{[\textsc{\scriptsize E{-}vtestop}]} \quad & (\mathsf{v{\scriptstyle 128}}{.}\mathsf{const}~c_1)~({\mathit{sh}} {.} {\mathit{vtestop}}) & \hookrightarrow & (\mathsf{i{\scriptstyle 32}}{.}\mathsf{const}~i) & \quad \mbox{if}~ i = {{\mathit{vtestop}}}{{}_{{\mathit{sh}}}(c_1)} \\ +{[\textsc{\scriptsize E{-}vtestop}]} \quad & (\mathsf{v{\scriptstyle 128}}{.}\mathsf{const}~c_1)~({{\mathsf{i}}{N}}{\mathsf{x}}{M} {.} \mathsf{all\_true}) & \hookrightarrow & (\mathsf{i{\scriptstyle 32}}{.}\mathsf{const}~c) & \quad +\begin{array}[t]{@{}l@{}} +\mbox{if}~ {i^\ast} = {{\mathrm{lanes}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}(c_1) \\ +{\land}~ c = {\Pi}\, ({{{\mathrm{inez}}}_{N}(i)^\ast}) \\ +\end{array} \\ \end{array} $$ @@ -11182,7 +11171,7 @@ $$ $$ \begin{array}[t]{@{}lcl@{}l@{}} {\mathrm{invoke}}(s, {\mathit{funcaddr}}, {{\mathit{val}}^\ast}) & = & s ; \{ \mathsf{module}~\{ \} \} ; {{\mathit{val}}^\ast}~(\mathsf{ref{.}func}~{\mathit{funcaddr}})~(\mathsf{call\_ref}~s{.}\mathsf{funcs}{}[{\mathit{funcaddr}}]{.}\mathsf{type}) & \\ - \multicolumn{4}{@{}l@{}}{\quad +&& \multicolumn{2}{@{}l@{}}{\quad \quad \begin{array}[t]{@{}l@{}} \mbox{if}~ s{.}\mathsf{funcs}{}[{\mathit{funcaddr}}]{.}\mathsf{type} \approx \mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast} \\ @@ -11394,7 +11383,6 @@ $$ & & | & \mathtt{0x1A} & \quad\Rightarrow\quad{} & \mathsf{drop} \\ & & | & \mathtt{0x1B} & \quad\Rightarrow\quad{} & \mathsf{select} \\ & & | & \mathtt{0x1C}~~{t^\ast}{:}{\mathtt{list}}({\mathtt{valtype}}) & \quad\Rightarrow\quad{} & \mathsf{select}~{t^\ast} \\ -& & | & \dots \\ \end{array} $$ @@ -11422,7 +11410,6 @@ $$ & & | & \mathtt{0x12}~~x{:}{\mathtt{funcidx}} & \quad\Rightarrow\quad{} & \mathsf{return\_call}~x \\ & & | & \mathtt{0x13}~~y{:}{\mathtt{typeidx}}~~x{:}{\mathtt{tableidx}} & \quad\Rightarrow\quad{} & \mathsf{return\_call\_indirect}~x~y \\ & & | & \mathtt{0x1F}~~{\mathit{bt}}{:}{\mathtt{blocktype}}~~{c^\ast}{:}{\mathtt{list}}({\mathtt{catch}})~~{({\mathit{in}}{:}{\mathtt{instr}})^\ast}~~\mathtt{0x0B} & \quad\Rightarrow\quad{} & \mathsf{try\_table}~{\mathit{bt}}~{c^\ast}~{{\mathit{in}}^\ast} \\ -& & | & \dots \\ & {\mathtt{catch}} & ::= & \mathtt{0x00}~~x{:}{\mathtt{tagidx}}~~l{:}{\mathtt{labelidx}} & \quad\Rightarrow\quad{} & \mathsf{catch}~x~l \\ & & | & \mathtt{0x01}~~x{:}{\mathtt{tagidx}}~~l{:}{\mathtt{labelidx}} & \quad\Rightarrow\quad{} & \mathsf{catch\_ref}~x~l \\ & & | & \mathtt{0x02}~~l{:}{\mathtt{labelidx}} & \quad\Rightarrow\quad{} & \mathsf{catch\_all}~l \\ @@ -11440,7 +11427,6 @@ $$ & & | & \mathtt{0x22}~~x{:}{\mathtt{localidx}} & \quad\Rightarrow\quad{} & \mathsf{local{.}tee}~x \\ & & | & \mathtt{0x23}~~x{:}{\mathtt{globalidx}} & \quad\Rightarrow\quad{} & \mathsf{global{.}get}~x \\ & & | & \mathtt{0x24}~~x{:}{\mathtt{globalidx}} & \quad\Rightarrow\quad{} & \mathsf{global{.}set}~x \\ -& & | & \dots \\ \end{array} $$ @@ -11457,7 +11443,6 @@ $$ & & | & \mathtt{0xFC}~~15{:}{\mathtt{u32}}~~x{:}{\mathtt{tableidx}} & \quad\Rightarrow\quad{} & \mathsf{table{.}grow}~x \\ & & | & \mathtt{0xFC}~~16{:}{\mathtt{u32}}~~x{:}{\mathtt{tableidx}} & \quad\Rightarrow\quad{} & \mathsf{table{.}size}~x \\ & & | & \mathtt{0xFC}~~17{:}{\mathtt{u32}}~~x{:}{\mathtt{tableidx}} & \quad\Rightarrow\quad{} & \mathsf{table{.}fill}~x \\ -& & | & \dots \\ \end{array} $$ @@ -11471,8 +11456,8 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{memarg}} & ::= & n{:}{\mathtt{u32}}~~m{:}{\mathtt{u32}} & \quad\Rightarrow\quad{} & (0, \{ \mathsf{align}~n,\;\allowbreak \mathsf{offset}~m \}) & \quad \mbox{if}~ n < {2^{6}} \\ -& & | & n{:}{\mathtt{u32}}~~x{:}{\mathtt{memidx}}~~m{:}{\mathtt{u32}} & \quad\Rightarrow\quad{} & (x, \{ \mathsf{align}~(n - {2^{6}}),\;\allowbreak \mathsf{offset}~m \}) & \quad \mbox{if}~ {2^{6}} \leq n < {2^{7}} \\ +& {\mathtt{memarg}} & ::= & n{:}{\mathtt{u32}}~~m{:}{\mathtt{u64}} & \quad\Rightarrow\quad{} & (0, \{ \mathsf{align}~n,\;\allowbreak \mathsf{offset}~m \}) & \quad \mbox{if}~ n < {2^{6}} \\ +& & | & n{:}{\mathtt{u32}}~~x{:}{\mathtt{memidx}}~~m{:}{\mathtt{u64}} & \quad\Rightarrow\quad{} & (x, \{ \mathsf{align}~(n - {2^{6}}),\;\allowbreak \mathsf{offset}~m \}) & \quad \mbox{if}~ {2^{6}} \leq n < {2^{7}} \\ & {\mathtt{instr}} & ::= & \dots \\ & & | & \mathtt{0x28}~~(x, {\mathit{ao}}){:}{\mathtt{memarg}} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 32}}{.}\mathsf{load}~x~{\mathit{ao}} \\ & & | & \mathtt{0x29}~~(x, {\mathit{ao}}){:}{\mathtt{memarg}} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}}{.}\mathsf{load}~x~{\mathit{ao}} \\ @@ -11503,7 +11488,6 @@ $$ & & | & \mathtt{0xFC}~~9{:}{\mathtt{u32}}~~x{:}{\mathtt{dataidx}} & \quad\Rightarrow\quad{} & \mathsf{data{.}drop}~x \\ & & | & \mathtt{0xFC}~~10{:}{\mathtt{u32}}~~x_1{:}{\mathtt{memidx}}~~x_2{:}{\mathtt{memidx}} & \quad\Rightarrow\quad{} & \mathsf{memory{.}copy}~x_1~x_2 \\ & & | & \mathtt{0xFC}~~11{:}{\mathtt{u32}}~~x{:}{\mathtt{memidx}} & \quad\Rightarrow\quad{} & \mathsf{memory{.}fill}~x \\ -& & | & \dots \\ \end{array} $$ @@ -11562,7 +11546,6 @@ $$ & & | & \mathtt{0xFB}~~28{:}{\mathtt{u32}} & \quad\Rightarrow\quad{} & \mathsf{ref{.}i{\scriptstyle 31}} \\ & & | & \mathtt{0xFB}~~29{:}{\mathtt{u32}} & \quad\Rightarrow\quad{} & {\mathsf{i{\scriptstyle 31}{.}get}}{\mathsf{\_}}{\mathsf{s}} \\ & & | & \mathtt{0xFB}~~30{:}{\mathtt{u32}} & \quad\Rightarrow\quad{} & {\mathsf{i{\scriptstyle 31}{.}get}}{\mathsf{\_}}{\mathsf{u}} \\ -& & | & \dots \\ \end{array} $$ @@ -11678,7 +11661,6 @@ $$ & & | & \mathtt{0xA4} & \quad\Rightarrow\quad{} & \mathsf{f{\scriptstyle 64}} {.} \mathsf{min} \\ & & | & \mathtt{0xA5} & \quad\Rightarrow\quad{} & \mathsf{f{\scriptstyle 64}} {.} \mathsf{max} \\ & & | & \mathtt{0xA6} & \quad\Rightarrow\quad{} & \mathsf{f{\scriptstyle 64}} {.} \mathsf{copysign} \\ -& & | & \dots \\ \end{array} $$ @@ -11720,7 +11702,6 @@ $$ & & | & \mathtt{0xFC}~~5{:}{\mathtt{u32}} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{trunc\_sat}}{\mathsf{\_}}{\mathsf{u}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 32}}} \\ & & | & \mathtt{0xFC}~~6{:}{\mathtt{u32}} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{trunc\_sat}}{\mathsf{\_}}{\mathsf{s}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 64}}} \\ & & | & \mathtt{0xFC}~~7{:}{\mathtt{u32}} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} {.} {{\mathsf{trunc\_sat}}{\mathsf{\_}}{\mathsf{u}}}{\mathsf{\_}}{\mathsf{f{\scriptstyle 64}}} \\ -& & | & \dots \\ \end{array} $$ @@ -12267,9 +12248,9 @@ $$ & {\mathtt{uN}} & ::= & \epsilon \\ & {\mathtt{sN}} & ::= & \epsilon \\ & {\mathtt{fN}} & ::= & \epsilon \\ -& {\mathtt{token}} & ::= & {\mathtt{keyword}} ~~|~~ {\mathtt{uN}} ~~|~~ {\mathtt{sN}} ~~|~~ {\mathtt{fN}} ~~|~~ {\mathtt{string}} ~~|~~ {\mathtt{id}} ~~|~~ \mbox{‘}\mathtt{(}\mbox{’} ~~|~~ \mbox{‘}\mathtt{)}\mbox{’} ~~|~~ {\mathtt{reserved}} \\ -& {\mathtt{keyword}} & ::= & (\mbox{‘}\mathtt{a}\mbox{’} ~~|~~ \ldots ~~|~~ \mbox{‘}\mathtt{z}\mbox{’})~~{{\mathtt{idchar}}^\ast} \\ -& {\mathtt{reserved}} & ::= & {({\mathtt{idchar}} ~~|~~ {\mathtt{string}} ~~|~~ \mbox{‘}\mathtt{,}\mbox{’} ~~|~~ \mbox{‘}\mathtt{;}\mbox{’} ~~|~~ \mbox{‘}\mathtt{{[}}\mbox{’} ~~|~~ \mbox{‘}\mathtt{{]}}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\{}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\}}\mbox{’})^{+}} \\ +& {\mathtt{token}} & ::= & {\mathtt{keyword}} ~~|~~ {\mathtt{uN}} ~~|~~ {\mathtt{sN}} ~~|~~ {\mathtt{fN}} ~~|~~ {\mathtt{string}} ~~|~~ {\mathtt{id}} ~~|~~ \mbox{‘\texttt{{(}}’} ~~|~~ \mbox{‘\texttt{{)}}’} ~~|~~ {\mathtt{reserved}} \\ +& {\mathtt{keyword}} & ::= & (\mbox{‘\texttt{a}’} ~~|~~ \ldots ~~|~~ \mbox{‘\texttt{z}’})~~{{\mathtt{idchar}}^\ast} \\ +& {\mathtt{reserved}} & ::= & {({\mathtt{idchar}} ~~|~~ {\mathtt{string}} ~~|~~ \mbox{‘\texttt{,}’} ~~|~~ \mbox{‘\texttt{;}’} ~~|~~ \mbox{‘\texttt{{[}}’} ~~|~~ \mbox{‘\texttt{{]}}’} ~~|~~ \mbox{‘\texttt{{\{}}’} ~~|~~ \mbox{‘\texttt{{\}}}’})^{+}} \\ \end{array} $$ @@ -12277,7 +12258,7 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{space}} & ::= & {(\mbox{‘}\mathtt{ }\mbox{’} ~~|~~ {\mathtt{format}} ~~|~~ {\mathtt{comment}} ~~|~~ {\mathtt{annot}})^\ast} \\ +& {\mathtt{space}} & ::= & {(\mbox{‘\texttt{ }’} ~~|~~ {\mathtt{format}} ~~|~~ {\mathtt{comment}} ~~|~~ {\mathtt{annot}})^\ast} \\ & {\mathtt{format}} & ::= & {\mathtt{newline}} ~~|~~ \mathrm{U{+}09} \\ & {\mathtt{newline}} & ::= & \mathrm{U{+}0A} ~~|~~ \mathrm{U{+}0D} ~~|~~ \mathrm{U{+}0D}~~\mathrm{U{+}0A} \\ \end{array} @@ -12295,10 +12276,10 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{linecomment}} & ::= & \mbox{‘}\mathtt{;;}\mbox{’}~~{{\mathtt{linechar}}^\ast}~~({\mathtt{newline}} ~~|~~ {\mathtt{eof}}) \\ -& {\mathtt{eof}} & ::= & \mbox{‘}\mathtt{}\mbox{’} \\ +& {\mathtt{linecomment}} & ::= & \mbox{‘\texttt{;;}’}~~{{\mathtt{linechar}}^\ast}~~({\mathtt{newline}} ~~|~~ {\mathtt{eof}}) \\ +& {\mathtt{eof}} & ::= & \mbox{‘\texttt{}’} \\ & {\mathtt{linechar}} & ::= & c{:}{\mathtt{char}} & \quad \mbox{if}~ c \neq \mathrm{U{+}0A} \land c \neq \mathrm{U{+}0D} \\ -& {\mathtt{blockcomment}} & ::= & \mbox{‘}\mathtt{(;}\mbox{’}~~{{\mathtt{blockchar}}^\ast}~~\mbox{‘}\mathtt{;)}\mbox{’} \\ +& {\mathtt{blockcomment}} & ::= & \mbox{‘\texttt{{(};}’}~~{{\mathtt{blockchar}}^\ast}~~\mbox{‘\texttt{;{)}}’} \\ \end{array} $$ @@ -12306,9 +12287,9 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{blockchar}} & ::= & c{:}{\mathtt{char}} & \quad \mbox{if}~ c \neq \mbox{‘}\mathtt{;}\mbox{’} \land c \neq \mbox{‘}\mathtt{(}\mbox{’} \\ -& & | & {\mbox{‘}\mathtt{;}\mbox{’}^{+}}~~c{:}{\mathtt{char}} & \quad \mbox{if}~ c \neq \mbox{‘}\mathtt{;}\mbox{’} \land c \neq \mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & {\mbox{‘}\mathtt{(}\mbox{’}^{+}}~~c{:}{\mathtt{char}} & \quad \mbox{if}~ c \neq \mbox{‘}\mathtt{;}\mbox{’} \land c \neq \mbox{‘}\mathtt{(}\mbox{’} \\ +& {\mathtt{blockchar}} & ::= & c{:}{\mathtt{char}} & \quad \mbox{if}~ c \neq \mbox{‘\texttt{;}’} \land c \neq \mbox{‘\texttt{{(}}’} \\ +& & | & {\mbox{‘\texttt{;}’}^{+}}~~c{:}{\mathtt{char}} & \quad \mbox{if}~ c \neq \mbox{‘\texttt{;}’} \land c \neq \mbox{‘\texttt{{)}}’} \\ +& & | & {\mbox{‘\texttt{{(}}’}^{+}}~~c{:}{\mathtt{char}} & \quad \mbox{if}~ c \neq \mbox{‘\texttt{;}’} \land c \neq \mbox{‘\texttt{{(}}’} \\ & & | & {\mathtt{blockcomment}} \\ \end{array} $$ @@ -12317,7 +12298,7 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{annot}} & ::= & \mbox{‘}\mathtt{(@}\mbox{’}~~{\mathtt{annotid}}~~{({\mathtt{space}} ~~|~~ {\mathtt{token}})^\ast}~~\mbox{‘}\mathtt{)}\mbox{’} \\ +& {\mathtt{annot}} & ::= & \mbox{‘\texttt{{(}@}’}~~{\mathtt{annotid}}~~{({\mathtt{space}} ~~|~~ {\mathtt{token}})^\ast}~~\mbox{‘\texttt{{)}}’} \\ & {\mathtt{annotid}} & ::= & {{\mathtt{idchar}}^{+}} ~~|~~ {\mathtt{name}} \\ \end{array} $$ @@ -12326,17 +12307,17 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{sign}} & ::= & \epsilon ~\Rightarrow~ {+1} ~~|~~ \mbox{‘}\mathtt{+}\mbox{’} ~\Rightarrow~ {+1} ~~|~~ \mbox{‘}\mathtt{\mbox{-}}\mbox{’} ~\Rightarrow~ {-1} \\ -& {\mathtt{digit}} & ::= & \mbox{‘}\mathtt{0}\mbox{’} ~\Rightarrow~ 0 ~~|~~ \ldots ~~|~~ \mbox{‘}\mathtt{9}\mbox{’} ~\Rightarrow~ 9 \\ +& {\mathtt{sign}} & ::= & \epsilon ~\Rightarrow~ {+1} ~~|~~ \mbox{‘\texttt{+}’} ~\Rightarrow~ {+1} ~~|~~ \mbox{‘\texttt{{-}}’} ~\Rightarrow~ {-1} \\ +& {\mathtt{digit}} & ::= & \mbox{‘\texttt{0}’} ~\Rightarrow~ 0 ~~|~~ \ldots ~~|~~ \mbox{‘\texttt{9}’} ~\Rightarrow~ 9 \\ & {\mathtt{hexdigit}} & ::= & d{:}{\mathtt{digit}} ~\Rightarrow~ d \\ -& & | & \mbox{‘}\mathtt{A}\mbox{’} ~\Rightarrow~ 10 ~~|~~ \ldots ~~|~~ \mbox{‘}\mathtt{F}\mbox{’} ~\Rightarrow~ 15 \\ -& & | & \mbox{‘}\mathtt{a}\mbox{’} ~\Rightarrow~ 10 ~~|~~ \ldots ~~|~~ \mbox{‘}\mathtt{f}\mbox{’} ~\Rightarrow~ 15 \\ +& & | & \mbox{‘\texttt{A}’} ~\Rightarrow~ 10 ~~|~~ \ldots ~~|~~ \mbox{‘\texttt{F}’} ~\Rightarrow~ 15 \\ +& & | & \mbox{‘\texttt{a}’} ~\Rightarrow~ 10 ~~|~~ \ldots ~~|~~ \mbox{‘\texttt{f}’} ~\Rightarrow~ 15 \\ & {\mathtt{num}} & ::= & d{:}{\mathtt{digit}} & \quad\Rightarrow\quad{} & d \\ -& & | & n{:}{\mathtt{num}}~~{\mbox{‘}\mathtt{\_}\mbox{’}^?}~~d{:}{\mathtt{digit}} & \quad\Rightarrow\quad{} & 10 \, n + d \\ +& & | & n{:}{\mathtt{num}}~~{\mbox{‘\texttt{\_}’}^?}~~d{:}{\mathtt{digit}} & \quad\Rightarrow\quad{} & 10 \, n + d \\ & {\mathtt{hexnum}} & ::= & h{:}{\mathtt{hexdigit}} & \quad\Rightarrow\quad{} & h \\ -& & | & n{:}{\mathtt{hexnum}}~~{\mbox{‘}\mathtt{\_}\mbox{’}^?}~~h{:}{\mathtt{hexdigit}} & \quad\Rightarrow\quad{} & 16 \, n + h \\ +& & | & n{:}{\mathtt{hexnum}}~~{\mbox{‘\texttt{\_}’}^?}~~h{:}{\mathtt{hexdigit}} & \quad\Rightarrow\quad{} & 16 \, n + h \\ & {{\mathtt{u}}}{N} & ::= & n{:}{\mathtt{num}} & \quad\Rightarrow\quad{} & n & \quad \mbox{if}~ n < {2^{N}} \\ -& & | & \mbox{‘}\mathtt{0x}\mbox{’}~~n{:}{\mathtt{hexnum}} & \quad\Rightarrow\quad{} & n & \quad \mbox{if}~ n < {2^{N}} \\ +& & | & \mbox{‘\texttt{0x}’}~~n{:}{\mathtt{hexnum}} & \quad\Rightarrow\quad{} & n & \quad \mbox{if}~ n < {2^{N}} \\ & {{\mathtt{s}}}{N} & ::= & s{:}{\mathtt{sign}}~~n{:}{{\mathtt{u}}}{N} & \quad\Rightarrow\quad{} & s \cdot n & \quad \mbox{if}~ {-{2^{N - 1}}} \leq s \cdot n < {2^{N - 1}} \\ & {{\mathtt{i}}}{N} & ::= & n{:}{{\mathtt{u}}}{N} & \quad\Rightarrow\quad{} & n \\ & & | & i{:}{{\mathtt{s}}}{N} & \quad\Rightarrow\quad{} & {{{{\mathrm{signed}}}_{N}^{{-1}}}}{(i)} \\ @@ -12348,25 +12329,25 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} & {\mathtt{frac}} & ::= & d{:}{\mathtt{digit}} & \quad\Rightarrow\quad{} & d / 10 \\ -& & | & d{:}{\mathtt{digit}}~~{\mbox{‘}\mathtt{\_}\mbox{’}^?}~~p{:}{\mathtt{frac}} & \quad\Rightarrow\quad{} & (d + p / 10) / 10 \\ +& & | & d{:}{\mathtt{digit}}~~{\mbox{‘\texttt{\_}’}^?}~~p{:}{\mathtt{frac}} & \quad\Rightarrow\quad{} & (d + p / 10) / 10 \\ & {\mathtt{hexfrac}} & ::= & h{:}{\mathtt{hexdigit}} & \quad\Rightarrow\quad{} & h / 16 \\ -& & | & h{:}{\mathtt{hexdigit}}~~{\mbox{‘}\mathtt{\_}\mbox{’}^?}~~p{:}{\mathtt{hexfrac}} & \quad\Rightarrow\quad{} & (h + p / 16) / 16 \\ -& {\mathtt{mant}} & ::= & p{:}{\mathtt{num}}~~{\mbox{‘}\mathtt{.}\mbox{’}^?} & \quad\Rightarrow\quad{} & p \\ -& & | & p{:}{\mathtt{num}}~~\mbox{‘}\mathtt{.}\mbox{’}~~q{:}{\mathtt{frac}} & \quad\Rightarrow\quad{} & p + q \\ -& {\mathtt{hexmant}} & ::= & p{:}{\mathtt{hexnum}}~~{\mbox{‘}\mathtt{.}\mbox{’}^?} & \quad\Rightarrow\quad{} & p \\ -& & | & p{:}{\mathtt{hexnum}}~~\mbox{‘}\mathtt{.}\mbox{’}~~q{:}{\mathtt{hexfrac}} & \quad\Rightarrow\quad{} & p + q \\ +& & | & h{:}{\mathtt{hexdigit}}~~{\mbox{‘\texttt{\_}’}^?}~~p{:}{\mathtt{hexfrac}} & \quad\Rightarrow\quad{} & (h + p / 16) / 16 \\ +& {\mathtt{mant}} & ::= & p{:}{\mathtt{num}}~~{\mbox{‘\texttt{.}’}^?} & \quad\Rightarrow\quad{} & p \\ +& & | & p{:}{\mathtt{num}}~~\mbox{‘\texttt{.}’}~~q{:}{\mathtt{frac}} & \quad\Rightarrow\quad{} & p + q \\ +& {\mathtt{hexmant}} & ::= & p{:}{\mathtt{hexnum}}~~{\mbox{‘\texttt{.}’}^?} & \quad\Rightarrow\quad{} & p \\ +& & | & p{:}{\mathtt{hexnum}}~~\mbox{‘\texttt{.}’}~~q{:}{\mathtt{hexfrac}} & \quad\Rightarrow\quad{} & p + q \\ \end{array} $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{float}} & ::= & p{:}{\mathtt{mant}}~~(\mbox{‘}\mathtt{E}\mbox{’} ~~|~~ \mbox{‘}\mathtt{e}\mbox{’})~~s{:}{\mathtt{sign}}~~e{:}{\mathtt{num}} & \quad\Rightarrow\quad{} & p \cdot {10^{s \cdot e}} \\ -& {\mathtt{hexfloat}} & ::= & \mbox{‘}\mathtt{0x}\mbox{’}~~p{:}{\mathtt{hexmant}}~~(\mbox{‘}\mathtt{P}\mbox{’} ~~|~~ \mbox{‘}\mathtt{p}\mbox{’})~~s{:}{\mathtt{sign}}~~e{:}{\mathtt{num}} & \quad\Rightarrow\quad{} & p \cdot {2^{s \cdot e}} \\ +& {\mathtt{float}} & ::= & p{:}{\mathtt{mant}}~~(\mbox{‘\texttt{E}’} ~~|~~ \mbox{‘\texttt{e}’})~~s{:}{\mathtt{sign}}~~e{:}{\mathtt{num}} & \quad\Rightarrow\quad{} & p \cdot {10^{s \cdot e}} \\ +& {\mathtt{hexfloat}} & ::= & \mbox{‘\texttt{0x}’}~~p{:}{\mathtt{hexmant}}~~(\mbox{‘\texttt{P}’} ~~|~~ \mbox{‘\texttt{p}’})~~s{:}{\mathtt{sign}}~~e{:}{\mathtt{num}} & \quad\Rightarrow\quad{} & p \cdot {2^{s \cdot e}} \\ & {\mathtt{fNmag}} & ::= & q{:}{\mathtt{float}} & \quad\Rightarrow\quad{} & {{\mathrm{ieee}}}_{N}(q) & \quad \mbox{if}~ {{\mathrm{ieee}}}_{N}(q) \neq \infty \\ & & | & q{:}{\mathtt{hexfloat}} & \quad\Rightarrow\quad{} & {{\mathrm{ieee}}}_{N}(q) & \quad \mbox{if}~ {{\mathrm{ieee}}}_{N}(q) \neq \infty \\ -& & | & \mbox{‘}\mathtt{inf}\mbox{’} & \quad\Rightarrow\quad{} & \infty \\ -& & | & \mbox{‘}\mathtt{nan}\mbox{’} & \quad\Rightarrow\quad{} & {\mathsf{nan}}{({{\mathrm{canon}}}_{N})} \\ -& & | & \mbox{‘}\mathtt{nan:0x}\mbox{’}~~n{:}{\mathtt{hexnum}} & \quad\Rightarrow\quad{} & {\mathsf{nan}}{(n)} & \quad \mbox{if}~ 1 \leq n < {2^{{\mathrm{signif}}(N)}} \\ +& & | & \mbox{‘\texttt{inf}’} & \quad\Rightarrow\quad{} & \infty \\ +& & | & \mbox{‘\texttt{nan}’} & \quad\Rightarrow\quad{} & {\mathsf{nan}}{({{\mathrm{canon}}}_{N})} \\ +& & | & \mbox{‘\texttt{nan:0x}’}~~n{:}{\mathtt{hexnum}} & \quad\Rightarrow\quad{} & {\mathsf{nan}}{(n)} & \quad \mbox{if}~ 1 \leq n < {2^{{\mathrm{signif}}(N)}} \\ & {{\mathtt{f}}}{N} & ::= & ({+1}){:}{\mathtt{sign}}~~q{:}{\mathtt{fNmag}} & \quad\Rightarrow\quad{} & {+q} \\ & & | & ({-1}){:}{\mathtt{sign}}~~q{:}{\mathtt{fNmag}} & \quad\Rightarrow\quad{} & {-q} \\ \end{array} @@ -12393,17 +12374,17 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{stringchar}} & ::= & c{:}{\mathtt{char}} & \quad\Rightarrow\quad{} & c & \quad \mbox{if}~ c \geq \mathrm{U{+}20} \land c \neq \mathrm{U{+}7F} \land c \neq \mbox{‘}\mathtt{\kern-0.02em{'}\kern-0.05em{'}\kern-0.02em}\mbox{’} \land c \neq \mbox{‘}\mathtt{\backslash{}}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{\backslash{}t}\mbox{’} & \quad\Rightarrow\quad{} & \mathrm{U{+}09} \\ -& & | & \mbox{‘}\mathtt{\backslash{}n}\mbox{’} & \quad\Rightarrow\quad{} & \mathrm{U{+}0A} \\ -& & | & \mbox{‘}\mathtt{\backslash{}r}\mbox{’} & \quad\Rightarrow\quad{} & \mathrm{U{+}0D} \\ -& & | & \mbox{‘}\mathtt{\backslash{}\kern-0.02em{'}\kern-0.05em{'}\kern-0.02em}\mbox{’} & \quad\Rightarrow\quad{} & \mathrm{U{+}22} \\ -& & | & \mbox{‘}\mathtt{\backslash{}\kern0.03em{'}\kern0.03em}\mbox{’} & \quad\Rightarrow\quad{} & \mathrm{U{+}27} \\ -& & | & \mbox{‘}\mathtt{\backslash{}\backslash{}}\mbox{’} & \quad\Rightarrow\quad{} & \mathrm{U{+}5C} \\ -& & | & \mbox{‘}\mathtt{\backslash{}u\{}\mbox{’}~~n{:}{\mathtt{hexnum}}~~\mbox{‘}\mathtt{\}}\mbox{’} & \quad\Rightarrow\quad{} & n & \quad \mbox{if}~ n < \mathtt{0xD800} \lor \mathtt{0xE800} \leq n < \mathtt{0x110000} \\ +& {\mathtt{stringchar}} & ::= & c{:}{\mathtt{char}} & \quad\Rightarrow\quad{} & c & \quad \mbox{if}~ c \geq \mathrm{U{+}20} \land c \neq \mathrm{U{+}7F} \land c \neq \mbox{‘\texttt{\kern-0.02em{'}\kern-0.05em{'}\kern-0.02em}’} \land c \neq \mbox{‘\texttt{\(\mathtt{\backslash}\)}’} \\ +& & | & \mbox{‘\texttt{\(\mathtt{\backslash}\)t}’} & \quad\Rightarrow\quad{} & \mathrm{U{+}09} \\ +& & | & \mbox{‘\texttt{\(\mathtt{\backslash}\)n}’} & \quad\Rightarrow\quad{} & \mathrm{U{+}0A} \\ +& & | & \mbox{‘\texttt{\(\mathtt{\backslash}\)r}’} & \quad\Rightarrow\quad{} & \mathrm{U{+}0D} \\ +& & | & \mbox{‘\texttt{\(\mathtt{\backslash}\)\kern-0.02em{'}\kern-0.05em{'}\kern-0.02em}’} & \quad\Rightarrow\quad{} & \mathrm{U{+}22} \\ +& & | & \mbox{‘\texttt{\(\mathtt{\backslash}\)\kern0.03em{'}\kern0.03em}’} & \quad\Rightarrow\quad{} & \mathrm{U{+}27} \\ +& & | & \mbox{‘\texttt{\(\mathtt{\backslash}\)\(\mathtt{\backslash}\)}’} & \quad\Rightarrow\quad{} & \mathrm{U{+}5C} \\ +& & | & \mbox{‘\texttt{\(\mathtt{\backslash}\)u{\{}}’}~~n{:}{\mathtt{hexnum}}~~\mbox{‘\texttt{{\}}}’} & \quad\Rightarrow\quad{} & n & \quad \mbox{if}~ n < \mathtt{0xD800} \lor \mathtt{0xE800} \leq n < \mathtt{0x110000} \\ & {\mathtt{stringelem}} & ::= & c{:}{\mathtt{stringchar}} & \quad\Rightarrow\quad{} & {\mathrm{utf{\kern-0.1em\scriptstyle 8}}}(c) \\ -& & | & \mbox{‘}\mathtt{\backslash{}}\mbox{’}~~h_1{:}{\mathtt{hexdigit}}~~h_2{:}{\mathtt{hexdigit}} & \quad\Rightarrow\quad{} & 16 \, h_1 + h_2 \\ -& {\mathtt{string}} & ::= & \mbox{‘}\mathtt{\kern-0.02em{'}\kern-0.05em{'}\kern-0.02em}\mbox{’}~~{({b^\ast}{:}{\mathtt{stringelem}})^\ast}~~\mbox{‘}\mathtt{\kern-0.02em{'}\kern-0.05em{'}\kern-0.02em}\mbox{’} & \quad\Rightarrow\quad{} & {\bigoplus}\, {{b^\ast}^\ast} & \quad \mbox{if}~ {|{\bigoplus}\, {{b^\ast}^\ast}|} < {2^{32}} \\ +& & | & \mbox{‘\texttt{\(\mathtt{\backslash}\)}’}~~h_1{:}{\mathtt{hexdigit}}~~h_2{:}{\mathtt{hexdigit}} & \quad\Rightarrow\quad{} & 16 \, h_1 + h_2 \\ +& {\mathtt{string}} & ::= & \mbox{‘\texttt{\kern-0.02em{'}\kern-0.05em{'}\kern-0.02em}’}~~{({b^\ast}{:}{\mathtt{stringelem}})^\ast}~~\mbox{‘\texttt{\kern-0.02em{'}\kern-0.05em{'}\kern-0.02em}’} & \quad\Rightarrow\quad{} & {\bigoplus}\, {{b^\ast}^\ast} & \quad \mbox{if}~ {|{\bigoplus}\, {{b^\ast}^\ast}|} < {2^{32}} \\ \end{array} $$ @@ -12427,13 +12408,13 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{idchar}} & ::= & \mbox{‘}\mathtt{0}\mbox{’} ~~|~~ \ldots ~~|~~ \mbox{‘}\mathtt{9}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{A}\mbox{’} ~~|~~ \ldots ~~|~~ \mbox{‘}\mathtt{Z}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{a}\mbox{’} ~~|~~ \ldots ~~|~~ \mbox{‘}\mathtt{z}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{!}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\#}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\$}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\%}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\&}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\kern0.03em{'}\kern0.03em}\mbox{’} ~~|~~ \mbox{‘}\mathtt{*}\mbox{’} ~~|~~ \mbox{‘}\mathtt{+}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\mbox{-}}\mbox{’} ~~|~~ \mbox{‘}\mathtt{.}\mbox{’} ~~|~~ \mbox{‘}\mathtt{/}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{:}\mbox{’} ~~|~~ \mbox{‘}\mathtt{<}\mbox{’} ~~|~~ \mbox{‘}\mathtt{=}\mbox{’} ~~|~~ \mbox{‘}\mathtt{>}\mbox{’} ~~|~~ \mbox{‘}\mathtt{?}\mbox{’} ~~|~~ \mbox{‘}\mathtt{@}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\backslash{}}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\hat{~~}}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\_}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\grave{~~}}\mbox{’} ~~|~~ \mbox{‘}\mathtt{|}\mbox{’} ~~|~~ \mbox{‘}\mathtt{\tilde{~~}}\mbox{’} \\ -& {\mathtt{id}} & ::= & \mbox{‘}\mathtt{\$}\mbox{’}~~{c^\ast}{:}{{\mathtt{idchar}}^{+}} & \quad\Rightarrow\quad{} & {c^\ast} \\ -& & | & \mbox{‘}\mathtt{\$}\mbox{’}~~{c^\ast}{:}{\mathtt{name}} & \quad\Rightarrow\quad{} & {c^\ast} & \quad \mbox{if}~ {|{c^\ast}|} > 0 \\ +& {\mathtt{idchar}} & ::= & \mbox{‘\texttt{0}’} ~~|~~ \ldots ~~|~~ \mbox{‘\texttt{9}’} \\ +& & | & \mbox{‘\texttt{A}’} ~~|~~ \ldots ~~|~~ \mbox{‘\texttt{Z}’} \\ +& & | & \mbox{‘\texttt{a}’} ~~|~~ \ldots ~~|~~ \mbox{‘\texttt{z}’} \\ +& & | & \mbox{‘\texttt{!}’} ~~|~~ \mbox{‘\texttt{\#}’} ~~|~~ \mbox{‘\texttt{\$}’} ~~|~~ \mbox{‘\texttt{\%}’} ~~|~~ \mbox{‘\texttt{\&}’} ~~|~~ \mbox{‘\texttt{\kern0.03em{'}\kern0.03em}’} ~~|~~ \mbox{‘\texttt{*}’} ~~|~~ \mbox{‘\texttt{+}’} ~~|~~ \mbox{‘\texttt{{-}}’} ~~|~~ \mbox{‘\texttt{.}’} ~~|~~ \mbox{‘\texttt{/}’} \\ +& & | & \mbox{‘\texttt{:}’} ~~|~~ \mbox{‘\texttt{{<}}’} ~~|~~ \mbox{‘\texttt{{=}}’} ~~|~~ \mbox{‘\texttt{{>}}’} ~~|~~ \mbox{‘\texttt{?}’} ~~|~~ \mbox{‘\texttt{@}’} ~~|~~ \mbox{‘\texttt{\(\mathtt{\backslash}\)}’} ~~|~~ \mbox{‘\texttt{\(\mathtt{\hat{~~}}\)}’} ~~|~~ \mbox{‘\texttt{\_}’} ~~|~~ \mbox{‘\texttt{\(\mathtt{\grave{~~}}\)}’} ~~|~~ \mbox{‘\texttt{|}’} ~~|~~ \mbox{‘\texttt{\(\mathtt{\tilde{~~}}\)}’} \\ +& {\mathtt{id}} & ::= & \mbox{‘\texttt{\$}’}~~{c^\ast}{:}{{\mathtt{idchar}}^{+}} & \quad\Rightarrow\quad{} & {c^\ast} \\ +& & | & \mbox{‘\texttt{\$}’}~~{c^\ast}{:}{\mathtt{name}} & \quad\Rightarrow\quad{} & {c^\ast} & \quad \mbox{if}~ {|{c^\ast}|} > 0 \\ \end{array} $$ @@ -12453,7 +12434,7 @@ $$ \mathsf{locals}~{({{\mathit{name}}^?})^\ast} \\ \mathsf{labels}~{({{\mathit{name}}^?})^\ast} \\ \mathsf{fields}~{({({{\mathit{name}}^?})^\ast})^\ast} \\ -\mathsf{typedefs}~{({{\mathit{subtype}}^?})^\ast} \} \\ +\mathsf{typedefs}~{({{\mathit{deftype}}^?})^\ast} \} \\ \end{array} \\ & I & ::= & {\mathit{idctxt}} \\ \end{array} @@ -12461,8 +12442,8 @@ $$ $$ \begin{array}[t]{@{}lcl@{}l@{}} -{\mathrm{concat}}_{\mathit{idctxt}}(\epsilon) & = & \{ \} \\ -{\mathrm{concat}}_{\mathit{idctxt}}(I~{I'}) & = & I \oplus {\mathrm{concat}}_{\mathit{idctxt}}({{I'}^\ast}) \\ +{\bigoplus}\, \epsilon & = & \{ \} \\ +{\bigoplus}\, I~{I'} & = & I \oplus {\bigoplus}\, {{I'}^\ast} \\ \end{array} $$ @@ -12520,11 +12501,11 @@ $$ & {{\mathtt{localidx}}}_{I} & ::= & {{\mathtt{idx}}}_{I{.}\mathsf{locals}} \\ & {{\mathtt{labelidx}}}_{I} & ::= & {{\mathtt{idx}}}_{I{.}\mathsf{labels}} \\ & {{\mathtt{fieldidx}}}_{I, x} & ::= & {{\mathtt{idx}}}_{I{.}\mathsf{fields}{}[x]} \\ -& {{\mathtt{externidx}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{tag}\mbox{’}~~x{:}{{\mathtt{tagidx}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{tag}~x \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{global}\mbox{’}~~x{:}{{\mathtt{globalidx}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{global}~x \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{memory}\mbox{’}~~x{:}{{\mathtt{memidx}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{mem}~x \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{table}\mbox{’}~~x{:}{{\mathtt{tableidx}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{table}~x \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{func}\mbox{’}~~x{:}{{\mathtt{funcidx}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{func}~x \\ +& {{\mathtt{externidx}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{tag}’}~~x{:}{{\mathtt{tagidx}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & \mathsf{tag}~x \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{global}’}~~x{:}{{\mathtt{globalidx}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & \mathsf{global}~x \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{memory}’}~~x{:}{{\mathtt{memidx}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & \mathsf{mem}~x \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{table}’}~~x{:}{{\mathtt{tableidx}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & \mathsf{table}~x \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{func}’}~~x{:}{{\mathtt{funcidx}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & \mathsf{func}~x \\ \end{array} $$ @@ -12532,11 +12513,11 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{numtype}} & ::= & \mbox{‘}\mathtt{i32}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 32}} \\ -& & | & \mbox{‘}\mathtt{i64}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} \\ -& & | & \mbox{‘}\mathtt{f32}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{f{\scriptstyle 32}} \\ -& & | & \mbox{‘}\mathtt{f64}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{f{\scriptstyle 64}} \\ -& {\mathtt{vectype}} & ::= & \mbox{‘}\mathtt{v128}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{v{\scriptstyle 128}} \\ +& {\mathtt{numtype}} & ::= & \mbox{‘\texttt{i32}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 32}} \\ +& & | & \mbox{‘\texttt{i64}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} \\ +& & | & \mbox{‘\texttt{f32}’} & \quad\Rightarrow\quad{} & \mathsf{f{\scriptstyle 32}} \\ +& & | & \mbox{‘\texttt{f64}’} & \quad\Rightarrow\quad{} & \mathsf{f{\scriptstyle 64}} \\ +& {\mathtt{vectype}} & ::= & \mbox{‘\texttt{v128}’} & \quad\Rightarrow\quad{} & \mathsf{v{\scriptstyle 128}} \\ \end{array} $$ @@ -12544,34 +12525,34 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{absheaptype}} & ::= & \mbox{‘}\mathtt{any}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{any} \\ -& & | & \mbox{‘}\mathtt{eq}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{eq} \\ -& & | & \mbox{‘}\mathtt{i31}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 31}} \\ -& & | & \mbox{‘}\mathtt{struct}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{struct} \\ -& & | & \mbox{‘}\mathtt{array}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{array} \\ -& & | & \mbox{‘}\mathtt{none}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{none} \\ -& & | & \mbox{‘}\mathtt{func}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{func} \\ -& & | & \mbox{‘}\mathtt{nofunc}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{nofunc} \\ -& & | & \mbox{‘}\mathtt{exn}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{exn} \\ -& & | & \mbox{‘}\mathtt{noexn}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{noexn} \\ -& & | & \mbox{‘}\mathtt{extern}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{extern} \\ -& & | & \mbox{‘}\mathtt{noextern}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{noextern} \\ +& {\mathtt{absheaptype}} & ::= & \mbox{‘\texttt{any}’} & \quad\Rightarrow\quad{} & \mathsf{any} \\ +& & | & \mbox{‘\texttt{eq}’} & \quad\Rightarrow\quad{} & \mathsf{eq} \\ +& & | & \mbox{‘\texttt{i31}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 31}} \\ +& & | & \mbox{‘\texttt{struct}’} & \quad\Rightarrow\quad{} & \mathsf{struct} \\ +& & | & \mbox{‘\texttt{array}’} & \quad\Rightarrow\quad{} & \mathsf{array} \\ +& & | & \mbox{‘\texttt{none}’} & \quad\Rightarrow\quad{} & \mathsf{none} \\ +& & | & \mbox{‘\texttt{func}’} & \quad\Rightarrow\quad{} & \mathsf{func} \\ +& & | & \mbox{‘\texttt{nofunc}’} & \quad\Rightarrow\quad{} & \mathsf{nofunc} \\ +& & | & \mbox{‘\texttt{exn}’} & \quad\Rightarrow\quad{} & \mathsf{exn} \\ +& & | & \mbox{‘\texttt{noexn}’} & \quad\Rightarrow\quad{} & \mathsf{noexn} \\ +& & | & \mbox{‘\texttt{extern}’} & \quad\Rightarrow\quad{} & \mathsf{extern} \\ +& & | & \mbox{‘\texttt{noextern}’} & \quad\Rightarrow\quad{} & \mathsf{noextern} \\ & {{\mathtt{heaptype}}}_{I} & ::= & {\mathit{ht}}{:}{\mathtt{absheaptype}} & \quad\Rightarrow\quad{} & {\mathit{ht}} \\ & & | & x{:}{{\mathtt{typeidx}}}_{I} & \quad\Rightarrow\quad{} & x \\ -& {\mathtt{null}} & ::= & \mbox{‘}\mathtt{null}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{null} \\ -& {{\mathtt{reftype}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~{\mathsf{null}^?}{:}{{\mathtt{null}}^?}~~{\mathit{ht}}{:}{{\mathtt{heaptype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{ref}~{\mathsf{null}^?}~{\mathit{ht}} \\ -& & | & \mbox{‘}\mathtt{anyref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{any}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{eqref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{eq}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{i31ref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{i31}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{structref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{struct}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{arrayref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{array}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{nullref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{none}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{funcref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{func}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{nullfuncref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{nofunc}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{exnref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{exn}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{nullexnref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{noexn}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{externref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{extern}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& & | & \mbox{‘}\mathtt{nullexternref}\mbox{’} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{ref}\mbox{’}~~\mbox{‘}\mathtt{null}\mbox{’}~~\mbox{‘}\mathtt{noextern}\mbox{’}~~\mbox{‘}\mathtt{)}\mbox{’} \\ +& {\mathtt{null}} & ::= & \mbox{‘\texttt{null}’} & \quad\Rightarrow\quad{} & \mathsf{null} \\ +& {{\mathtt{reftype}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~{\mathsf{null}^?}{:}{{\mathtt{null}}^?}~~{\mathit{ht}}{:}{{\mathtt{heaptype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & \mathsf{ref}~{\mathsf{null}^?}~{\mathit{ht}} \\ +& & | & \mbox{‘\texttt{anyref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{any}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{eqref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{eq}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{i31ref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{i31}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{structref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{struct}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{arrayref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{array}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{nullref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{none}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{funcref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{func}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{nullfuncref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{nofunc}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{exnref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{exn}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{nullexnref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{noexn}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{externref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{extern}’}~~\mbox{‘\texttt{{)}}’} \\ +& & | & \mbox{‘\texttt{nullexternref}’} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{ref}’}~~\mbox{‘\texttt{null}’}~~\mbox{‘\texttt{noextern}’}~~\mbox{‘\texttt{{)}}’} \\ & {{\mathtt{valtype}}}_{I} & ::= & {\mathit{nt}}{:}{\mathtt{numtype}} & \quad\Rightarrow\quad{} & {\mathit{nt}} \\ & & | & {\mathit{vt}}{:}{\mathtt{vectype}} & \quad\Rightarrow\quad{} & {\mathit{vt}} \\ & & | & {\mathit{rt}}{:}{{\mathtt{reftype}}}_{I} & \quad\Rightarrow\quad{} & {\mathit{rt}} \\ @@ -12582,21 +12563,21 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{packtype}} & ::= & \mbox{‘}\mathtt{i8}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 8}} \\ -& & | & \mbox{‘}\mathtt{i16}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 16}} \\ +& {\mathtt{packtype}} & ::= & \mbox{‘\texttt{i8}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 8}} \\ +& & | & \mbox{‘\texttt{i16}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 16}} \\ & {{\mathtt{storagetype}}}_{I} & ::= & t{:}{{\mathtt{valtype}}}_{I} & \quad\Rightarrow\quad{} & t \\ & & | & {\mathit{pt}}{:}{\mathtt{packtype}} & \quad\Rightarrow\quad{} & {\mathit{pt}} \\ & {{\mathtt{fieldtype}}}_{I} & ::= & {\mathit{zt}}{:}{{\mathtt{storagetype}}}_{I} & \quad\Rightarrow\quad{} & {\mathit{zt}} \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{mut}\mbox{’}~~{\mathit{zt}}{:}{{\mathtt{storagetype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{mut}~{\mathit{zt}} \\ -& {{\mathtt{field}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{field}\mbox{’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{ft}}{:}{{\mathtt{fieldtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & ({\mathit{ft}}, {{\mathit{id}}^?}) \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{field}\mbox{’}~~{{{\mathtt{fieldtype}}}_{I}^\ast}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\equiv\quad{} & {(\mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{field}\mbox{’}~~{{\mathtt{fieldtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’})^\ast} \\ -& {{\mathtt{param}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{param}\mbox{’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~t{:}{{\mathtt{valtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (t, {{\mathit{id}}^?}) \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{param}\mbox{’}~~{{{\mathtt{valtype}}}_{I}^\ast}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\equiv\quad{} & {(\mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{param}\mbox{’}~~{{\mathtt{valtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’})^\ast} \\ -& {{\mathtt{result}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{result}\mbox{’}~~t{:}{{\mathtt{valtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & t \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{result}\mbox{’}~~{{{\mathtt{valtype}}}_{I}^\ast}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\equiv\quad{} & {(\mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{param}\mbox{’}~~{{\mathtt{valtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’})^\ast} \\ -& {{\mathtt{comptype}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{struct}\mbox{’}~~{({\mathit{ft}}, {{\mathit{id}}^?})^\ast}{:}{\mathtt{list}}({{\mathtt{field}}}_{I})~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{struct}~{{\mathit{ft}}^\ast}, \{ \mathsf{fields}~{({{\mathit{id}}^?})^\ast} \}) \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{array}\mbox{’}~~{\mathit{ft}}{:}{{\mathtt{fieldtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{array}~{\mathit{ft}}, \{ \}) \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{func}\mbox{’}~~{(t_1, {{\mathit{id}}^?})^\ast}{:}{\mathtt{list}}({{\mathtt{param}}}_{I})~~{t_2^\ast}{:}{\mathtt{list}}({{\mathtt{result}}}_{I})~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast}, \{ \}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{mut}’}~~{\mathit{zt}}{:}{{\mathtt{storagetype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & \mathsf{mut}~{\mathit{zt}} \\ +& {{\mathtt{field}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{field}’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{ft}}{:}{{\mathtt{fieldtype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & ({\mathit{ft}}, {{\mathit{id}}^?}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{field}’}~~{{{\mathtt{fieldtype}}}_{I}^\ast}~~\mbox{‘\texttt{{)}}’} & \quad\equiv\quad{} & {(\mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{field}’}~~{{\mathtt{fieldtype}}}_{I}~~\mbox{‘\texttt{{)}}’})^\ast} \\ +& {{\mathtt{param}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{param}’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~t{:}{{\mathtt{valtype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (t, {{\mathit{id}}^?}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{param}’}~~{{{\mathtt{valtype}}}_{I}^\ast}~~\mbox{‘\texttt{{)}}’} & \quad\equiv\quad{} & {(\mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{param}’}~~{{\mathtt{valtype}}}_{I}~~\mbox{‘\texttt{{)}}’})^\ast} \\ +& {{\mathtt{result}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{result}’}~~t{:}{{\mathtt{valtype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & t \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{result}’}~~{{{\mathtt{valtype}}}_{I}^\ast}~~\mbox{‘\texttt{{)}}’} & \quad\equiv\quad{} & {(\mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{param}’}~~{{\mathtt{valtype}}}_{I}~~\mbox{‘\texttt{{)}}’})^\ast} \\ +& {{\mathtt{comptype}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{struct}’}~~{({\mathit{ft}}, {{\mathit{id}}^?})^\ast}{:}{\mathtt{list}}({{\mathtt{field}}}_{I})~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{struct}~{{\mathit{ft}}^\ast}, \{ \mathsf{fields}~{({{\mathit{id}}^?})^\ast} \}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{array}’}~~{\mathit{ft}}{:}{{\mathtt{fieldtype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{array}~{\mathit{ft}}, \{ \}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{func}’}~~{(t_1, {{\mathit{id}}^?})^\ast}{:}{\mathtt{list}}({{\mathtt{param}}}_{I})~~{t_2^\ast}{:}{\mathtt{list}}({{\mathtt{result}}}_{I})~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast}, \{ \}) \\ \end{array} $$ @@ -12604,12 +12585,12 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{final}} & ::= & \mbox{‘}\mathtt{final}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{final} \\ -& {{\mathtt{subtype}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{sub}\mbox{’}~~{{\mathit{fin}}^?}{:}{{\mathtt{final}}^?}~~{x^\ast}{:}{\mathtt{list}}({{\mathtt{typeidx}}}_{I})~~({\mathit{ct}}, {I'}){:}{{\mathtt{comptype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{sub}~{{\mathit{fin}}^?}~{x^\ast}~{\mathit{ct}}, {I'}) \\ -& & | & {{\mathtt{comptype}}}_{I} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{sub}\mbox{’}~~\mbox{‘}\mathtt{final}\mbox{’}~~{{\mathtt{comptype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} \\ -& {{\mathtt{typedef}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{type}\mbox{’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~({\mathit{st}}, {I'}){:}{{\mathtt{subtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & ({\mathit{st}}, {I'} \oplus \{ \mathsf{types}~({{\mathit{id}}^?}) \}) \\ -& {{\mathtt{rectype}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{rec}\mbox{’}~~{({\mathit{st}}, {I'})^\ast}{:}{\mathtt{list}}({{\mathtt{typedef}}}_{I})~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{rec}~{{\mathit{st}}^\ast}, {\mathrm{concat}}_{\mathit{idctxt}}({{I'}^\ast})) \\ -& & | & {{\mathtt{typedef}}}_{I} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{rec}\mbox{’}~~{{\mathtt{typedef}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} \\ +& {\mathtt{final}} & ::= & \mbox{‘\texttt{final}’} & \quad\Rightarrow\quad{} & \mathsf{final} \\ +& {{\mathtt{subtype}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{sub}’}~~{{\mathit{fin}}^?}{:}{{\mathtt{final}}^?}~~{x^\ast}{:}{\mathtt{list}}({{\mathtt{typeidx}}}_{I})~~({\mathit{ct}}, {I'}){:}{{\mathtt{comptype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{sub}~{{\mathit{fin}}^?}~{x^\ast}~{\mathit{ct}}, {I'}) \\ +& & | & {{\mathtt{comptype}}}_{I} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{sub}’}~~\mbox{‘\texttt{final}’}~~{{\mathtt{comptype}}}_{I}~~\mbox{‘\texttt{{)}}’} \\ +& {{\mathtt{typedef}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{type}’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~({\mathit{st}}, {I'}){:}{{\mathtt{subtype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & ({\mathit{st}}, {I'} \oplus \{ \mathsf{types}~({{\mathit{id}}^?}) \}) \\ +& {{\mathtt{rectype}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{rec}’}~~{({\mathit{st}}, {I'})^\ast}{:}{\mathtt{list}}({{\mathtt{typedef}}}_{I})~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{rec}~{{\mathit{st}}^\ast}, {\bigoplus}\, {{I'}^\ast}) \\ +& & | & {{\mathtt{typedef}}}_{I} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{rec}’}~~{{\mathtt{typedef}}}_{I}~~\mbox{‘\texttt{{)}}’} \\ \end{array} $$ @@ -12617,9 +12598,9 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {\mathtt{addrtype}} & ::= & \mbox{‘}\mathtt{i32}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 32}} \\ -& & | & \mbox{‘}\mathtt{i64}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} \\ -& & | & \epsilon & \quad\equiv\quad{} & \mbox{‘}\mathtt{i32}\mbox{’} \\ +& {\mathtt{addrtype}} & ::= & \mbox{‘\texttt{i32}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 32}} \\ +& & | & \mbox{‘\texttt{i64}’} & \quad\Rightarrow\quad{} & \mathsf{i{\scriptstyle 64}} \\ +& & | & \epsilon & \quad\equiv\quad{} & \mbox{‘\texttt{i32}’} \\ \end{array} $$ @@ -12638,7 +12619,7 @@ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} & {{\mathtt{tagtype}}}_{I} & ::= & (x, {I'}){:}{{\mathtt{typeuse}}}_{I} & \quad\Rightarrow\quad{} & x \\ & {{\mathtt{globaltype}}}_{I} & ::= & t{:}{{\mathtt{valtype}}}_{I} & \quad\Rightarrow\quad{} & t \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{mut}\mbox{’}~~t{:}{{\mathtt{valtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & \mathsf{mut}~t \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{mut}’}~~t{:}{{\mathtt{valtype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & \mathsf{mut}~t \\ & {{\mathtt{memtype}}}_{I} & ::= & {\mathit{at}}{:}{\mathtt{addrtype}}~~{\mathit{lim}}{:}{\mathtt{limits}} & \quad\Rightarrow\quad{} & {\mathit{at}}~{\mathit{lim}}~\mathsf{page} \\ & {{\mathtt{tabletype}}}_{I} & ::= & {\mathit{at}}{:}{\mathtt{addrtype}}~~{\mathit{lim}}{:}{\mathtt{limits}}~~{\mathit{rt}}{:}{{\mathtt{reftype}}}_{I} & \quad\Rightarrow\quad{} & {\mathit{at}}~{\mathit{lim}}~{\mathit{rt}} \\ \end{array} @@ -12648,11 +12629,11 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {{\mathtt{externtype}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{tag}\mbox{’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{jt}}{:}{{\mathtt{tagtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{tag}~{\mathit{jt}}, \{ \mathsf{tags}~({{\mathit{id}}^?}) \}) \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{global}\mbox{’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{gt}}{:}{{\mathtt{globaltype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{global}~{\mathit{gt}}, \{ \mathsf{globals}~({{\mathit{id}}^?}) \}) \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{memory}\mbox{’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{mt}}{:}{{\mathtt{memtype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{mem}~{\mathit{mt}}, \{ \mathsf{mems}~({{\mathit{id}}^?}) \}) \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{table}\mbox{’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{tt}}{:}{{\mathtt{tabletype}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{table}~{\mathit{tt}}, \{ \mathsf{tables}~({{\mathit{id}}^?}) \}) \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{func}\mbox{’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~(x, {I'}){:}{{\mathtt{typeuse}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (\mathsf{func}~x, \{ \mathsf{funcs}~({{\mathit{id}}^?}) \}) \\ +& {{\mathtt{externtype}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{tag}’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{jt}}{:}{{\mathtt{tagtype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{tag}~{\mathit{jt}}, \{ \mathsf{tags}~({{\mathit{id}}^?}) \}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{global}’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{gt}}{:}{{\mathtt{globaltype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{global}~{\mathit{gt}}, \{ \mathsf{globals}~({{\mathit{id}}^?}) \}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{memory}’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{mt}}{:}{{\mathtt{memtype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{mem}~{\mathit{mt}}, \{ \mathsf{mems}~({{\mathit{id}}^?}) \}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{table}’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~{\mathit{tt}}{:}{{\mathtt{tabletype}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{table}~{\mathit{tt}}, \{ \mathsf{tables}~({{\mathit{id}}^?}) \}) \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{func}’}~~{{\mathit{id}}^?}{:}{{\mathtt{id}}^?}~~(x, {I'}){:}{{\mathtt{typeuse}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (\mathsf{func}~x, \{ \mathsf{funcs}~({{\mathit{id}}^?}) \}) \\ \end{array} $$ @@ -12660,29 +12641,31 @@ $$ $$ \begin{array}[t]{@{}lrrl@{}l@{}l@{}l@{}} -& {{\mathtt{typeuse}}}_{I} & ::= & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{type}\mbox{’}~~x{:}{{\mathtt{typeidx}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’} & \quad\Rightarrow\quad{} & (x, {I'}) & \\ +& {{\mathtt{typeuse}}}_{I} & ::= & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{type}’}~~x{:}{{\mathtt{typeidx}}}_{I}~~\mbox{‘\texttt{{)}}’} & \quad\Rightarrow\quad{} & (x, {I'}) & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \quad \begin{array}[t]{@{}l@{}} -\mbox{if}~ I{.}\mathsf{typedefs}{}[x] = \mathsf{sub}~\mathsf{final}~(\mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast}) \\ +\mbox{if}~ I{.}\mathsf{typedefs}{}[x] = (\mathsf{rec}~{{\mathit{st}}^\ast}) {.} i \\ +{\land}~ {{\mathit{st}}^\ast}{}[i] = \mathsf{sub}~\mathsf{final}~(\mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast}) \\ {\land}~ {I'} = \{ \mathsf{locals}~{(\epsilon)^{{|{t_1^\ast}|}}} \} \\ \end{array} } \\ -& & | & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{type}\mbox{’}~~x{:}{{\mathtt{typeidx}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’}~~{(t_1, {{\mathit{id}}^?})^\ast}{:}{{{\mathtt{param}}}_{I}^\ast}~~{t_2^\ast}{:}{{{\mathtt{result}}}_{I}^\ast} & \quad\Rightarrow\quad{} & (x, {I'}) & \\ +& & | & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{type}’}~~x{:}{{\mathtt{typeidx}}}_{I}~~\mbox{‘\texttt{{)}}’}~~{(t_1, {{\mathit{id}}^?})^\ast}{:}{{{\mathtt{param}}}_{I}^\ast}~~{t_2^\ast}{:}{{{\mathtt{result}}}_{I}^\ast} & \quad\Rightarrow\quad{} & (x, {I'}) & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \quad \begin{array}[t]{@{}l@{}} -\mbox{if}~ I{.}\mathsf{typedefs}{}[x] = \mathsf{sub}~\mathsf{final}~(\mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast}) \\ +\mbox{if}~ I{.}\mathsf{typedefs}{}[x] = (\mathsf{rec}~{{\mathit{st}}^\ast}) {.} i \\ +{\land}~ {{\mathit{st}}^\ast}{}[i] = \mathsf{sub}~\mathsf{final}~(\mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast}) \\ {\land}~ {I'} = \{ \mathsf{locals}~{({{\mathit{id}}^?})^\ast} \} \\ {\land}~ {\vdash}\, {I'} : \mathsf{ok} \\ \end{array} } \\ -& & | & {(t_1, {{\mathit{id}}^?})^\ast}{:}{{{\mathtt{param}}}_{I}^\ast}~~{t_2^\ast}{:}{{{\mathtt{result}}}_{I}^\ast} & \quad\equiv\quad{} & \mbox{‘}\mathtt{(}\mbox{’}~~\mbox{‘}\mathtt{type}\mbox{’}~~x{:}{{\mathtt{typeidx}}}_{I}~~\mbox{‘}\mathtt{)}\mbox{’}~~{{{\mathtt{param}}}_{I}^\ast}~~{{{\mathtt{result}}}_{I}^\ast} & \\ +& & | & {(t_1, {{\mathit{id}}^?})^\ast}{:}{{{\mathtt{param}}}_{I}^\ast}~~{t_2^\ast}{:}{{{\mathtt{result}}}_{I}^\ast} & \quad\equiv\quad{} & \mbox{‘\texttt{{(}}’}~~\mbox{‘\texttt{type}’}~~x{:}{{\mathtt{typeidx}}}_{I}~~\mbox{‘\texttt{{)}}’}~~{{{\mathtt{param}}}_{I}^\ast}~~{{{\mathtt{result}}}_{I}^\ast} & \\ &&& \multicolumn{4}{@{}l@{}}{\quad \quad \begin{array}[t]{@{}l@{}} -\mbox{if}~ I{.}\mathsf{typedefs}{}[x] = \mathsf{sub}~\mathsf{final}~(\mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast}) \\ -{\land}~ (I{.}\mathsf{typedefs}{}[i] \neq \mathsf{sub}~\mathsf{final}~(\mathsf{func}~{t_1^\ast} \rightarrow {t_2^\ast}))^{i%`(memarg, addrtype, N) + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec + rule _{n : n, m : m, at : addrtype, N : N}: + `|-%:%->%`({ALIGN `%`_u32(n), OFFSET `%`_u64(m)}, at, N) + -- if (((2 ^ n) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- if (m < (2 ^ $size((at : addrtype <: numtype)))) + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec def $is_packtype(storagetype : storagetype) : bool ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec @@ -3696,242 +3704,242 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) `%|-%:%`(C, ELEM.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) -- if (C.ELEMS_context[x!`%`_idx.0] = rt) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:408.1-410.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:416.1-418.32 rule memory.size{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.SIZE_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:412.1-414.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:420.1-422.32 rule memory.grow{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.GROW_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:416.1-418.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:424.1-426.32 rule memory.fill{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype (at : addrtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:420.1-423.38 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:428.1-431.38 rule memory.copy{C : context, x_1 : idx, x_2 : idx, at_1 : addrtype, at_2 : addrtype, lim_1 : limits, lim_2 : limits}: `%|-%:%`(C, MEMORY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([(at_1 : addrtype <: valtype) (at_2 : addrtype <: valtype) ($minat(at_1, at_2) : addrtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x_1!`%`_idx.0] = `%%PAGE`_memtype(at_1, lim_1)) -- if (C.MEMS_context[x_2!`%`_idx.0] = `%%PAGE`_memtype(at_2, lim_2)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:425.1-428.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:433.1-436.24 rule memory.init{C : context, x : idx, y : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.INIT_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype I32_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:430.1-432.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:438.1-440.24 rule data.drop{C : context, x : idx}: `%|-%:%`(C, DATA.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) -- if (C.DATAS_context[x!`%`_idx.0] = OK_datatype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:443.1-446.43 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:451.1-454.44 rule `load-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, LOAD_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $size(nt)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:448.1-451.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:456.1-459.36 rule `load-pack`{C : context, Inn : Inn, M : M, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(M), sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(Inn : Inn <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, M) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:462.1-465.43 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:470.1-473.44 rule `store-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, STORE_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $size(nt)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:467.1-470.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:475.1-478.36 rule `store-pack`{C : context, Inn : Inn, M : M, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(M))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (Inn : Inn <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, M) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:472.1-475.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:480.1-483.47 rule `vload-val`{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $vsize(V128_vectype)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:477.1-480.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:485.1-488.41 rule `vload-pack`{C : context, M : M, N : N, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), N, sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (((M : nat <:> rat) / (8 : nat <:> rat)) * (N : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, (M * N)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:482.1-485.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:490.1-493.36 rule `vload-splat`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:487.1-490.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:495.1-498.36 rule `vload-zero`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:492.1-496.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:500.1-504.21 rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:498.1-501.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:506.1-509.47 rule vstore{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VSTORE_instr(V128_vectype, x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $vsize(V128_vectype)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:503.1-507.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:511.1-515.21 rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: `%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:512.1-513.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:520.1-521.33 rule const{C : context, nt : numtype, c_nt : num_(nt)}: `%|-%:%`(C, CONST_instr(nt, c_nt), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:515.1-516.34 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:523.1-524.34 rule unop{C : context, nt : numtype, unop_nt : unop_(nt)}: `%|-%:%`(C, UNOP_instr(nt, unop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:518.1-519.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:526.1-527.39 rule binop{C : context, nt : numtype, binop_nt : binop_(nt)}: `%|-%:%`(C, BINOP_instr(nt, binop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:521.1-522.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:529.1-530.39 rule testop{C : context, nt : numtype, testop_nt : testop_(nt)}: `%|-%:%`(C, TESTOP_instr(nt, testop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:524.1-525.40 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:532.1-533.40 rule relop{C : context, nt : numtype, relop_nt : relop_(nt)}: `%|-%:%`(C, RELOP_instr(nt, relop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:527.1-528.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:535.1-536.44 rule cvtop{C : context, nt_1 : numtype, nt_2 : numtype, cvtop : cvtop__(nt_2, nt_1)}: `%|-%:%`(C, CVTOP_instr(nt_1, nt_2, cvtop), `%->_%%`_instrtype(`%`_resulttype([(nt_2 : numtype <: valtype)]), [], `%`_resulttype([(nt_1 : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:533.1-534.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:541.1-542.35 rule vconst{C : context, c : vec_(V128_Vnn)}: `%|-%:%`(C, VCONST_instr(V128_vectype, c), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:536.1-537.41 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:544.1-545.41 rule vvunop{C : context, vvunop : vvunop}: `%|-%:%`(C, VVUNOP_instr(V128_vectype, vvunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:539.1-540.48 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:547.1-548.48 rule vvbinop{C : context, vvbinop : vvbinop}: `%|-%:%`(C, VVBINOP_instr(V128_vectype, vvbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:542.1-543.55 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:550.1-551.55 rule vvternop{C : context, vvternop : vvternop}: `%|-%:%`(C, VVTERNOP_instr(V128_vectype, vvternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:545.1-546.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:553.1-554.44 rule vvtestop{C : context, vvtestop : vvtestop}: `%|-%:%`(C, VVTESTOP_instr(V128_vectype, vvtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:548.1-549.37 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:556.1-557.37 rule vunop{C : context, sh : shape, vunop : vunop_(sh)}: `%|-%:%`(C, VUNOP_instr(sh, vunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:551.1-552.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:559.1-560.44 rule vbinop{C : context, sh : shape, vbinop : vbinop_(sh)}: `%|-%:%`(C, VBINOP_instr(sh, vbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:554.1-555.51 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:562.1-563.51 rule vternop{C : context, sh : shape, vternop : vternop_(sh)}: `%|-%:%`(C, VTERNOP_instr(sh, vternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:557.1-558.40 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:565.1-566.40 rule vtestop{C : context, sh : shape, vtestop : vtestop_(sh)}: `%|-%:%`(C, VTESTOP_instr(sh, vtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:560.1-561.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:568.1-569.44 rule vrelop{C : context, sh : shape, vrelop : vrelop_(sh)}: `%|-%:%`(C, VRELOP_instr(sh, vrelop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:563.1-564.47 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:571.1-572.47 rule vshiftop{C : context, sh : ishape, vshiftop : vshiftop_(sh)}: `%|-%:%`(C, VSHIFTOP_instr(sh, vshiftop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype I32_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:566.1-567.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:574.1-575.33 rule vbitmask{C : context, sh : ishape}: `%|-%:%`(C, VBITMASK_instr(sh), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:569.1-570.50 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:577.1-578.50 rule vswizzlop{C : context, sh : bshape, vswizzlop : vswizzlop_(sh)}: `%|-%:%`(C, VSWIZZLOP_instr(sh, vswizzlop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:572.1-574.29 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:580.1-582.29 rule vshuffle{C : context, sh : bshape, `i*` : laneidx*}: `%|-%:%`(C, VSHUFFLE_instr(sh, i*{i <- `i*`}), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) -- (if (i!`%`_laneidx.0 < (2 * $dim(sh!`%`_bshape.0)!`%`_dim.0)))*{i <- `i*`} - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:576.1-577.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:584.1-585.44 rule vsplat{C : context, sh : shape}: `%|-%:%`(C, VSPLAT_instr(sh), `%->_%%`_instrtype(`%`_resulttype([($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:579.1-581.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:587.1-589.21 rule vextract_lane{C : context, sh : shape, `sx?` : sx?, i : laneidx}: `%|-%:%`(C, VEXTRACT_LANE_instr(sh, sx?{sx <- `sx?`}, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([($unpackshape(sh) : numtype <: valtype)]))) -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:583.1-585.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:591.1-593.21 rule vreplace_lane{C : context, sh : shape, i : laneidx}: `%|-%:%`(C, VREPLACE_LANE_instr(sh, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype ($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:587.1-588.50 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:595.1-596.50 rule vextunop{C : context, sh_1 : ishape, sh_2 : ishape, vextunop : vextunop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTUNOP_instr(sh_1, sh_2, vextunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:590.1-591.57 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:598.1-599.57 rule vextbinop{C : context, sh_1 : ishape, sh_2 : ishape, vextbinop : vextbinop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTBINOP_instr(sh_1, sh_2, vextbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:593.1-594.64 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:601.1-602.64 rule vextternop{C : context, sh_1 : ishape, sh_2 : ishape, vextternop : vextternop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTTERNOP_instr(sh_1, sh_2, vextternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:596.1-597.48 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:604.1-605.48 rule vnarrow{C : context, sh_1 : ishape, sh_2 : ishape, sx : sx}: `%|-%:%`(C, VNARROW_instr(sh_1, sh_2, sx), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:599.1-600.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:607.1-608.46 rule vcvtop{C : context, sh_1 : shape, sh_2 : shape, vcvtop : vcvtop__(sh_2, sh_1)}: `%|-%:%`(C, VCVTOP_instr(sh_1, sh_2, vcvtop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:6.1-6.96 relation Instrs_ok: `%|-%:%`(context, instr*, instrtype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:605.1-606.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:613.1-614.24 rule empty{C : context}: `%|-%:%`(C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:609.1-613.82 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:617.1-621.82 rule seq{C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: `%|-%:%`(C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) -- Instr_ok: `%|-%:%`(C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} -- Instrs_ok: `%|-%:%`($with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:615.1-619.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:623.1-627.33 rule sub{C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: `%|-%:%`(C, instr*{instr <- `instr*`}, it') -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, it) -- Instrtype_sub: `%|-%<:%`(C, it, it') -- Instrtype_ok: `%|-%:OK`(C, it') - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:622.1-625.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:630.1-633.33 rule frame{C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) @@ -5018,20 +5026,6 @@ def $fvternop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N), fN : fN(N)) -- if (c_3*{c_3 <- `c_3*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_3)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Fnn : Fnn <: lanetype)), $f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2, c_3)*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`})) -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : u32*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c!`%`_u32.0*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) - -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : u32*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c!`%`_u32.0*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -5190,11 +5184,6 @@ def $vternop_(shape : shape, vternop_ : vternop_(shape), vec_ : vec_(V128_Vnn), ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vternop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), RELAXED_NMADD_vternop_, v_1, v_2, v_3) = $fvternop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $frelaxed_nmadd_, v_1, v_2, v_3) -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $vtestop_(shape : shape, vtestop_ : vtestop_(shape), vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $vtestop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_, v) = $ivtestop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $inez_, v) - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vrelop_(shape : shape, vrelop_ : vrelop_(shape), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -6203,7 +6192,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule vvtestop{c_1 : vec_(V128_Vnn), c : num_(I32_numtype)}: `%~>%`([VCONST_instr(V128_vectype, c_1) VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop)], [CONST_instr(I32_numtype, c)]) - -- if (c = $ine_($vsize(V128_vectype), c_1, `%`_iN(0))) + -- if (c = $inez_($vsize(V128_vectype), c_1)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vunop-val`{c_1 : vec_(V128_Vnn), sh : shape, vunop : vunop_(sh), c : vec_(V128_Vnn)}: @@ -6236,9 +6225,10 @@ relation Step_pure: `%~>%`(instr*, instr*) -- if ($vternop_(sh, vternop, c_1, c_2, c_3) = []) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec - rule vtestop{c_1 : vec_(V128_Vnn), sh : shape, vtestop : vtestop_(sh), i : num_(I32_numtype)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(sh, vtestop)], [CONST_instr(I32_numtype, i)]) - -- if (i = $vtestop_(sh, vtestop, c_1)) + rule vtestop{c_1 : vec_(V128_Vnn), Jnn : Jnn, M : M, c : num_(I32_numtype), `i*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}: + `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_)], [CONST_instr(I32_numtype, c)]) + -- if (i*{i <- `i*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)) + -- if (c!`%`_num_.0 = $prod($inez_($jsizenn(Jnn), i)!`%`_u32.0*{i <- `i*`})) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule vrelop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : shape, vrelop : vrelop_(sh), c : vec_(V128_Vnn)}: @@ -6525,53 +6515,53 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg, c : num_(nt)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [CONST_instr(nt, c)]) - -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(n), sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg, c : iN(n)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(n), sx)), x, ao)]), [CONST_instr((Inn : Inn <: numtype), $extend__(n, $size((Inn : Inn <: numtype)), sx, c))]) - -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg, c : vec_(V128_Vnn)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg, c : vec_(V128_Vnn), `j*` : iN(M)*, `k*` : nat*, Jnn : Jnn}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- (if ($ibytes_(M, j) = $mem(z, x).BYTES_meminst[((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((k * M) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-splat-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N), Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $inv_lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) @@ -6579,23 +6569,23 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-zero-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-zero-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (c = $extend__(N, 128, U_sx, j)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, c : vec_(V128_Vnn), k : iN(N), Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $inv_lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) @@ -6939,41 +6929,41 @@ relation Step: `%~>%`(config, config) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:494.1-497.60 rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:499.1-503.29 rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $nbytes_(nt, c)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:505.1-508.52 rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:510.1-514.52 rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:516.1-519.63 rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:521.1-524.31 rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:527.1-530.50 rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + N) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:532.1-537.49 rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) @@ -7621,7 +7611,7 @@ grammar Bblocktype : blocktype ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec prod{t : valtype} t:Bvaltype => _RESULT_blocktype(?(t)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_funcidx((i!`%`_s33.0 : int <:> nat))) + prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_typeidx((i!`%`_s33.0 : int <:> nat))) -- if (i!`%`_s33.0 >= (0 : nat <:> int)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec @@ -7641,10 +7631,10 @@ syntax memidxop = (memidx, memarg) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec grammar Bmemarg : memidxop ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{n : n, m : m} {{`%`_u32(n):Bu32} {`%`_u32(m):Bu32}} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u32(m)}) + prod{n : n, m : m} {{`%`_u32(n):Bu32} {`%`_u64(m):Bu64}} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u64(m)}) -- if (n < (2 ^ 6)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{n : n, x : idx, m : m} {{`%`_u32(n):Bu32} {x:Bmemidx} {`%`_u32(m):Bu32}} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u32(m)}) + prod{n : n, x : idx, m : m} {{`%`_u32(n):Bu32} {x:Bmemidx} {`%`_u64(m):Bu64}} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u64(m)}) -- if (((2 ^ 6) <= n) /\ (n < (2 ^ 7))) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec @@ -9369,7 +9359,7 @@ syntax idctxt = LOCALS{`name?*` : name?*} name?*, LABELS{`name?*` : name?*} name?*, FIELDS{`name?**` : name?**} name?**, - TYPEDEFS{`subtype?*` : subtype?*} subtype?* + TYPEDEFS{`deftype?*` : deftype?*} deftype?* } ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec @@ -9378,7 +9368,7 @@ syntax I = idctxt ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec rec { -;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:155.1-155.57 +;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:155.1-155.56 def $concat_idctxt(idctxt*) : idctxt ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:156.1-156.29 def $concat_idctxt([]) = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []} @@ -9631,12 +9621,14 @@ grammar Tlimits : limits ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec grammar Ttypeuse_(I : I) : (typeidx, idctxt) ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec - prod{x : idx, I' : I, `t_1*` : valtype*, `t_2*` : valtype*} {{"("} {"type"} {x:Ttypeidx_(I)} {")"}} => (x, I') - -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))))) + prod{x : idx, I' : I, `st*` : subtype*, i : n, `t_1*` : valtype*, `t_2*` : valtype*} {{"("} {"type"} {x:Ttypeidx_(I)} {")"}} => (x, I') + -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(_DEF_deftype(REC_rectype(`%`_list(st*{st <- `st*`})), i))) + -- if (st*{st <- `st*`}[i] = SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) -- if (I' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS ?(`%`_name([]))^|t_1*{t_1 <- `t_1*`}|{}, LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec - prod{x : idx, `t_1*` : valtype*, `id?*` : char?*, `t_2*` : valtype*, I' : I} {{"("} {"type"} {x:Ttypeidx_(I)} {")"} {(t_1, ?(`%`_name(lift(id?{id <- `id?`}))))*{`id?` <- `id?*`, t_1 <- `t_1*`}:Tparam_(I)*{}} {t_2*{t_2 <- `t_2*`}:Tresult_(I)*{}}} => (x, I') - -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))))) + prod{x : idx, `t_1*` : valtype*, `id?*` : char?*, `t_2*` : valtype*, I' : I, `st*` : subtype*, i : n} {{"("} {"type"} {x:Ttypeidx_(I)} {")"} {(t_1, ?(`%`_name(lift(id?{id <- `id?`}))))*{`id?` <- `id?*`, t_1 <- `t_1*`}:Tparam_(I)*{}} {t_2*{t_2 <- `t_2*`}:Tresult_(I)*{}}} => (x, I') + -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(_DEF_deftype(REC_rectype(`%`_list(st*{st <- `st*`})), i))) + -- if (st*{st <- `st*`}[i] = SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) -- if (I' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS ?(`%`_name(lift(id?{id <- `id?`})))*{`id?` <- `id?*`}, LABELS [], FIELDS [], TYPEDEFS []}) -- Idctxt_ok: `|-%:OK`(I') @@ -9705,6 +9697,9 @@ grammar Tcatch_(I : I) : catch ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{l : labelidx} {{"("} {"catch_all_ref"} {l:Tlabelidx_(I)} {")"}} => CATCH_ALL_REF_catch(l) +;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec +grammar Tfoldedinstr_(I : I) : instr* + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tlaneidx : laneidx ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -9715,16 +9710,20 @@ grammar Talign_(N : N) : u64 ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{m : m, n : n} {{"align="} {`%`_u64(m):Tu64}} => `%`_u64(m) -- if (m = (2 ^ n)) + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec + prod eps => `%`_u64(N) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Toffset : u64 ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{n : n} {{"offset="} {`%`_u64(n):Tu64}} => `%`_u64(n) + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec + prod eps => `%`_u64(0) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tmemarg_(N : N) : memarg ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{n : n, m : m} {{`%`_u64(n):Toffset} {`%`_u64(m):Talign_(N)}} => {ALIGN `%`_u32(n), OFFSET `%`_u32(m)} + prod{n : n, m : m} {{`%`_u64(n):Toffset} {`%`_u64(m):Talign_(N)}} => {ALIGN `%`_u32(n), OFFSET `%`_u64(m)} ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tplaininstr_(I : I) : instr @@ -9735,7 +9734,7 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "drop" => DROP_instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{`t?` : valtype?} {{"select"} {t?{t <- `t?`}:Tresult_(I)?{}}} => SELECT_instr(?(lift(t?{t <- `t?`}))) + prod{`t*?` : valtype*?} {{"select"} {t*{t <- `t*`}:Tresult_(I)*{}?{`t*` <- `t*?`}}} => SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`}) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{l : labelidx} {{"br"} {l:Tlabelidx_(I)}} => BR_instr(l) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -10273,33 +10272,33 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "f64x2.splat" => VSPLAT_instr(`%X%`_shape(F64_lanetype, `%`_dim(2))) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.extract_lane_s"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.extract_lane_s"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.extract_lane_u"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.extract_lane_u"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.extract_lane_s"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.extract_lane_s"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.extract_lane_u"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.extract_lane_u"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i32x4.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i32x4.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i64x2.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i64x2.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f32x4.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f32x4.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f64x2.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f64x2.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i32x4.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i32x4.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i64x2.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i64x2.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f32x4.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f32x4.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f64x2.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f64x2.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "v128.any_true" => VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -10734,31 +10733,18 @@ grammar Tinstrs_(I : I) : instr* ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:24.5-24.52 prod{`in**` : instr**} in*{in <- `in*`}*{`in*` <- `in**`}:Tfoldedinstr_(I)*{} => $concat_(syntax instr, in*{in <- `in*`}*{`in*` <- `in**`}) -;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:31.1-41.24 -grammar Tfoldedinstr_(I : I) : instr* - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:28.5-28.59 - prod{in : instr, `in'*` : instr*} {{"("} {in:Tplaininstr_(I)} {in'*{in' <- `in'*`}:Tinstrs_(I)} {")"}} => in'*{in' <- `in'*`} ++ [in] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:32.5-33.17 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*} {{"("} {"block"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [BLOCK_instr(bt, in*{in <- `in*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:34.5-35.16 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*} {{"("} {"loop"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [LOOP_instr(bt, in*{in <- `in*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:36.5-39.33 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `in_1*` : instr*, `in_2*` : instr*} {{"("} {"if"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"("} {"then"} {in_1*{in_1 <- `in_1*`}:Tinstrs_(I')} {")"} {{{"("} {"else"} {in_2*{in_2 <- `in_2*`}:Tinstrs_(I')} {")"}}?{}} {")"}} => in*{in <- `in*`} ++ [`IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:40.5-41.24 - prod{`id?` : char?, I' : I, bt : blocktype, `c*` : catch*, `in*` : instr*} {{"("} {"try_table"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {c*{c <- `c*`}:Tcatch_(I)*{}} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`})] - -;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:75.1-77.65 +;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:88.1-90.65 grammar Tblockinstr_(I : I) : instr - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:61.5-63.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:63.5-67.35 prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `id'?` : char?} {{"block"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => BLOCK_instr(bt, in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:64.5-66.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:68.5-72.35 prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `id'?` : char?} {{"loop"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => LOOP_instr(bt, in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:67.5-69.71 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:73.5-79.71 prod{`id?` : char?, I' : I, bt : blocktype, `in_1*` : instr*, `id_1?` : char?, `in_2*` : instr*, `id_2?` : char?} {{"if"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in_1*{in_1 <- `in_1*`}:Tinstrs_(I')} {"else"} {?(`%`_name(lift(id_1?{id_1 <- `id_1?`}))):Tid?{}} {in_2*{in_2 <- `in_2*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id_2?{id_2 <- `id_2?`}))):Tid?{}}} => `IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`}) -- if (((id_1?{id_1 <- `id_1?`} = ?()) \/ (id_1?{id_1 <- `id_1?`} = id?{id <- `id?`})) /\ ((id_2?{id_2 <- `id_2?`} = ?()) \/ (id_2?{id_2 <- `id_2?`} = id?{id <- `id?`}))) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:70.5-72.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:80.5-85.35 prod{`id?` : char?, I' : I, bt : blocktype, `c*` : catch*, `in*` : instr*, `id'?` : char?} {{"try_table"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {c*{c <- `c*`}:Tcatch_(I)*{}} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) } @@ -10771,9 +10757,9 @@ grammar Texpr_(I : I) : expr ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Ttype_(I : I) : (type, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{qt : rectype, I' : I, I'' : I, st : subtype, n : n} (qt, I'):Trectype_(I) => (TYPE_type(qt), I' +++ I'') - -- if (qt = REC_rectype(`%`_list(st^n{}))) - -- if (((n = 1) /\ (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS [?(st)]})) \/ ((n =/= 1) /\ (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS ?()^n{}}))) + prod{qt : rectype, I' : I, I'' : I, `st*` : subtype*, n : n, `i*` : nat*} (qt, I'):Trectype_(I) => (TYPE_type(qt), I' +++ I'') + -- if (qt = REC_rectype(`%`_list(st^n{st <- `st*`}))) + -- if (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS ?(_DEF_deftype(qt, i))^(i x - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod eps => `%`_memidx(0) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Toffset_(I : I) : expr @@ -10829,7 +10813,7 @@ grammar Tdata_(I : I) : (data, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, `b*` : byte*} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {b*{b <- `b*`}:Tdatastring} {")"}} => (DATA_data(b*{b <- `b*`}, PASSIVE_datamode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{`id?` : char?, `b*` : byte*, x : idx, e : expr} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {b*{b <- `b*`}:Tdatastring} {x:Tmemuse_(I)} {e:Toffset_(I)} {")"}} => (DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) + prod{`id?` : char?, x : idx, e : expr, `b*` : byte*} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {x:Tmemuse_(I)} {e:Toffset_(I)} {b*{b <- `b*`}:Tdatastring} {")"}} => (DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telemlist_(I : I) : (reftype, expr*) @@ -10840,15 +10824,13 @@ grammar Telemlist_(I : I) : (reftype, expr*) grammar Ttableuse_(I : I) : tableidx ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{x : idx} {{"("} {"table"} {x:Ttableidx_(I)} {")"}} => x - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod eps => `%`_tableidx(0) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telem_(I : I) : (elem, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{`id?` : char?, rt : reftype, `e*` : expr*, x : idx, e' : expr} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {(rt, e*{e <- `e*`}):Telemlist_(I)} {x:Ttableuse_(I)} {e':Toffset_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, ACTIVE_elemmode(x, e')), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) + prod{`id?` : char?, x : idx, e' : expr, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {x:Ttableuse_(I)} {e':Toffset_(I)} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, ACTIVE_elemmode(x, e')), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {"declare"} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) @@ -10882,6 +10864,9 @@ grammar Timportdots : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`` : ()} ``:{{"("} {"import"} {Tname} {Tname} {")"}} => (``, ()).1 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec +def $dots : () + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Texporttagdots_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec @@ -10897,7 +10882,7 @@ grammar Texportglobaldots_(I : I) : () prod{`` : ()} ``:{{Texportdots*{}} Timportdots {Tglobaltype_(I)}} => (``, ()).1 ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Texportmemorydots_(I : I) : () +grammar Texportmemdots_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`` : ()} ``:{{Texportdots*{}} {Tmemtype_(I)}} => (``, ()).1 ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec @@ -10928,7 +10913,7 @@ grammar Texporttag_(I : I) : () grammar Texportglobal_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Texportmemory_(I : I) : () +grammar Texportmem_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Texporttable_(I : I) : () @@ -10937,7 +10922,7 @@ grammar Texporttable_(I : I) : () grammar Texportfunc_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Tdatamemory_(I : I) : () +grammar Tdatamem_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telemtable_(I : I) : () @@ -10959,13 +10944,13 @@ syntax decl = ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:226.1-226.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:258.1-258.76 def $typesd(decl*) : type* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:238.1-238.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:270.1-270.23 def $typesd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:239.1-239.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:271.1-271.48 def $typesd{type : type, `decl'*` : decl*}([(type : type <: decl)] ++ decl'*{decl' <- `decl'*`}) = [type] ++ $typesd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:240.1-240.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:272.1-272.57 def $typesd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $typesd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -10973,13 +10958,13 @@ def $typesd(decl*) : type* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:227.1-227.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:259.1-259.78 def $importsd(decl*) : import* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:242.1-242.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:274.1-274.25 def $importsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:243.1-243.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:275.1-275.56 def $importsd{import : import, `decl'*` : decl*}([(import : import <: decl)] ++ decl'*{decl' <- `decl'*`}) = [import] ++ $importsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:244.1-244.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:276.1-276.61 def $importsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $importsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -10987,13 +10972,13 @@ def $importsd(decl*) : import* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:228.1-228.75 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:260.1-260.75 def $tagsd(decl*) : tag* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:246.1-246.22 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:278.1-278.22 def $tagsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:247.1-247.44 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:279.1-279.44 def $tagsd{tag : tag, `decl'*` : decl*}([(tag : tag <: decl)] ++ decl'*{decl' <- `decl'*`}) = [tag] ++ $tagsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:248.1-248.55 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:280.1-280.55 def $tagsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $tagsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11001,13 +10986,13 @@ def $tagsd(decl*) : tag* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:229.1-229.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:261.1-261.78 def $globalsd(decl*) : global* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:250.1-250.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:282.1-282.25 def $globalsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:251.1-251.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:283.1-283.56 def $globalsd{global : global, `decl'*` : decl*}([(global : global <: decl)] ++ decl'*{decl' <- `decl'*`}) = [global] ++ $globalsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:252.1-252.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:284.1-284.61 def $globalsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $globalsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11015,13 +11000,13 @@ def $globalsd(decl*) : global* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:230.1-230.75 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:262.1-262.75 def $memsd(decl*) : mem* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:254.1-254.22 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:286.1-286.22 def $memsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:255.1-255.44 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:287.1-287.44 def $memsd{mem : mem, `decl'*` : decl*}([(mem : mem <: decl)] ++ decl'*{decl' <- `decl'*`}) = [mem] ++ $memsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:256.1-256.55 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:288.1-288.55 def $memsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $memsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11029,13 +11014,13 @@ def $memsd(decl*) : mem* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:231.1-231.77 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:263.1-263.77 def $tablesd(decl*) : table* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:258.1-258.24 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:290.1-290.24 def $tablesd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:259.1-259.52 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:291.1-291.52 def $tablesd{table : table, `decl'*` : decl*}([(table : table <: decl)] ++ decl'*{decl' <- `decl'*`}) = [table] ++ $tablesd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:260.1-260.59 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:292.1-292.59 def $tablesd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $tablesd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11043,13 +11028,13 @@ def $tablesd(decl*) : table* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:232.1-232.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:264.1-264.76 def $funcsd(decl*) : func* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:262.1-262.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:294.1-294.23 def $funcsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:263.1-263.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:295.1-295.48 def $funcsd{func : func, `decl'*` : decl*}([(func : func <: decl)] ++ decl'*{decl' <- `decl'*`}) = [func] ++ $funcsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:264.1-264.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:296.1-296.57 def $funcsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $funcsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11057,13 +11042,13 @@ def $funcsd(decl*) : func* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:233.1-233.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:265.1-265.76 def $datasd(decl*) : data* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:266.1-266.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:298.1-298.23 def $datasd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:267.1-267.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:299.1-299.48 def $datasd{data : data, `decl'*` : decl*}([(data : data <: decl)] ++ decl'*{decl' <- `decl'*`}) = [data] ++ $datasd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:268.1-268.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:300.1-300.57 def $datasd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $datasd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11071,13 +11056,13 @@ def $datasd(decl*) : data* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:234.1-234.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:266.1-266.76 def $elemsd(decl*) : elem* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:270.1-270.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:302.1-302.23 def $elemsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:271.1-271.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:303.1-303.48 def $elemsd{elem : elem, `decl'*` : decl*}([(elem : elem <: decl)] ++ decl'*{decl' <- `decl'*`}) = [elem] ++ $elemsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:272.1-272.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:304.1-304.57 def $elemsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $elemsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11085,13 +11070,13 @@ def $elemsd(decl*) : elem* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:235.1-235.77 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:267.1-267.77 def $startsd(decl*) : start* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:274.1-274.24 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:306.1-306.24 def $startsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:275.1-275.52 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:307.1-307.52 def $startsd{start : start, `decl'*` : decl*}([(start : start <: decl)] ++ decl'*{decl' <- `decl'*`}) = [start] ++ $startsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:276.1-276.59 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:308.1-308.59 def $startsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $startsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11099,13 +11084,13 @@ def $startsd(decl*) : start* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:236.1-236.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:268.1-268.78 def $exportsd(decl*) : export* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:278.1-278.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:310.1-310.25 def $exportsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:279.1-279.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:311.1-311.56 def $exportsd{export : export, `decl'*` : decl*}([(export : export <: decl)] ++ decl'*{decl' <- `decl'*`}) = [export] ++ $exportsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:280.1-280.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:312.1-312.61 def $exportsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $exportsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -11113,9 +11098,8 @@ def $exportsd(decl*) : export* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec def $ordered(decl*) : bool ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - def $ordered([]) = true - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - def $ordered{`decl'*` : decl*}(decl'*{decl' <- `decl'*`}) = ($importsd(decl'*{decl' <- `decl'*`}) = []) + def $ordered{`decl'*` : decl*}(decl'*{decl' <- `decl'*`}) = true + -- if ($importsd(decl'*{decl' <- `decl'*`}) = []) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec def $ordered{`decl_1*` : decl*, import : import, `decl_2*` : decl*}(decl_1*{decl_1 <- `decl_1*`} ++ [(import : import <: decl)] ++ decl_2*{decl_2 <- `decl_2*`}) = (((((($importsd(decl_1*{decl_1 <- `decl_1*`}) = []) /\ ($tagsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($globalsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($memsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($tablesd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($funcsd(decl_1*{decl_1 <- `decl_1*`}) = [])) @@ -11163,6 +11147,11 @@ grammar Tmodule : module -- if (export*{export <- `export*`} = $exportsd(decl*{decl <- `decl*`})) -- if $ordered(decl*{decl <- `decl*`}) +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec +grammar Tdecldots_(I : I) : (decl, idctxt)* + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec + prod{`` : (decl, idctxt)} [``]:Tdecl_(I)*{} => [``] + ;; ../../../../specification/wasm-3.0/X.1-notation.syntax.spectec syntax A = nat @@ -13252,7 +13241,7 @@ syntax vcvtop__(shape_1 : shape, shape_2 : shape) syntax memarg = { ALIGN{u32 : u32} u32, - OFFSET{u32 : u32} u32 + OFFSET{u64 : u64} u64 } ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec @@ -13276,7 +13265,7 @@ syntax vloadop_{vectype : vectype}(vectype) = ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec syntax blocktype = | _RESULT{`valtype?` : valtype?}(valtype?{valtype <- `valtype?`} : valtype?) - | _IDX{funcidx : funcidx}(funcidx : funcidx) + | _IDX{typeidx : typeidx}(typeidx : typeidx) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec syntax addr = nat @@ -13515,7 +13504,7 @@ syntax expr = instr* ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $memarg0 : memarg ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec - def $memarg0 = {ALIGN `%`_u32(0), OFFSET `%`_u32(0)} + def $memarg0 = {ALIGN `%`_u32(0), OFFSET `%`_u64(0)} ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $const(consttype : consttype, lit_ : lit_((consttype : consttype <: storagetype))) : instr @@ -13534,7 +13523,7 @@ def $free_blocktype(blocktype : blocktype) : free ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $free_blocktype{`valtype?` : valtype?}(_RESULT_blocktype(valtype?{valtype <- `valtype?`})) = $free_opt($free_valtype(valtype)?{valtype <- `valtype?`}) ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec - def $free_blocktype{funcidx : funcidx}(_IDX_blocktype(funcidx)) = $free_funcidx(funcidx) + def $free_blocktype{typeidx : typeidx}(_IDX_blocktype(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec rec { @@ -14649,6 +14638,14 @@ relation Defaultable: `|-%DEFAULTABLE`(valtype) `|-%DEFAULTABLE`(t) -- if ($default_(t) =/= ?()) +;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec +relation Memarg_ok: `|-%:%->%`(memarg, addrtype, N) + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec + rule _{n : n, m : m, at : addrtype, N : N}: + `|-%:%->%`({ALIGN `%`_u32(n), OFFSET `%`_u64(m)}, at, N) + -- if (((2 ^ n) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- if (m < (2 ^ $size((at : addrtype <: numtype)))) + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec def $is_packtype(storagetype : storagetype) : bool ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec @@ -15037,242 +15034,242 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) `%|-%:%`(C, ELEM.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) -- if (C.ELEMS_context[x!`%`_idx.0] = rt) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:408.1-410.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:416.1-418.32 rule memory.size{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.SIZE_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:412.1-414.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:420.1-422.32 rule memory.grow{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.GROW_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:416.1-418.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:424.1-426.32 rule memory.fill{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype (at : addrtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:420.1-423.38 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:428.1-431.38 rule memory.copy{C : context, x_1 : idx, x_2 : idx, at_1 : addrtype, at_2 : addrtype, lim_1 : limits, lim_2 : limits}: `%|-%:%`(C, MEMORY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([(at_1 : addrtype <: valtype) (at_2 : addrtype <: valtype) ($minat(at_1, at_2) : addrtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x_1!`%`_idx.0] = `%%PAGE`_memtype(at_1, lim_1)) -- if (C.MEMS_context[x_2!`%`_idx.0] = `%%PAGE`_memtype(at_2, lim_2)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:425.1-428.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:433.1-436.24 rule memory.init{C : context, x : idx, y : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.INIT_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype I32_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:430.1-432.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:438.1-440.24 rule data.drop{C : context, x : idx}: `%|-%:%`(C, DATA.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) -- if (C.DATAS_context[x!`%`_idx.0] = OK_datatype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:443.1-446.43 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:451.1-454.44 rule `load-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, LOAD_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $size(nt)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:448.1-451.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:456.1-459.36 rule `load-pack`{C : context, Inn : Inn, M : M, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(M), sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(Inn : Inn <: valtype)]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, M) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:462.1-465.43 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:470.1-473.44 rule `store-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, STORE_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $size(nt)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:467.1-470.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:475.1-478.36 rule `store-pack`{C : context, Inn : Inn, M : M, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(M))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (Inn : Inn <: valtype)]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, M) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:472.1-475.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:480.1-483.47 rule `vload-val`{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $vsize(V128_vectype)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:477.1-480.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:485.1-488.41 rule `vload-pack`{C : context, M : M, N : N, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), N, sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (((M : nat <:> rat) / (8 : nat <:> rat)) * (N : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, (M * N)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:482.1-485.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:490.1-493.36 rule `vload-splat`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:487.1-490.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:495.1-498.36 rule `vload-zero`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:492.1-496.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:500.1-504.21 rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([V128_valtype]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:498.1-501.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:506.1-509.47 rule vstore{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VSTORE_instr(V128_vectype, x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $vsize(V128_vectype)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:503.1-507.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:511.1-515.21 rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: `%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:512.1-513.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:520.1-521.33 rule const{C : context, nt : numtype, c_nt : num_(nt)}: `%|-%:%`(C, CONST_instr(nt, c_nt), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:515.1-516.34 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:523.1-524.34 rule unop{C : context, nt : numtype, unop_nt : unop_(nt)}: `%|-%:%`(C, UNOP_instr(nt, unop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:518.1-519.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:526.1-527.39 rule binop{C : context, nt : numtype, binop_nt : binop_(nt)}: `%|-%:%`(C, BINOP_instr(nt, binop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:521.1-522.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:529.1-530.39 rule testop{C : context, nt : numtype, testop_nt : testop_(nt)}: `%|-%:%`(C, TESTOP_instr(nt, testop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:524.1-525.40 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:532.1-533.40 rule relop{C : context, nt : numtype, relop_nt : relop_(nt)}: `%|-%:%`(C, RELOP_instr(nt, relop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:527.1-528.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:535.1-536.44 rule cvtop{C : context, nt_1 : numtype, nt_2 : numtype, cvtop : cvtop__(nt_2, nt_1)}: `%|-%:%`(C, CVTOP_instr(nt_1, nt_2, cvtop), `%->_%%`_instrtype(`%`_resulttype([(nt_2 : numtype <: valtype)]), [], `%`_resulttype([(nt_1 : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:533.1-534.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:541.1-542.35 rule vconst{C : context, c : vec_(V128_Vnn)}: `%|-%:%`(C, VCONST_instr(V128_vectype, c), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:536.1-537.41 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:544.1-545.41 rule vvunop{C : context, vvunop : vvunop}: `%|-%:%`(C, VVUNOP_instr(V128_vectype, vvunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:539.1-540.48 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:547.1-548.48 rule vvbinop{C : context, vvbinop : vvbinop}: `%|-%:%`(C, VVBINOP_instr(V128_vectype, vvbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:542.1-543.55 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:550.1-551.55 rule vvternop{C : context, vvternop : vvternop}: `%|-%:%`(C, VVTERNOP_instr(V128_vectype, vvternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:545.1-546.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:553.1-554.44 rule vvtestop{C : context, vvtestop : vvtestop}: `%|-%:%`(C, VVTESTOP_instr(V128_vectype, vvtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:548.1-549.37 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:556.1-557.37 rule vunop{C : context, sh : shape, vunop : vunop_(sh)}: `%|-%:%`(C, VUNOP_instr(sh, vunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:551.1-552.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:559.1-560.44 rule vbinop{C : context, sh : shape, vbinop : vbinop_(sh)}: `%|-%:%`(C, VBINOP_instr(sh, vbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:554.1-555.51 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:562.1-563.51 rule vternop{C : context, sh : shape, vternop : vternop_(sh)}: `%|-%:%`(C, VTERNOP_instr(sh, vternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:557.1-558.40 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:565.1-566.40 rule vtestop{C : context, sh : shape, vtestop : vtestop_(sh)}: `%|-%:%`(C, VTESTOP_instr(sh, vtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:560.1-561.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:568.1-569.44 rule vrelop{C : context, sh : shape, vrelop : vrelop_(sh)}: `%|-%:%`(C, VRELOP_instr(sh, vrelop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:563.1-564.47 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:571.1-572.47 rule vshiftop{C : context, sh : ishape, vshiftop : vshiftop_(sh)}: `%|-%:%`(C, VSHIFTOP_instr(sh, vshiftop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype I32_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:566.1-567.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:574.1-575.33 rule vbitmask{C : context, sh : ishape}: `%|-%:%`(C, VBITMASK_instr(sh), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:569.1-570.50 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:577.1-578.50 rule vswizzlop{C : context, sh : bshape, vswizzlop : vswizzlop_(sh)}: `%|-%:%`(C, VSWIZZLOP_instr(sh, vswizzlop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:572.1-574.29 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:580.1-582.29 rule vshuffle{C : context, sh : bshape, `i*` : laneidx*}: `%|-%:%`(C, VSHUFFLE_instr(sh, i*{i <- `i*`}), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) -- (if (i!`%`_laneidx.0 < (2 * $dim(sh!`%`_bshape.0)!`%`_dim.0)))*{i <- `i*`} - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:576.1-577.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:584.1-585.44 rule vsplat{C : context, sh : shape}: `%|-%:%`(C, VSPLAT_instr(sh), `%->_%%`_instrtype(`%`_resulttype([($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:579.1-581.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:587.1-589.21 rule vextract_lane{C : context, sh : shape, `sx?` : sx?, i : laneidx}: `%|-%:%`(C, VEXTRACT_LANE_instr(sh, sx?{sx <- `sx?`}, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([($unpackshape(sh) : numtype <: valtype)]))) -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:583.1-585.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:591.1-593.21 rule vreplace_lane{C : context, sh : shape, i : laneidx}: `%|-%:%`(C, VREPLACE_LANE_instr(sh, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype ($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:587.1-588.50 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:595.1-596.50 rule vextunop{C : context, sh_1 : ishape, sh_2 : ishape, vextunop : vextunop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTUNOP_instr(sh_1, sh_2, vextunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:590.1-591.57 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:598.1-599.57 rule vextbinop{C : context, sh_1 : ishape, sh_2 : ishape, vextbinop : vextbinop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTBINOP_instr(sh_1, sh_2, vextbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:593.1-594.64 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:601.1-602.64 rule vextternop{C : context, sh_1 : ishape, sh_2 : ishape, vextternop : vextternop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTTERNOP_instr(sh_1, sh_2, vextternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:596.1-597.48 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:604.1-605.48 rule vnarrow{C : context, sh_1 : ishape, sh_2 : ishape, sx : sx}: `%|-%:%`(C, VNARROW_instr(sh_1, sh_2, sx), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:599.1-600.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:607.1-608.46 rule vcvtop{C : context, sh_1 : shape, sh_2 : shape, vcvtop : vcvtop__(sh_2, sh_1)}: `%|-%:%`(C, VCVTOP_instr(sh_1, sh_2, vcvtop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:6.1-6.96 relation Instrs_ok: `%|-%:%`(context, instr*, instrtype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:605.1-606.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:613.1-614.24 rule empty{C : context}: `%|-%:%`(C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:609.1-613.82 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:617.1-621.82 rule seq{C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: `%|-%:%`(C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) -- Instr_ok: `%|-%:%`(C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} -- Instrs_ok: `%|-%:%`($with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:615.1-619.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:623.1-627.33 rule sub{C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: `%|-%:%`(C, instr*{instr <- `instr*`}, it') -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, it) -- Instrtype_sub: `%|-%<:%`(C, it, it') -- Instrtype_ok: `%|-%:OK`(C, it') - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:622.1-625.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:630.1-633.33 rule frame{C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) @@ -16359,20 +16356,6 @@ def $fvternop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N), fN : fN(N)) -- if (c_3*{c_3 <- `c_3*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_3)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Fnn : Fnn <: lanetype)), $f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2, c_3)*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`})) -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : u32*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c!`%`_u32.0*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) - -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : u32*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c!`%`_u32.0*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -16531,11 +16514,6 @@ def $vternop_(shape : shape, vternop_ : vternop_(shape), vec_ : vec_(V128_Vnn), ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vternop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), RELAXED_NMADD_vternop_, v_1, v_2, v_3) = $fvternop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $frelaxed_nmadd_, v_1, v_2, v_3) -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $vtestop_(shape : shape, vtestop_ : vtestop_(shape), vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $vtestop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_, v) = $ivtestop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $inez_, v) - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vrelop_(shape : shape, vrelop_ : vrelop_(shape), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -17546,7 +17524,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule vvtestop{c_1 : vec_(V128_Vnn), c : num_(I32_numtype)}: `%~>%`([VCONST_instr(V128_vectype, c_1) VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop)], [CONST_instr(I32_numtype, c)]) - -- if (c = $ine_($vsize(V128_vectype), c_1, `%`_iN(0))) + -- if (c = $inez_($vsize(V128_vectype), c_1)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vunop-val`{c_1 : vec_(V128_Vnn), sh : shape, vunop : vunop_(sh), c : vec_(V128_Vnn)}: @@ -17579,9 +17557,10 @@ relation Step_pure: `%~>%`(instr*, instr*) -- if ($vternop_(sh, vternop, c_1, c_2, c_3) = []) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec - rule vtestop{c_1 : vec_(V128_Vnn), sh : shape, vtestop : vtestop_(sh), i : num_(I32_numtype)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(sh, vtestop)], [CONST_instr(I32_numtype, i)]) - -- if (i = $vtestop_(sh, vtestop, c_1)) + rule vtestop{c_1 : vec_(V128_Vnn), Jnn : Jnn, M : M, c : num_(I32_numtype), `i*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}: + `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_)], [CONST_instr(I32_numtype, c)]) + -- if (i*{i <- `i*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)) + -- if (c!`%`_num_.0 = $prod($inez_($jsizenn(Jnn), i)!`%`_u32.0*{i <- `i*`})) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule vrelop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : shape, vrelop : vrelop_(sh), c : vec_(V128_Vnn)}: @@ -17868,53 +17847,53 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg, c : num_(nt)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [CONST_instr(nt, c)]) - -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(n), sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg, c : iN(n)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(n), sx)), x, ao)]), [CONST_instr((Inn : Inn <: numtype), $extend__(n, $size((Inn : Inn <: numtype)), sx, c))]) - -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg, c : vec_(V128_Vnn)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg, c : vec_(V128_Vnn), `j*` : iN(M)*, `k*` : nat*, Jnn : Jnn}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- (if ($ibytes_(M, j) = $mem(z, x).BYTES_meminst[((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((k * M) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-splat-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N), Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $inv_lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) @@ -17922,23 +17901,23 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-zero-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-zero-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (c = $extend__(N, 128, U_sx, j)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, c : vec_(V128_Vnn), k : iN(N), Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $inv_lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) @@ -18282,41 +18261,41 @@ relation Step: `%~>%`(config, config) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:494.1-497.60 rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:499.1-503.29 rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $nbytes_(nt, c)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:505.1-508.52 rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:510.1-514.52 rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:516.1-519.63 rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:521.1-524.31 rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:527.1-530.50 rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + N) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:532.1-537.49 rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (b*{b <- `b*`} = $ibytes_(N, `%`_iN($lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)[j!`%`_laneidx.0]!`%`_lane_.0))) @@ -18964,7 +18943,7 @@ grammar Bblocktype : blocktype ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec prod{t : valtype} t:Bvaltype => _RESULT_blocktype(?(t)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_funcidx((i!`%`_s33.0 : int <:> nat))) + prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_typeidx((i!`%`_s33.0 : int <:> nat))) -- if (i!`%`_s33.0 >= (0 : nat <:> int)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec @@ -18984,10 +18963,10 @@ syntax memidxop = (memidx, memarg) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec grammar Bmemarg : memidxop ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{n : n, m : m} {{`%`_u32(n):Bu32} {`%`_u32(m):Bu32}} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u32(m)}) + prod{n : n, m : m} {{`%`_u32(n):Bu32} {`%`_u64(m):Bu64}} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u64(m)}) -- if (n < (2 ^ 6)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{n : n, x : idx, m : m} {{`%`_u32(n):Bu32} {x:Bmemidx} {`%`_u32(m):Bu32}} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u32(m)}) + prod{n : n, x : idx, m : m} {{`%`_u32(n):Bu32} {x:Bmemidx} {`%`_u64(m):Bu64}} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u64(m)}) -- if (((2 ^ 6) <= n) /\ (n < (2 ^ 7))) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec @@ -20712,7 +20691,7 @@ syntax idctxt = LOCALS{`name?*` : name?*} name?*, LABELS{`name?*` : name?*} name?*, FIELDS{`name?**` : name?**} name?**, - TYPEDEFS{`subtype?*` : subtype?*} subtype?* + TYPEDEFS{`deftype?*` : deftype?*} deftype?* } ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec @@ -20721,7 +20700,7 @@ syntax I = idctxt ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec rec { -;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:155.1-155.57 +;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:155.1-155.56 def $concat_idctxt(idctxt*) : idctxt ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:156.1-156.29 def $concat_idctxt([]) = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []} @@ -20974,12 +20953,14 @@ grammar Tlimits : limits ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec grammar Ttypeuse_(I : I) : (typeidx, idctxt) ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec - prod{x : idx, I' : I, `t_1*` : valtype*, `t_2*` : valtype*} {{"("} {"type"} {x:Ttypeidx_(I)} {")"}} => (x, I') - -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))))) + prod{x : idx, I' : I, `st*` : subtype*, i : n, `t_1*` : valtype*, `t_2*` : valtype*} {{"("} {"type"} {x:Ttypeidx_(I)} {")"}} => (x, I') + -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(_DEF_deftype(REC_rectype(`%`_list(st*{st <- `st*`})), i))) + -- if (st*{st <- `st*`}[i] = SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) -- if (I' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS ?(`%`_name([]))^|t_1*{t_1 <- `t_1*`}|{}, LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec - prod{x : idx, `t_1*` : valtype*, `id?*` : char?*, `t_2*` : valtype*, I' : I} {{"("} {"type"} {x:Ttypeidx_(I)} {")"} {(t_1, ?(`%`_name(lift(id?{id <- `id?`}))))*{`id?` <- `id?*`, t_1 <- `t_1*`}:Tparam_(I)*{}} {t_2*{t_2 <- `t_2*`}:Tresult_(I)*{}}} => (x, I') - -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))))) + prod{x : idx, `t_1*` : valtype*, `id?*` : char?*, `t_2*` : valtype*, I' : I, `st*` : subtype*, i : n} {{"("} {"type"} {x:Ttypeidx_(I)} {")"} {(t_1, ?(`%`_name(lift(id?{id <- `id?`}))))*{`id?` <- `id?*`, t_1 <- `t_1*`}:Tparam_(I)*{}} {t_2*{t_2 <- `t_2*`}:Tresult_(I)*{}}} => (x, I') + -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(_DEF_deftype(REC_rectype(`%`_list(st*{st <- `st*`})), i))) + -- if (st*{st <- `st*`}[i] = SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) -- if (I' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS ?(`%`_name(lift(id?{id <- `id?`})))*{`id?` <- `id?*`}, LABELS [], FIELDS [], TYPEDEFS []}) -- Idctxt_ok: `|-%:OK`(I') @@ -21048,6 +21029,9 @@ grammar Tcatch_(I : I) : catch ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{l : labelidx} {{"("} {"catch_all_ref"} {l:Tlabelidx_(I)} {")"}} => CATCH_ALL_REF_catch(l) +;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec +grammar Tfoldedinstr_(I : I) : instr* + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tlaneidx : laneidx ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -21058,16 +21042,20 @@ grammar Talign_(N : N) : u64 ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{m : m, n : n} {{"align="} {`%`_u64(m):Tu64}} => `%`_u64(m) -- if (m = (2 ^ n)) + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec + prod eps => `%`_u64(N) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Toffset : u64 ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{n : n} {{"offset="} {`%`_u64(n):Tu64}} => `%`_u64(n) + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec + prod eps => `%`_u64(0) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tmemarg_(N : N) : memarg ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{n : n, m : m} {{`%`_u64(n):Toffset} {`%`_u64(m):Talign_(N)}} => {ALIGN `%`_u32(n), OFFSET `%`_u32(m)} + prod{n : n, m : m} {{`%`_u64(n):Toffset} {`%`_u64(m):Talign_(N)}} => {ALIGN `%`_u32(n), OFFSET `%`_u64(m)} ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tplaininstr_(I : I) : instr @@ -21078,7 +21066,7 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "drop" => DROP_instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{`t?` : valtype?} {{"select"} {t?{t <- `t?`}:Tresult_(I)?{}}} => SELECT_instr(?(lift(t?{t <- `t?`}))) + prod{`t*?` : valtype*?} {{"select"} {t*{t <- `t*`}:Tresult_(I)*{}?{`t*` <- `t*?`}}} => SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`}) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{l : labelidx} {{"br"} {l:Tlabelidx_(I)}} => BR_instr(l) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -21616,33 +21604,33 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "f64x2.splat" => VSPLAT_instr(`%X%`_shape(F64_lanetype, `%`_dim(2))) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.extract_lane_s"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.extract_lane_s"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.extract_lane_u"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.extract_lane_u"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.extract_lane_s"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.extract_lane_s"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.extract_lane_u"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.extract_lane_u"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i32x4.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i32x4.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i64x2.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i64x2.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f32x4.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f32x4.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f64x2.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f64x2.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i32x4.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i32x4.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i64x2.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i64x2.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f32x4.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f32x4.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f64x2.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f64x2.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "v128.any_true" => VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -22077,31 +22065,18 @@ grammar Tinstrs_(I : I) : instr* ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:24.5-24.52 prod{`in**` : instr**} in*{in <- `in*`}*{`in*` <- `in**`}:Tfoldedinstr_(I)*{} => $concat_(syntax instr, in*{in <- `in*`}*{`in*` <- `in**`}) -;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:31.1-41.24 -grammar Tfoldedinstr_(I : I) : instr* - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:28.5-28.59 - prod{in : instr, `in'*` : instr*} {{"("} {in:Tplaininstr_(I)} {in'*{in' <- `in'*`}:Tinstrs_(I)} {")"}} => in'*{in' <- `in'*`} ++ [in] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:32.5-33.17 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*} {{"("} {"block"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [BLOCK_instr(bt, in*{in <- `in*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:34.5-35.16 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*} {{"("} {"loop"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [LOOP_instr(bt, in*{in <- `in*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:36.5-39.33 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `in_1*` : instr*, `in_2*` : instr*} {{"("} {"if"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"("} {"then"} {in_1*{in_1 <- `in_1*`}:Tinstrs_(I')} {")"} {{{"("} {"else"} {in_2*{in_2 <- `in_2*`}:Tinstrs_(I')} {")"}}?{}} {")"}} => in*{in <- `in*`} ++ [`IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:40.5-41.24 - prod{`id?` : char?, I' : I, bt : blocktype, `c*` : catch*, `in*` : instr*} {{"("} {"try_table"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {c*{c <- `c*`}:Tcatch_(I)*{}} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`})] - -;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:75.1-77.65 +;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:88.1-90.65 grammar Tblockinstr_(I : I) : instr - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:61.5-63.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:63.5-67.35 prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `id'?` : char?} {{"block"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => BLOCK_instr(bt, in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:64.5-66.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:68.5-72.35 prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `id'?` : char?} {{"loop"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => LOOP_instr(bt, in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:67.5-69.71 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:73.5-79.71 prod{`id?` : char?, I' : I, bt : blocktype, `in_1*` : instr*, `id_1?` : char?, `in_2*` : instr*, `id_2?` : char?} {{"if"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in_1*{in_1 <- `in_1*`}:Tinstrs_(I')} {"else"} {?(`%`_name(lift(id_1?{id_1 <- `id_1?`}))):Tid?{}} {in_2*{in_2 <- `in_2*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id_2?{id_2 <- `id_2?`}))):Tid?{}}} => `IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`}) -- if (((id_1?{id_1 <- `id_1?`} = ?()) \/ (id_1?{id_1 <- `id_1?`} = id?{id <- `id?`})) /\ ((id_2?{id_2 <- `id_2?`} = ?()) \/ (id_2?{id_2 <- `id_2?`} = id?{id <- `id?`}))) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:70.5-72.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:80.5-85.35 prod{`id?` : char?, I' : I, bt : blocktype, `c*` : catch*, `in*` : instr*, `id'?` : char?} {{"try_table"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {c*{c <- `c*`}:Tcatch_(I)*{}} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) } @@ -22114,9 +22089,9 @@ grammar Texpr_(I : I) : expr ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Ttype_(I : I) : (type, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{qt : rectype, I' : I, I'' : I, st : subtype, n : n} (qt, I'):Trectype_(I) => (TYPE_type(qt), I' +++ I'') - -- if (qt = REC_rectype(`%`_list(st^n{}))) - -- if (((n = 1) /\ (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS [?(st)]})) \/ ((n =/= 1) /\ (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS ?()^n{}}))) + prod{qt : rectype, I' : I, I'' : I, `st*` : subtype*, n : n, `i*` : nat*} (qt, I'):Trectype_(I) => (TYPE_type(qt), I' +++ I'') + -- if (qt = REC_rectype(`%`_list(st^n{st <- `st*`}))) + -- if (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS ?(_DEF_deftype(qt, i))^(i x - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod eps => `%`_memidx(0) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Toffset_(I : I) : expr @@ -22172,7 +22145,7 @@ grammar Tdata_(I : I) : (data, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, `b*` : byte*} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {b*{b <- `b*`}:Tdatastring} {")"}} => (DATA_data(b*{b <- `b*`}, PASSIVE_datamode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{`id?` : char?, `b*` : byte*, x : idx, e : expr} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {b*{b <- `b*`}:Tdatastring} {x:Tmemuse_(I)} {e:Toffset_(I)} {")"}} => (DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) + prod{`id?` : char?, x : idx, e : expr, `b*` : byte*} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {x:Tmemuse_(I)} {e:Toffset_(I)} {b*{b <- `b*`}:Tdatastring} {")"}} => (DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telemlist_(I : I) : (reftype, expr*) @@ -22183,15 +22156,13 @@ grammar Telemlist_(I : I) : (reftype, expr*) grammar Ttableuse_(I : I) : tableidx ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{x : idx} {{"("} {"table"} {x:Ttableidx_(I)} {")"}} => x - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod eps => `%`_tableidx(0) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telem_(I : I) : (elem, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{`id?` : char?, rt : reftype, `e*` : expr*, x : idx, e' : expr} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {(rt, e*{e <- `e*`}):Telemlist_(I)} {x:Ttableuse_(I)} {e':Toffset_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, ACTIVE_elemmode(x, e')), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) + prod{`id?` : char?, x : idx, e' : expr, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {x:Ttableuse_(I)} {e':Toffset_(I)} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, ACTIVE_elemmode(x, e')), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {"declare"} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) @@ -22225,6 +22196,9 @@ grammar Timportdots : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`` : ()} ``:{{"("} {"import"} {Tname} {Tname} {")"}} => (``, ()).1 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec +def $dots : () + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Texporttagdots_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec @@ -22240,7 +22214,7 @@ grammar Texportglobaldots_(I : I) : () prod{`` : ()} ``:{{Texportdots*{}} Timportdots {Tglobaltype_(I)}} => (``, ()).1 ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Texportmemorydots_(I : I) : () +grammar Texportmemdots_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`` : ()} ``:{{Texportdots*{}} {Tmemtype_(I)}} => (``, ()).1 ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec @@ -22271,7 +22245,7 @@ grammar Texporttag_(I : I) : () grammar Texportglobal_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Texportmemory_(I : I) : () +grammar Texportmem_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Texporttable_(I : I) : () @@ -22280,7 +22254,7 @@ grammar Texporttable_(I : I) : () grammar Texportfunc_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Tdatamemory_(I : I) : () +grammar Tdatamem_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telemtable_(I : I) : () @@ -22302,13 +22276,13 @@ syntax decl = ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:226.1-226.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:258.1-258.76 def $typesd(decl*) : type* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:238.1-238.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:270.1-270.23 def $typesd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:239.1-239.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:271.1-271.48 def $typesd{type : type, `decl'*` : decl*}([(type : type <: decl)] ++ decl'*{decl' <- `decl'*`}) = [type] ++ $typesd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:240.1-240.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:272.1-272.57 def $typesd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $typesd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22316,13 +22290,13 @@ def $typesd(decl*) : type* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:227.1-227.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:259.1-259.78 def $importsd(decl*) : import* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:242.1-242.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:274.1-274.25 def $importsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:243.1-243.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:275.1-275.56 def $importsd{import : import, `decl'*` : decl*}([(import : import <: decl)] ++ decl'*{decl' <- `decl'*`}) = [import] ++ $importsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:244.1-244.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:276.1-276.61 def $importsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $importsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22330,13 +22304,13 @@ def $importsd(decl*) : import* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:228.1-228.75 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:260.1-260.75 def $tagsd(decl*) : tag* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:246.1-246.22 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:278.1-278.22 def $tagsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:247.1-247.44 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:279.1-279.44 def $tagsd{tag : tag, `decl'*` : decl*}([(tag : tag <: decl)] ++ decl'*{decl' <- `decl'*`}) = [tag] ++ $tagsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:248.1-248.55 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:280.1-280.55 def $tagsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $tagsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22344,13 +22318,13 @@ def $tagsd(decl*) : tag* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:229.1-229.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:261.1-261.78 def $globalsd(decl*) : global* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:250.1-250.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:282.1-282.25 def $globalsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:251.1-251.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:283.1-283.56 def $globalsd{global : global, `decl'*` : decl*}([(global : global <: decl)] ++ decl'*{decl' <- `decl'*`}) = [global] ++ $globalsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:252.1-252.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:284.1-284.61 def $globalsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $globalsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22358,13 +22332,13 @@ def $globalsd(decl*) : global* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:230.1-230.75 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:262.1-262.75 def $memsd(decl*) : mem* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:254.1-254.22 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:286.1-286.22 def $memsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:255.1-255.44 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:287.1-287.44 def $memsd{mem : mem, `decl'*` : decl*}([(mem : mem <: decl)] ++ decl'*{decl' <- `decl'*`}) = [mem] ++ $memsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:256.1-256.55 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:288.1-288.55 def $memsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $memsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22372,13 +22346,13 @@ def $memsd(decl*) : mem* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:231.1-231.77 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:263.1-263.77 def $tablesd(decl*) : table* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:258.1-258.24 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:290.1-290.24 def $tablesd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:259.1-259.52 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:291.1-291.52 def $tablesd{table : table, `decl'*` : decl*}([(table : table <: decl)] ++ decl'*{decl' <- `decl'*`}) = [table] ++ $tablesd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:260.1-260.59 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:292.1-292.59 def $tablesd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $tablesd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22386,13 +22360,13 @@ def $tablesd(decl*) : table* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:232.1-232.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:264.1-264.76 def $funcsd(decl*) : func* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:262.1-262.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:294.1-294.23 def $funcsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:263.1-263.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:295.1-295.48 def $funcsd{func : func, `decl'*` : decl*}([(func : func <: decl)] ++ decl'*{decl' <- `decl'*`}) = [func] ++ $funcsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:264.1-264.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:296.1-296.57 def $funcsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $funcsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22400,13 +22374,13 @@ def $funcsd(decl*) : func* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:233.1-233.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:265.1-265.76 def $datasd(decl*) : data* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:266.1-266.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:298.1-298.23 def $datasd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:267.1-267.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:299.1-299.48 def $datasd{data : data, `decl'*` : decl*}([(data : data <: decl)] ++ decl'*{decl' <- `decl'*`}) = [data] ++ $datasd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:268.1-268.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:300.1-300.57 def $datasd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $datasd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22414,13 +22388,13 @@ def $datasd(decl*) : data* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:234.1-234.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:266.1-266.76 def $elemsd(decl*) : elem* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:270.1-270.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:302.1-302.23 def $elemsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:271.1-271.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:303.1-303.48 def $elemsd{elem : elem, `decl'*` : decl*}([(elem : elem <: decl)] ++ decl'*{decl' <- `decl'*`}) = [elem] ++ $elemsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:272.1-272.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:304.1-304.57 def $elemsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $elemsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22428,13 +22402,13 @@ def $elemsd(decl*) : elem* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:235.1-235.77 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:267.1-267.77 def $startsd(decl*) : start* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:274.1-274.24 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:306.1-306.24 def $startsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:275.1-275.52 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:307.1-307.52 def $startsd{start : start, `decl'*` : decl*}([(start : start <: decl)] ++ decl'*{decl' <- `decl'*`}) = [start] ++ $startsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:276.1-276.59 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:308.1-308.59 def $startsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $startsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22442,13 +22416,13 @@ def $startsd(decl*) : start* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:236.1-236.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:268.1-268.78 def $exportsd(decl*) : export* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:278.1-278.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:310.1-310.25 def $exportsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:279.1-279.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:311.1-311.56 def $exportsd{export : export, `decl'*` : decl*}([(export : export <: decl)] ++ decl'*{decl' <- `decl'*`}) = [export] ++ $exportsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:280.1-280.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:312.1-312.61 def $exportsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $exportsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -22456,9 +22430,8 @@ def $exportsd(decl*) : export* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec def $ordered(decl*) : bool ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - def $ordered([]) = true - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - def $ordered{`decl'*` : decl*}(decl'*{decl' <- `decl'*`}) = ($importsd(decl'*{decl' <- `decl'*`}) = []) + def $ordered{`decl'*` : decl*}(decl'*{decl' <- `decl'*`}) = true + -- if ($importsd(decl'*{decl' <- `decl'*`}) = []) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec def $ordered{`decl_1*` : decl*, import : import, `decl_2*` : decl*}(decl_1*{decl_1 <- `decl_1*`} ++ [(import : import <: decl)] ++ decl_2*{decl_2 <- `decl_2*`}) = (((((($importsd(decl_1*{decl_1 <- `decl_1*`}) = []) /\ ($tagsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($globalsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($memsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($tablesd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($funcsd(decl_1*{decl_1 <- `decl_1*`}) = [])) @@ -22506,6 +22479,11 @@ grammar Tmodule : module -- if (export*{export <- `export*`} = $exportsd(decl*{decl <- `decl*`})) -- if $ordered(decl*{decl <- `decl*`}) +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec +grammar Tdecldots_(I : I) : (decl, idctxt)* + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec + prod{`` : (decl, idctxt)} [``]:Tdecl_(I)*{} => [``] + ;; ../../../../specification/wasm-3.0/X.1-notation.syntax.spectec syntax A = nat @@ -24595,7 +24573,7 @@ syntax vcvtop__(shape_1 : shape, shape_2 : shape) syntax memarg = { ALIGN{u32 : u32} u32, - OFFSET{u32 : u32} u32 + OFFSET{u64 : u64} u64 } ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec @@ -24619,7 +24597,7 @@ syntax vloadop_{vectype : vectype}(vectype) = ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec syntax blocktype = | _RESULT{`valtype?` : valtype?}(valtype?{valtype <- `valtype?`} : valtype?) - | _IDX{funcidx : funcidx}(funcidx : funcidx) + | _IDX{typeidx : typeidx}(typeidx : typeidx) ;; ../../../../specification/wasm-3.0/4.0-execution.configurations.spectec syntax addr = nat @@ -24858,7 +24836,7 @@ syntax expr = instr* ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $memarg0 : memarg ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec - def $memarg0 = {ALIGN `%`_u32(0), OFFSET `%`_u32(0)} + def $memarg0 = {ALIGN `%`_u32(0), OFFSET `%`_u64(0)} ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $const(consttype : consttype, lit_ : lit_((consttype : consttype <: storagetype))) : instr @@ -24877,7 +24855,7 @@ def $free_blocktype(blocktype : blocktype) : free ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec def $free_blocktype{`valtype?` : valtype?}(_RESULT_blocktype(valtype?{valtype <- `valtype?`})) = $free_opt($free_valtype(valtype)?{valtype <- `valtype?`}) ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec - def $free_blocktype{funcidx : funcidx}(_IDX_blocktype(funcidx)) = $free_funcidx(funcidx) + def $free_blocktype{typeidx : typeidx}(_IDX_blocktype(typeidx)) = $free_typeidx(typeidx) ;; ../../../../specification/wasm-3.0/1.3-syntax.instructions.spectec rec { @@ -26018,6 +25996,14 @@ relation Defaultable: `|-%DEFAULTABLE`(valtype) `|-%DEFAULTABLE`(t) -- if ($default_(t) =/= ?()) +;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec +relation Memarg_ok: `|-%:%->%`(memarg, addrtype, N) + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec + rule _{n : n, m : m, at : addrtype, N : N}: + `|-%:%->%`({ALIGN `%`_u32(n), OFFSET `%`_u64(m)}, at, N) + -- if (((2 ^ n) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- if (m < (2 ^ $size((at : addrtype <: numtype)))) + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec def $is_packtype(storagetype : storagetype) : bool ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec @@ -26462,25 +26448,25 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) -- if (x!`%`_idx.0 < |C.ELEMS_context|) -- if (C.ELEMS_context[x!`%`_idx.0] = rt) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:408.1-410.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:416.1-418.32 rule memory.size{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.SIZE_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:412.1-414.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:420.1-422.32 rule memory.grow{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.GROW_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(at : addrtype <: valtype)]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:416.1-418.32 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:424.1-426.32 rule memory.fill{C : context, x : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.FILL_instr(x), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype (at : addrtype <: valtype)]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:420.1-423.38 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:428.1-431.38 rule memory.copy{C : context, x_1 : idx, x_2 : idx, at_1 : addrtype, at_2 : addrtype, lim_1 : limits, lim_2 : limits}: `%|-%:%`(C, MEMORY.COPY_instr(x_1, x_2), `%->_%%`_instrtype(`%`_resulttype([(at_1 : addrtype <: valtype) (at_2 : addrtype <: valtype) ($minat(at_1, at_2) : addrtype <: valtype)]), [], `%`_resulttype([]))) -- if (x_1!`%`_idx.0 < |C.MEMS_context|) @@ -26488,7 +26474,7 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) -- if (x_2!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x_2!`%`_idx.0] = `%%PAGE`_memtype(at_2, lim_2)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:425.1-428.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:433.1-436.24 rule memory.init{C : context, x : idx, y : idx, at : addrtype, lim : limits}: `%|-%:%`(C, MEMORY.INIT_instr(x, y), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) I32_valtype I32_valtype]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) @@ -26496,213 +26482,213 @@ relation Instr_ok: `%|-%:%`(context, instr, instrtype) -- if (y!`%`_idx.0 < |C.DATAS_context|) -- if (C.DATAS_context[y!`%`_idx.0] = OK_datatype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:430.1-432.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:438.1-440.24 rule data.drop{C : context, x : idx}: `%|-%:%`(C, DATA.DROP_instr(x), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.DATAS_context|) -- if (C.DATAS_context[x!`%`_idx.0] = OK_datatype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:443.1-446.43 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:451.1-454.44 rule `load-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, LOAD_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $size(nt)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:448.1-451.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:456.1-459.36 rule `load-pack`{C : context, Inn : Inn, M : M, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(M), sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([(Inn : Inn <: valtype)]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, M) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:462.1-465.43 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:470.1-473.44 rule `store-val`{C : context, nt : numtype, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, STORE_instr(nt, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($size(nt) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $size(nt)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:467.1-470.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:475.1-478.36 rule `store-pack`{C : context, Inn : Inn, M : M, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(M))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) (Inn : Inn <: valtype)]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((M : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, M) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:472.1-475.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:480.1-483.47 rule `vload-val`{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $vsize(V128_vectype)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:477.1-480.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:485.1-488.41 rule `vload-pack`{C : context, M : M, N : N, sx : sx, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), N, sx)), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (((M : nat <:> rat) / (8 : nat <:> rat)) * (N : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, (M * N)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:482.1-485.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:490.1-493.36 rule `vload-splat`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:487.1-490.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:495.1-498.36 rule `vload-zero`{C : context, N : N, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:492.1-496.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:500.1-504.21 rule vload_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: `%|-%:%`(C, VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([V128_valtype]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:498.1-501.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:506.1-509.47 rule vstore{C : context, x : idx, memarg : memarg, at : addrtype, lim : limits}: `%|-%:%`(C, VSTORE_instr(V128_vectype, x, memarg), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= (($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, $vsize(V128_vectype)) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:503.1-507.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:511.1-515.21 rule vstore_lane{C : context, N : N, x : idx, memarg : memarg, i : laneidx, at : addrtype, lim : limits}: `%|-%:%`(C, VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, memarg, i), `%->_%%`_instrtype(`%`_resulttype([(at : addrtype <: valtype) V128_valtype]), [], `%`_resulttype([]))) -- if (x!`%`_idx.0 < |C.MEMS_context|) -- if (C.MEMS_context[x!`%`_idx.0] = `%%PAGE`_memtype(at, lim)) - -- if (((2 ^ memarg.ALIGN_memarg!`%`_u32.0) : nat <:> rat) <= ((N : nat <:> rat) / (8 : nat <:> rat))) + -- Memarg_ok: `|-%:%->%`(memarg, at, N) -- if ((i!`%`_laneidx.0 : nat <:> rat) < ((128 : nat <:> rat) / (N : nat <:> rat))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:512.1-513.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:520.1-521.33 rule const{C : context, nt : numtype, c_nt : num_(nt)}: `%|-%:%`(C, CONST_instr(nt, c_nt), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:515.1-516.34 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:523.1-524.34 rule unop{C : context, nt : numtype, unop_nt : unop_(nt)}: `%|-%:%`(C, UNOP_instr(nt, unop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:518.1-519.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:526.1-527.39 rule binop{C : context, nt : numtype, binop_nt : binop_(nt)}: `%|-%:%`(C, BINOP_instr(nt, binop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([(nt : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:521.1-522.39 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:529.1-530.39 rule testop{C : context, nt : numtype, testop_nt : testop_(nt)}: `%|-%:%`(C, TESTOP_instr(nt, testop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:524.1-525.40 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:532.1-533.40 rule relop{C : context, nt : numtype, relop_nt : relop_(nt)}: `%|-%:%`(C, RELOP_instr(nt, relop_nt), `%->_%%`_instrtype(`%`_resulttype([(nt : numtype <: valtype) (nt : numtype <: valtype)]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:527.1-528.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:535.1-536.44 rule cvtop{C : context, nt_1 : numtype, nt_2 : numtype, cvtop : cvtop__(nt_2, nt_1)}: `%|-%:%`(C, CVTOP_instr(nt_1, nt_2, cvtop), `%->_%%`_instrtype(`%`_resulttype([(nt_2 : numtype <: valtype)]), [], `%`_resulttype([(nt_1 : numtype <: valtype)]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:533.1-534.35 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:541.1-542.35 rule vconst{C : context, c : vec_(V128_Vnn)}: `%|-%:%`(C, VCONST_instr(V128_vectype, c), `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:536.1-537.41 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:544.1-545.41 rule vvunop{C : context, vvunop : vvunop}: `%|-%:%`(C, VVUNOP_instr(V128_vectype, vvunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:539.1-540.48 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:547.1-548.48 rule vvbinop{C : context, vvbinop : vvbinop}: `%|-%:%`(C, VVBINOP_instr(V128_vectype, vvbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:542.1-543.55 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:550.1-551.55 rule vvternop{C : context, vvternop : vvternop}: `%|-%:%`(C, VVTERNOP_instr(V128_vectype, vvternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:545.1-546.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:553.1-554.44 rule vvtestop{C : context, vvtestop : vvtestop}: `%|-%:%`(C, VVTESTOP_instr(V128_vectype, vvtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:548.1-549.37 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:556.1-557.37 rule vunop{C : context, sh : shape, vunop : vunop_(sh)}: `%|-%:%`(C, VUNOP_instr(sh, vunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:551.1-552.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:559.1-560.44 rule vbinop{C : context, sh : shape, vbinop : vbinop_(sh)}: `%|-%:%`(C, VBINOP_instr(sh, vbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:554.1-555.51 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:562.1-563.51 rule vternop{C : context, sh : shape, vternop : vternop_(sh)}: `%|-%:%`(C, VTERNOP_instr(sh, vternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:557.1-558.40 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:565.1-566.40 rule vtestop{C : context, sh : shape, vtestop : vtestop_(sh)}: `%|-%:%`(C, VTESTOP_instr(sh, vtestop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:560.1-561.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:568.1-569.44 rule vrelop{C : context, sh : shape, vrelop : vrelop_(sh)}: `%|-%:%`(C, VRELOP_instr(sh, vrelop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:563.1-564.47 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:571.1-572.47 rule vshiftop{C : context, sh : ishape, vshiftop : vshiftop_(sh)}: `%|-%:%`(C, VSHIFTOP_instr(sh, vshiftop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype I32_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:566.1-567.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:574.1-575.33 rule vbitmask{C : context, sh : ishape}: `%|-%:%`(C, VBITMASK_instr(sh), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([I32_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:569.1-570.50 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:577.1-578.50 rule vswizzlop{C : context, sh : bshape, vswizzlop : vswizzlop_(sh)}: `%|-%:%`(C, VSWIZZLOP_instr(sh, vswizzlop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:572.1-574.29 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:580.1-582.29 rule vshuffle{C : context, sh : bshape, `i*` : laneidx*}: `%|-%:%`(C, VSHUFFLE_instr(sh, i*{i <- `i*`}), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) -- (if (i!`%`_laneidx.0 < (2 * $dim(sh!`%`_bshape.0)!`%`_dim.0)))*{i <- `i*`} - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:576.1-577.44 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:584.1-585.44 rule vsplat{C : context, sh : shape}: `%|-%:%`(C, VSPLAT_instr(sh), `%->_%%`_instrtype(`%`_resulttype([($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:579.1-581.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:587.1-589.21 rule vextract_lane{C : context, sh : shape, `sx?` : sx?, i : laneidx}: `%|-%:%`(C, VEXTRACT_LANE_instr(sh, sx?{sx <- `sx?`}, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([($unpackshape(sh) : numtype <: valtype)]))) -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:583.1-585.21 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:591.1-593.21 rule vreplace_lane{C : context, sh : shape, i : laneidx}: `%|-%:%`(C, VREPLACE_LANE_instr(sh, i), `%->_%%`_instrtype(`%`_resulttype([V128_valtype ($unpackshape(sh) : numtype <: valtype)]), [], `%`_resulttype([V128_valtype]))) -- if (i!`%`_laneidx.0 < $dim(sh)!`%`_dim.0) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:587.1-588.50 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:595.1-596.50 rule vextunop{C : context, sh_1 : ishape, sh_2 : ishape, vextunop : vextunop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTUNOP_instr(sh_1, sh_2, vextunop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:590.1-591.57 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:598.1-599.57 rule vextbinop{C : context, sh_1 : ishape, sh_2 : ishape, vextbinop : vextbinop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTBINOP_instr(sh_1, sh_2, vextbinop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:593.1-594.64 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:601.1-602.64 rule vextternop{C : context, sh_1 : ishape, sh_2 : ishape, vextternop : vextternop__(sh_2, sh_1)}: `%|-%:%`(C, VEXTTERNOP_instr(sh_1, sh_2, vextternop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:596.1-597.48 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:604.1-605.48 rule vnarrow{C : context, sh_1 : ishape, sh_2 : ishape, sx : sx}: `%|-%:%`(C, VNARROW_instr(sh_1, sh_2, sx), `%->_%%`_instrtype(`%`_resulttype([V128_valtype V128_valtype]), [], `%`_resulttype([V128_valtype]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:599.1-600.46 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:607.1-608.46 rule vcvtop{C : context, sh_1 : shape, sh_2 : shape, vcvtop : vcvtop__(sh_2, sh_1)}: `%|-%:%`(C, VCVTOP_instr(sh_1, sh_2, vcvtop), `%->_%%`_instrtype(`%`_resulttype([V128_valtype]), [], `%`_resulttype([V128_valtype]))) ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:6.1-6.96 relation Instrs_ok: `%|-%:%`(context, instr*, instrtype) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:605.1-606.24 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:613.1-614.24 rule empty{C : context}: `%|-%:%`(C, [], `%->_%%`_instrtype(`%`_resulttype([]), [], `%`_resulttype([]))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:609.1-613.82 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:617.1-621.82 rule seq{C : context, instr_1 : instr, `instr_2*` : instr*, `t_1*` : valtype*, `x_1*` : idx*, `x_2*` : idx*, `t_3*` : valtype*, `t_2*` : valtype*, `init*` : init*, `t*` : valtype*}: `%|-%:%`(C, [instr_1] ++ instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`} ++ x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) -- Instr_ok: `%|-%:%`(C, instr_1, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x_1*{x_1 <- `x_1*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) @@ -26712,14 +26698,14 @@ relation Instrs_ok: `%|-%:%`(context, instr*, instrtype) -- (if (C.LOCALS_context[x_1!`%`_idx.0] = `%%`_localtype(init, t)))*{init <- `init*`, t <- `t*`, x_1 <- `x_1*`} -- Instrs_ok: `%|-%:%`($with_locals(C, x_1*{x_1 <- `x_1*`}, `%%`_localtype(SET_init, t)*{t <- `t*`}), instr_2*{instr_2 <- `instr_2*`}, `%->_%%`_instrtype(`%`_resulttype(t_2*{t_2 <- `t_2*`}), x_2*{x_2 <- `x_2*`}, `%`_resulttype(t_3*{t_3 <- `t_3*`}))) - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:615.1-619.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:623.1-627.33 rule sub{C : context, `instr*` : instr*, it' : instrtype, it : instrtype}: `%|-%:%`(C, instr*{instr <- `instr*`}, it') -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, it) -- Instrtype_sub: `%|-%<:%`(C, it, it') -- Instrtype_ok: `%|-%:OK`(C, it') - ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:622.1-625.33 + ;; ../../../../specification/wasm-3.0/2.3-validation.instructions.spectec:630.1-633.33 rule frame{C : context, `instr*` : instr*, `t*` : valtype*, `t_1*` : valtype*, `x*` : idx*, `t_2*` : valtype*}: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t*{t <- `t*`} ++ t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t*{t <- `t*`} ++ t_2*{t_2 <- `t_2*`}))) -- Instrs_ok: `%|-%:%`(C, instr*{instr <- `instr*`}, `%->_%%`_instrtype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), x*{x <- `x*`}, `%`_resulttype(t_2*{t_2 <- `t_2*`}))) @@ -27826,20 +27812,6 @@ def $fvternop_(shape : shape, def $f_(N : N, fN : fN(N), fN : fN(N), fN : fN(N)) -- if (c_3*{c_3 <- `c_3*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_3)) -- if (c*{c <- `c*`}*{`c*` <- `c**`} = $setproduct_(syntax lane_((Fnn : Fnn <: lanetype)), $f_($sizenn((Fnn : Fnn <: numtype)), c_1, c_2, c_3)*{c_1 <- `c_1*`, c_2 <- `c_2*`, c_3 <- `c_3*`})) -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $ivtestop_(shape : shape, def $f_(N : N, iN : iN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $ivtestop_{Jnn : Jnn, M : M, def $f_(N : N, iN : iN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : u32*, `c_1*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c!`%`_u32.0*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($lsizenn((Jnn : Jnn <: lanetype)), c_1)*{c_1 <- `c_1*`}) - -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $fvtestop_(shape : shape, def $f_(N : N, fN : fN(N)) : u32, vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $fvtestop_{Fnn : Fnn, M : M, def $f_(N : N, fN : fN(N)) : u32, v_1 : vec_(V128_Vnn), `c*` : u32*, `c_1*` : lane_($lanetype(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M))))*}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $f_, v_1) = `%`_u32($prod(c!`%`_u32.0*{c <- `c*`})) - -- if (c_1*{c_1 <- `c_1*`} = $lanes_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), v_1)) - -- if (c*{c <- `c*`} = $f_($sizenn((Fnn : Fnn <: numtype)), c_1)*{c_1 <- `c_1*`}) - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $ivrelop_(shape : shape, def $f_(N : N, iN : iN(N), iN : iN(N)) : u32, vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -27998,11 +27970,6 @@ def $vternop_(shape : shape, vternop_ : vternop_(shape), vec_ : vec_(V128_Vnn), ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vternop_{Fnn : Fnn, M : M, v_1 : vec_(V128_Vnn), v_2 : vec_(V128_Vnn), v_3 : vec_(V128_Vnn)}(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), RELAXED_NMADD_vternop_, v_1, v_2, v_3) = $fvternop_(`%X%`_shape((Fnn : Fnn <: lanetype), `%`_dim(M)), def $frelaxed_nmadd_, v_1, v_2, v_3) -;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec -def $vtestop_(shape : shape, vtestop_ : vtestop_(shape), vec_ : vec_(V128_Vnn)) : u32 - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec - def $vtestop_{Jnn : Jnn, M : M, v : vec_(V128_Vnn)}(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_, v) = $ivtestop_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), def $inez_, v) - ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec def $vrelop_(shape : shape, vrelop_ : vrelop_(shape), vec_ : vec_(V128_Vnn), vec_ : vec_(V128_Vnn)) : vec_(V128_Vnn) ;; ../../../../specification/wasm-3.0/3.2-numerics.vector.spectec @@ -29028,7 +28995,7 @@ relation Step_pure: `%~>%`(instr*, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule vvtestop{c_1 : vec_(V128_Vnn), c : num_(I32_numtype)}: `%~>%`([VCONST_instr(V128_vectype, c_1) VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop)], [CONST_instr(I32_numtype, c)]) - -- if (c = $ine_($vsize(V128_vectype), c_1, `%`_iN(0))) + -- if (c = $inez_($vsize(V128_vectype), c_1)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vunop-val`{c_1 : vec_(V128_Vnn), sh : shape, vunop : vunop_(sh), c : vec_(V128_Vnn)}: @@ -29064,9 +29031,10 @@ relation Step_pure: `%~>%`(instr*, instr*) -- if ($vternop_(sh, vternop, c_1, c_2, c_3) = []) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec - rule vtestop{c_1 : vec_(V128_Vnn), sh : shape, vtestop : vtestop_(sh), i : num_(I32_numtype)}: - `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(sh, vtestop)], [CONST_instr(I32_numtype, i)]) - -- if (i = $vtestop_(sh, vtestop, c_1)) + rule vtestop{c_1 : vec_(V128_Vnn), Jnn : Jnn, M : M, c : num_(I32_numtype), `i*` : lane_($lanetype(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M))))*}: + `%~>%`([VCONST_instr(V128_vectype, c_1) VTESTOP_instr(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), ALL_TRUE_vtestop_)], [CONST_instr(I32_numtype, c)]) + -- if (i*{i <- `i*`} = $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)) + -- if (c!`%`_num_.0 = $prod($inez_($jsizenn(Jnn), i)!`%`_u32.0*{i <- `i*`})) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule vrelop{c_1 : vec_(V128_Vnn), c_2 : vec_(V128_Vnn), sh : shape, vrelop : vrelop_(sh), c : vec_(V128_Vnn)}: @@ -29366,53 +29334,53 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, x : idx, ao : memarg, c : num_(nt)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr(nt, ?(), x, ao)]), [CONST_instr(nt, c)]) - -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($nbytes_(nt, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(n), sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `load-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, n : n, sx : sx, x : idx, ao : memarg, c : iN(n)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) LOAD_instr((Inn : Inn <: numtype), ?(`%_%`_loadop_(`%`_sz(n), sx)), x, ao)]), [CONST_instr((Inn : Inn <: numtype), $extend__(n, $size((Inn : Inn <: numtype)), sx, c))]) - -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(n, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), x : idx, ao : memarg, c : vec_(V128_Vnn)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($vbytes_(V128_vectype, c) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((((M * K) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), M : M, K : K, sx : sx, x : idx, ao : memarg, c : vec_(V128_Vnn), `j*` : iN(M)*, `k*` : nat*, Jnn : Jnn}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(`SHAPE%X%_%`_vloadop_(`%`_sz(M), K, sx)), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- (if ($ibytes_(M, j) = $mem(z, x).BYTES_meminst[((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((((k * M) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k rat) / (8 : nat <:> rat)) : rat <:> nat)) : (((M : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]))^(k%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-splat-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N), Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(SPLAT_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (c = $inv_lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), `%`_lane_(j!`%`_iN.0)^M{})) @@ -29420,23 +29388,23 @@ relation Step_read: `%~>%`(config, instr*) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-zero-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload-zero-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), N : N, x : idx, ao : memarg, c : vec_(V128_Vnn), j : iN(N)}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VLOAD_instr(V128_vectype, ?(ZERO_vloadop_(`%`_sz(N))), x, ao)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, j) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (c = $extend__(N, 128, U_sx, j)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [TRAP_instr]) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec rule `vload_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c_1 : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, c : vec_(V128_Vnn), k : iN(N), Jnn : Jnn, M : M}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c_1) VLOAD_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), [VCONST_instr(V128_vectype, c)]) - -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) + -- if ($ibytes_(N, k) = $mem(z, x).BYTES_meminst[(i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) : (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)]) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = (($vsize(V128_vectype) : nat <:> rat) / (N : nat <:> rat))) -- if (c = $inv_lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), $lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c_1)[[j!`%`_laneidx.0] = `%`_lane_(k!`%`_iN.0)])) @@ -29800,41 +29768,41 @@ relation Step: `%~>%`(config, config) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:494.1-497.60 rule `store-num-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:499.1-503.29 rule `store-num-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), nt : numtype, c : num_(nt), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr(nt, c) STORE_instr(nt, ?(), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), ((($size(nt) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $nbytes_(nt, c)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:505.1-508.52 rule `store-pack-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:510.1-514.52 rule `store-pack-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), Inn : Inn, c : num_((Inn : Inn <: numtype)), n : n, x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) CONST_instr((Inn : Inn <: numtype), c) STORE_instr((Inn : Inn <: numtype), ?(`%`_storeop_(`%`_sz(n))), x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), (((n : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $ibytes_(n, $wrap__($size((Inn : Inn <: numtype)), n, c))) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:516.1-519.63 rule `vstore-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat)) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:521.1-524.31 rule `vstore-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), x : idx, ao : memarg, `b*` : byte*}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_instr(V128_vectype, x, ao)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), ((($vsize(V128_vectype) : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (b*{b <- `b*`} = $vbytes_(V128_vectype, c)) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:527.1-530.50 rule `vstore_lane-oob`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx}: `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config(z, [TRAP_instr])) - -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0) + N) > |$mem(z, x).BYTES_meminst|) + -- if (((i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0) + N) > |$mem(z, x).BYTES_meminst|) ;; ../../../../specification/wasm-3.0/4.3-execution.instructions.spectec:532.1-537.49 rule `vstore_lane-val`{z : state, at : addrtype, i : num_((at : addrtype <: numtype)), c : vec_(V128_Vnn), N : N, x : idx, ao : memarg, j : laneidx, `b*` : byte*, Jnn : Jnn, M : M}: - `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u32.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) + `%~>%`(`%;%`_config(z, [CONST_instr((at : addrtype <: numtype), i) VCONST_instr(V128_vectype, c) VSTORE_LANE_instr(V128_vectype, `%`_sz(N), x, ao, j)]), `%;%`_config($with_mem(z, x, (i!`%`_num_.0 + ao.OFFSET_memarg!`%`_u64.0), (((N : nat <:> rat) / (8 : nat <:> rat)) : rat <:> nat), b*{b <- `b*`}), [])) -- if (N = $jsize(Jnn)) -- if ((M : nat <:> rat) = ((128 : nat <:> rat) / (N : nat <:> rat))) -- if (j!`%`_laneidx.0 < |$lanes_(`%X%`_shape((Jnn : Jnn <: lanetype), `%`_dim(M)), c)|) @@ -30486,7 +30454,7 @@ grammar Bblocktype : blocktype ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec prod{t : valtype} t:Bvaltype => _RESULT_blocktype(?(t)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_funcidx((i!`%`_s33.0 : int <:> nat))) + prod{i : s33} i:Bs33 => _IDX_blocktype(`%`_typeidx((i!`%`_s33.0 : int <:> nat))) -- if (i!`%`_s33.0 >= (0 : nat <:> int)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec @@ -30506,10 +30474,10 @@ syntax memidxop = (memidx, memarg) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec grammar Bmemarg : memidxop ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{n : n, m : m} {{`%`_u32(n):Bu32} {`%`_u32(m):Bu32}} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u32(m)}) + prod{n : n, m : m} {{`%`_u32(n):Bu32} {`%`_u64(m):Bu64}} => (`%`_memidx(0), {ALIGN `%`_u32(n), OFFSET `%`_u64(m)}) -- if (n < (2 ^ 6)) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec - prod{n : n, x : idx, m : m} {{`%`_u32(n):Bu32} {x:Bmemidx} {`%`_u32(m):Bu32}} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u32(m)}) + prod{n : n, x : idx, m : m} {{`%`_u32(n):Bu32} {x:Bmemidx} {`%`_u64(m):Bu64}} => (x, {ALIGN `%`_u32((((n : nat <:> int) - ((2 ^ 6) : nat <:> int)) : int <:> nat)), OFFSET `%`_u64(m)}) -- if (((2 ^ 6) <= n) /\ (n < (2 ^ 7))) ;; ../../../../specification/wasm-3.0/5.3-binary.instructions.spectec @@ -32234,7 +32202,7 @@ syntax idctxt = LOCALS{`name?*` : name?*} name?*, LABELS{`name?*` : name?*} name?*, FIELDS{`name?**` : name?**} name?**, - TYPEDEFS{`subtype?*` : subtype?*} subtype?* + TYPEDEFS{`deftype?*` : deftype?*} deftype?* } ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec @@ -32243,7 +32211,7 @@ syntax I = idctxt ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec rec { -;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:155.1-155.57 +;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:155.1-155.56 def $concat_idctxt(idctxt*) : idctxt ;; ../../../../specification/wasm-3.0/6.1-text.values.spectec:156.1-156.29 def $concat_idctxt([]) = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []} @@ -32496,12 +32464,14 @@ grammar Tlimits : limits ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec grammar Ttypeuse_(I : I) : (typeidx, idctxt) ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec - prod{x : idx, I' : I, `t_1*` : valtype*, `t_2*` : valtype*} {{"("} {"type"} {x:Ttypeidx_(I)} {")"}} => (x, I') - -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))))) + prod{x : idx, I' : I, `st*` : subtype*, i : n, `t_1*` : valtype*, `t_2*` : valtype*} {{"("} {"type"} {x:Ttypeidx_(I)} {")"}} => (x, I') + -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(_DEF_deftype(REC_rectype(`%`_list(st*{st <- `st*`})), i))) + -- if (st*{st <- `st*`}[i] = SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) -- if (I' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS ?(`%`_name([]))^|t_1*{t_1 <- `t_1*`}|{}, LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.2-text.types.spectec - prod{x : idx, `t_1*` : valtype*, `id?*` : char?*, `t_2*` : valtype*, I' : I} {{"("} {"type"} {x:Ttypeidx_(I)} {")"} {(t_1, ?(`%`_name(lift(id?{id <- `id?`}))))*{`id?` <- `id?*`, t_1 <- `t_1*`}:Tparam_(I)*{}} {t_2*{t_2 <- `t_2*`}:Tresult_(I)*{}}} => (x, I') - -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`}))))) + prod{x : idx, `t_1*` : valtype*, `id?*` : char?*, `t_2*` : valtype*, I' : I, `st*` : subtype*, i : n} {{"("} {"type"} {x:Ttypeidx_(I)} {")"} {(t_1, ?(`%`_name(lift(id?{id <- `id?`}))))*{`id?` <- `id?*`, t_1 <- `t_1*`}:Tparam_(I)*{}} {t_2*{t_2 <- `t_2*`}:Tresult_(I)*{}}} => (x, I') + -- if (I.TYPEDEFS_I[x!`%`_idx.0] = ?(_DEF_deftype(REC_rectype(`%`_list(st*{st <- `st*`})), i))) + -- if (st*{st <- `st*`}[i] = SUB_subtype(?(FINAL_final), [], `FUNC%->%`_comptype(`%`_resulttype(t_1*{t_1 <- `t_1*`}), `%`_resulttype(t_2*{t_2 <- `t_2*`})))) -- if (I' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS ?(`%`_name(lift(id?{id <- `id?`})))*{`id?` <- `id?*`}, LABELS [], FIELDS [], TYPEDEFS []}) -- Idctxt_ok: `|-%:OK`(I') @@ -32570,6 +32540,9 @@ grammar Tcatch_(I : I) : catch ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{l : labelidx} {{"("} {"catch_all_ref"} {l:Tlabelidx_(I)} {")"}} => CATCH_ALL_REF_catch(l) +;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec +grammar Tfoldedinstr_(I : I) : instr* + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tlaneidx : laneidx ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -32580,16 +32553,20 @@ grammar Talign_(N : N) : u64 ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{m : m, n : n} {{"align="} {`%`_u64(m):Tu64}} => `%`_u64(m) -- if (m = (2 ^ n)) + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec + prod eps => `%`_u64(N) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Toffset : u64 ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{n : n} {{"offset="} {`%`_u64(n):Tu64}} => `%`_u64(n) + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec + prod eps => `%`_u64(0) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tmemarg_(N : N) : memarg ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{n : n, m : m} {{`%`_u64(n):Toffset} {`%`_u64(m):Talign_(N)}} => {ALIGN `%`_u32(n), OFFSET `%`_u32(m)} + prod{n : n, m : m} {{`%`_u64(n):Toffset} {`%`_u64(m):Talign_(N)}} => {ALIGN `%`_u32(n), OFFSET `%`_u64(m)} ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec grammar Tplaininstr_(I : I) : instr @@ -32600,7 +32577,7 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "drop" => DROP_instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{`t?` : valtype?} {{"select"} {t?{t <- `t?`}:Tresult_(I)?{}}} => SELECT_instr(?(lift(t?{t <- `t?`}))) + prod{`t*?` : valtype*?} {{"select"} {t*{t <- `t*`}:Tresult_(I)*{}?{`t*` <- `t*?`}}} => SELECT_instr(t*{t <- `t*`}?{`t*` <- `t*?`}) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod{l : labelidx} {{"br"} {l:Tlabelidx_(I)}} => BR_instr(l) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -33138,33 +33115,33 @@ grammar Tplaininstr_(I : I) : instr ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "f64x2.splat" => VSPLAT_instr(`%X%`_shape(F64_lanetype, `%`_dim(2))) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.extract_lane_s"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.extract_lane_s"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(S_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.extract_lane_u"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.extract_lane_u"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), ?(U_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.extract_lane_s"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.extract_lane_s"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(S_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.extract_lane_u"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.extract_lane_u"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), ?(U_sx), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i32x4.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i32x4.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i64x2.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i64x2.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f32x4.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f32x4.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f64x2.extract_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f64x2.extract_lane"} {i:Tlaneidx}} => VEXTRACT_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), ?(), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i8x16.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i8x16.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I8_lanetype, `%`_dim(16)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i16x8.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i16x8.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I16_lanetype, `%`_dim(8)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i32x4.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i32x4.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I32_lanetype, `%`_dim(4)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"i64x2.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"i64x2.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(I64_lanetype, `%`_dim(2)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f32x4.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f32x4.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F32_lanetype, `%`_dim(4)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec - prod{l : labelidx} {{"f64x2.replace_lane"} {`%`_laneidx(l!`%`_labelidx.0):Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), `%`_laneidx(l!`%`_labelidx.0)) + prod{i : laneidx} {{"f64x2.replace_lane"} {i:Tlaneidx}} => VREPLACE_LANE_instr(`%X%`_shape(F64_lanetype, `%`_dim(2)), i) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec prod "v128.any_true" => VVTESTOP_instr(V128_vectype, ANY_TRUE_vvtestop) ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec @@ -33599,31 +33576,18 @@ grammar Tinstrs_(I : I) : instr* ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:24.5-24.52 prod{`in**` : instr**} in*{in <- `in*`}*{`in*` <- `in**`}:Tfoldedinstr_(I)*{} => $concat_(syntax instr, in*{in <- `in*`}*{`in*` <- `in**`}) -;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:31.1-41.24 -grammar Tfoldedinstr_(I : I) : instr* - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:28.5-28.59 - prod{in : instr, `in'*` : instr*} {{"("} {in:Tplaininstr_(I)} {in'*{in' <- `in'*`}:Tinstrs_(I)} {")"}} => in'*{in' <- `in'*`} ++ [in] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:32.5-33.17 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*} {{"("} {"block"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [BLOCK_instr(bt, in*{in <- `in*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:34.5-35.16 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*} {{"("} {"loop"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [LOOP_instr(bt, in*{in <- `in*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:36.5-39.33 - prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `in_1*` : instr*, `in_2*` : instr*} {{"("} {"if"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"("} {"then"} {in_1*{in_1 <- `in_1*`}:Tinstrs_(I')} {")"} {{{"("} {"else"} {in_2*{in_2 <- `in_2*`}:Tinstrs_(I')} {")"}}?{}} {")"}} => in*{in <- `in*`} ++ [`IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`})] - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:40.5-41.24 - prod{`id?` : char?, I' : I, bt : blocktype, `c*` : catch*, `in*` : instr*} {{"("} {"try_table"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {c*{c <- `c*`}:Tcatch_(I)*{}} {in*{in <- `in*`}:Tinstrs_(I')} {")"}} => [TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`})] - -;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:75.1-77.65 +;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:88.1-90.65 grammar Tblockinstr_(I : I) : instr - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:61.5-63.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:63.5-67.35 prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `id'?` : char?} {{"block"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => BLOCK_instr(bt, in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:64.5-66.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:68.5-72.35 prod{`id?` : char?, I' : I, bt : blocktype, `in*` : instr*, `id'?` : char?} {{"loop"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => LOOP_instr(bt, in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:67.5-69.71 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:73.5-79.71 prod{`id?` : char?, I' : I, bt : blocktype, `in_1*` : instr*, `id_1?` : char?, `in_2*` : instr*, `id_2?` : char?} {{"if"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {in_1*{in_1 <- `in_1*`}:Tinstrs_(I')} {"else"} {?(`%`_name(lift(id_1?{id_1 <- `id_1?`}))):Tid?{}} {in_2*{in_2 <- `in_2*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id_2?{id_2 <- `id_2?`}))):Tid?{}}} => `IF%%ELSE%`_instr(bt, in_1*{in_1 <- `in_1*`}, in_2*{in_2 <- `in_2*`}) -- if (((id_1?{id_1 <- `id_1?`} = ?()) \/ (id_1?{id_1 <- `id_1?`} = id?{id <- `id?`})) /\ ((id_2?{id_2 <- `id_2?`} = ?()) \/ (id_2?{id_2 <- `id_2?`} = id?{id <- `id?`}))) - ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:70.5-72.35 + ;; ../../../../specification/wasm-3.0/6.3-text.instructions.spectec:80.5-85.35 prod{`id?` : char?, I' : I, bt : blocktype, `c*` : catch*, `in*` : instr*, `id'?` : char?} {{"try_table"} {(?(`%`_name(lift(id?{id <- `id?`}))), I'):Tlabel_(I)} {bt:Tblocktype_(I)} {c*{c <- `c*`}:Tcatch_(I)*{}} {in*{in <- `in*`}:Tinstrs_(I')} {"end"} {?(`%`_name(lift(id'?{id' <- `id'?`}))):Tid?{}}} => TRY_TABLE_instr(bt, `%`_list(c*{c <- `c*`}), in*{in <- `in*`}) -- if ((id'?{id' <- `id'?`} = ?()) \/ (id'?{id' <- `id'?`} = id?{id <- `id?`})) } @@ -33636,9 +33600,9 @@ grammar Texpr_(I : I) : expr ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Ttype_(I : I) : (type, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{qt : rectype, I' : I, I'' : I, st : subtype, n : n} (qt, I'):Trectype_(I) => (TYPE_type(qt), I' +++ I'') - -- if (qt = REC_rectype(`%`_list(st^n{}))) - -- if (((n = 1) /\ (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS [?(st)]})) \/ ((n =/= 1) /\ (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS ?()^n{}}))) + prod{qt : rectype, I' : I, I'' : I, `st*` : subtype*, n : n, `i*` : nat*} (qt, I'):Trectype_(I) => (TYPE_type(qt), I' +++ I'') + -- if (qt = REC_rectype(`%`_list(st^n{st <- `st*`}))) + -- if (I'' = {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS ?(_DEF_deftype(qt, i))^(i x - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod eps => `%`_memidx(0) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Toffset_(I : I) : expr @@ -33694,7 +33656,7 @@ grammar Tdata_(I : I) : (data, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, `b*` : byte*} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {b*{b <- `b*`}:Tdatastring} {")"}} => (DATA_data(b*{b <- `b*`}, PASSIVE_datamode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{`id?` : char?, `b*` : byte*, x : idx, e : expr} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {b*{b <- `b*`}:Tdatastring} {x:Tmemuse_(I)} {e:Toffset_(I)} {")"}} => (DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) + prod{`id?` : char?, x : idx, e : expr, `b*` : byte*} {{"("} {"data"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {x:Tmemuse_(I)} {e:Toffset_(I)} {b*{b <- `b*`}:Tdatastring} {")"}} => (DATA_data(b*{b <- `b*`}, ACTIVE_datamode(x, e)), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [?(`%`_name(lift(id?{id <- `id?`})))], ELEMS [], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telemlist_(I : I) : (reftype, expr*) @@ -33705,15 +33667,13 @@ grammar Telemlist_(I : I) : (reftype, expr*) grammar Ttableuse_(I : I) : tableidx ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{x : idx} {{"("} {"table"} {x:Ttableidx_(I)} {")"}} => x - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod eps => `%`_tableidx(0) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telem_(I : I) : (elem, idctxt) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, PASSIVE_elemmode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - prod{`id?` : char?, rt : reftype, `e*` : expr*, x : idx, e' : expr} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {(rt, e*{e <- `e*`}):Telemlist_(I)} {x:Ttableuse_(I)} {e':Toffset_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, ACTIVE_elemmode(x, e')), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) + prod{`id?` : char?, x : idx, e' : expr, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {x:Ttableuse_(I)} {e':Toffset_(I)} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, ACTIVE_elemmode(x, e')), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`id?` : char?, rt : reftype, `e*` : expr*} {{"("} {"elem"} {?(`%`_name(lift(id?{id <- `id?`}))):Tid?{}} {"declare"} {(rt, e*{e <- `e*`}):Telemlist_(I)} {")"}} => (ELEM_elem(rt, e*{e <- `e*`}, DECLARE_elemmode), {TYPES [], TAGS [], GLOBALS [], MEMS [], TABLES [], FUNCS [], DATAS [], ELEMS [?(`%`_name(lift(id?{id <- `id?`})))], LOCALS [], LABELS [], FIELDS [], TYPEDEFS []}) @@ -33747,6 +33707,9 @@ grammar Timportdots : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`` : ()} ``:{{"("} {"import"} {Tname} {Tname} {")"}} => (``, ()).1 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec +def $dots : () + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Texporttagdots_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec @@ -33762,7 +33725,7 @@ grammar Texportglobaldots_(I : I) : () prod{`` : ()} ``:{{Texportdots*{}} Timportdots {Tglobaltype_(I)}} => (``, ()).1 ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Texportmemorydots_(I : I) : () +grammar Texportmemdots_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec prod{`` : ()} ``:{{Texportdots*{}} {Tmemtype_(I)}} => (``, ()).1 ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec @@ -33793,7 +33756,7 @@ grammar Texporttag_(I : I) : () grammar Texportglobal_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Texportmemory_(I : I) : () +grammar Texportmem_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Texporttable_(I : I) : () @@ -33802,7 +33765,7 @@ grammar Texporttable_(I : I) : () grammar Texportfunc_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec -grammar Tdatamemory_(I : I) : () +grammar Tdatamem_(I : I) : () ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec grammar Telemtable_(I : I) : () @@ -33824,13 +33787,13 @@ syntax decl = ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:226.1-226.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:258.1-258.76 def $typesd(decl*) : type* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:238.1-238.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:270.1-270.23 def $typesd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:239.1-239.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:271.1-271.48 def $typesd{type : type, `decl'*` : decl*}([(type : type <: decl)] ++ decl'*{decl' <- `decl'*`}) = [type] ++ $typesd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:240.1-240.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:272.1-272.57 def $typesd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $typesd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33838,13 +33801,13 @@ def $typesd(decl*) : type* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:227.1-227.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:259.1-259.78 def $importsd(decl*) : import* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:242.1-242.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:274.1-274.25 def $importsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:243.1-243.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:275.1-275.56 def $importsd{import : import, `decl'*` : decl*}([(import : import <: decl)] ++ decl'*{decl' <- `decl'*`}) = [import] ++ $importsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:244.1-244.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:276.1-276.61 def $importsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $importsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33852,13 +33815,13 @@ def $importsd(decl*) : import* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:228.1-228.75 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:260.1-260.75 def $tagsd(decl*) : tag* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:246.1-246.22 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:278.1-278.22 def $tagsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:247.1-247.44 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:279.1-279.44 def $tagsd{tag : tag, `decl'*` : decl*}([(tag : tag <: decl)] ++ decl'*{decl' <- `decl'*`}) = [tag] ++ $tagsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:248.1-248.55 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:280.1-280.55 def $tagsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $tagsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33866,13 +33829,13 @@ def $tagsd(decl*) : tag* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:229.1-229.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:261.1-261.78 def $globalsd(decl*) : global* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:250.1-250.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:282.1-282.25 def $globalsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:251.1-251.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:283.1-283.56 def $globalsd{global : global, `decl'*` : decl*}([(global : global <: decl)] ++ decl'*{decl' <- `decl'*`}) = [global] ++ $globalsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:252.1-252.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:284.1-284.61 def $globalsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $globalsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33880,13 +33843,13 @@ def $globalsd(decl*) : global* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:230.1-230.75 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:262.1-262.75 def $memsd(decl*) : mem* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:254.1-254.22 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:286.1-286.22 def $memsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:255.1-255.44 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:287.1-287.44 def $memsd{mem : mem, `decl'*` : decl*}([(mem : mem <: decl)] ++ decl'*{decl' <- `decl'*`}) = [mem] ++ $memsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:256.1-256.55 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:288.1-288.55 def $memsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $memsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33894,13 +33857,13 @@ def $memsd(decl*) : mem* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:231.1-231.77 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:263.1-263.77 def $tablesd(decl*) : table* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:258.1-258.24 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:290.1-290.24 def $tablesd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:259.1-259.52 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:291.1-291.52 def $tablesd{table : table, `decl'*` : decl*}([(table : table <: decl)] ++ decl'*{decl' <- `decl'*`}) = [table] ++ $tablesd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:260.1-260.59 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:292.1-292.59 def $tablesd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $tablesd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33908,13 +33871,13 @@ def $tablesd(decl*) : table* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:232.1-232.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:264.1-264.76 def $funcsd(decl*) : func* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:262.1-262.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:294.1-294.23 def $funcsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:263.1-263.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:295.1-295.48 def $funcsd{func : func, `decl'*` : decl*}([(func : func <: decl)] ++ decl'*{decl' <- `decl'*`}) = [func] ++ $funcsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:264.1-264.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:296.1-296.57 def $funcsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $funcsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33922,13 +33885,13 @@ def $funcsd(decl*) : func* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:233.1-233.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:265.1-265.76 def $datasd(decl*) : data* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:266.1-266.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:298.1-298.23 def $datasd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:267.1-267.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:299.1-299.48 def $datasd{data : data, `decl'*` : decl*}([(data : data <: decl)] ++ decl'*{decl' <- `decl'*`}) = [data] ++ $datasd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:268.1-268.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:300.1-300.57 def $datasd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $datasd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33936,13 +33899,13 @@ def $datasd(decl*) : data* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:234.1-234.76 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:266.1-266.76 def $elemsd(decl*) : elem* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:270.1-270.23 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:302.1-302.23 def $elemsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:271.1-271.48 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:303.1-303.48 def $elemsd{elem : elem, `decl'*` : decl*}([(elem : elem <: decl)] ++ decl'*{decl' <- `decl'*`}) = [elem] ++ $elemsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:272.1-272.57 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:304.1-304.57 def $elemsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $elemsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33950,13 +33913,13 @@ def $elemsd(decl*) : elem* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:235.1-235.77 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:267.1-267.77 def $startsd(decl*) : start* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:274.1-274.24 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:306.1-306.24 def $startsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:275.1-275.52 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:307.1-307.52 def $startsd{start : start, `decl'*` : decl*}([(start : start <: decl)] ++ decl'*{decl' <- `decl'*`}) = [start] ++ $startsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:276.1-276.59 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:308.1-308.59 def $startsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $startsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33964,13 +33927,13 @@ def $startsd(decl*) : start* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec rec { -;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:236.1-236.78 +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:268.1-268.78 def $exportsd(decl*) : export* - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:278.1-278.25 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:310.1-310.25 def $exportsd([]) = [] - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:279.1-279.56 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:311.1-311.56 def $exportsd{export : export, `decl'*` : decl*}([(export : export <: decl)] ++ decl'*{decl' <- `decl'*`}) = [export] ++ $exportsd(decl'*{decl' <- `decl'*`}) - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:280.1-280.61 + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec:312.1-312.61 def $exportsd{decl : decl, `decl'*` : decl*}([decl] ++ decl'*{decl' <- `decl'*`}) = $exportsd(decl'*{decl' <- `decl'*`}) -- otherwise } @@ -33978,9 +33941,8 @@ def $exportsd(decl*) : export* ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec def $ordered(decl*) : bool ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - def $ordered([]) = true - ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec - def $ordered{`decl'*` : decl*}(decl'*{decl' <- `decl'*`}) = ($importsd(decl'*{decl' <- `decl'*`}) = []) + def $ordered{`decl'*` : decl*}(decl'*{decl' <- `decl'*`}) = true + -- if ($importsd(decl'*{decl' <- `decl'*`}) = []) ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec def $ordered{`decl_1*` : decl*, import : import, `decl_2*` : decl*}(decl_1*{decl_1 <- `decl_1*`} ++ [(import : import <: decl)] ++ decl_2*{decl_2 <- `decl_2*`}) = (((((($importsd(decl_1*{decl_1 <- `decl_1*`}) = []) /\ ($tagsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($globalsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($memsd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($tablesd(decl_1*{decl_1 <- `decl_1*`}) = [])) /\ ($funcsd(decl_1*{decl_1 <- `decl_1*`}) = [])) @@ -34028,6 +33990,11 @@ grammar Tmodule : module -- if (export*{export <- `export*`} = $exportsd(decl*{decl <- `decl*`})) -- if $ordered(decl*{decl <- `decl*`}) +;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec +grammar Tdecldots_(I : I) : (decl, idctxt)* + ;; ../../../../specification/wasm-3.0/6.3-text.modules.spectec + prod{`` : (decl, idctxt)} [``]:Tdecl_(I)*{} => [``] + ;; ../../../../specification/wasm-3.0/X.1-notation.syntax.spectec syntax A = nat diff --git a/spectec/test-prose/TEST.md b/spectec/test-prose/TEST.md index f1062923d..b52a8fee8 100644 --- a/spectec/test-prose/TEST.md +++ b/spectec/test-prose/TEST.md @@ -10129,7 +10129,7 @@ The module :math:`(\mathsf{module}~{{\mathit{type}}^\ast}~{{\mathit{import}}^\as #) Return :math:`\epsilon~\rightarrow~t`. -#. Assert: Due to validation, :math:`{\mathit{blocktype}}` is some :math:`{\mathit{funcidx}}`. +#. Assert: Due to validation, :math:`{\mathit{blocktype}}` is some :math:`{\mathit{typeidx}}`. #. Let :math:`x` be the block type :math:`{\mathit{blocktype}}`. @@ -13742,8 +13742,6 @@ spectec 0.5 generator == IL Validation after pass sideconditions... == Translating to AL... == Prose Generation... -Untranslated relation Expand: `%~~%`(deftype, comptype) -Untranslated relation Expand_use: `%~~_%%`(typeuse, context, comptype) @@ -13772,6 +13770,14 @@ The number type :math:`{\mathit{numtype}}` :ref:`matches ` only itself. +The :ref:`expansion ` of :math:`{\mathit{deftype}}` is :math:`{\mathit{comptype}}` if: + + + * The composite type :math:`{\mathrm{expand}}({\mathit{deftype}})` is of the form :math:`{\mathit{comptype}}`. + + + + The vector type :math:`{\mathit{vectype}}` :ref:`matches ` only itself. @@ -14697,6 +14703,44 @@ The instruction type :math:`{t_1^\ast}~{\rightarrow}_{{x^\ast}}\,{t_2^\ast}` is +The :ref:`expansion ` of :math:`C` is :math:`{\mathit{comptype}}` if: + + + * Either: + + * The type use :math:`{\mathit{typeuse}}` is of the form :math:`{\mathit{deftype}}`. + + * The :ref:`expansion ` of :math:`{\mathit{deftype}}` is :math:`{\mathit{comptype}}`. + + * Or: + + * The type use :math:`{\mathit{typeuse}}` is of the form :math:`{\mathit{typeidx}}`. + + * The type :math:`C{.}\mathsf{types}{}[{\mathit{typeidx}}]` exists. + + * The :ref:`expansion ` of :math:`C{.}\mathsf{types}{}[{\mathit{typeidx}}]` is :math:`{\mathit{comptype}}`. + + + + +The :ref:`expansion ` of :math:`C` is :math:`{\mathit{comptype}}` if: + + + * The :ref:`expansion ` of :math:`{\mathit{deftype}}` is :math:`{\mathit{comptype}}`. + + + + +The :ref:`expansion ` of :math:`C` is :math:`{\mathit{comptype}}` if: + + + * The type :math:`C{.}\mathsf{types}{}[{\mathit{typeidx}}]` exists. + + * The :ref:`expansion ` of :math:`C{.}\mathsf{types}{}[{\mathit{typeidx}}]` is :math:`{\mathit{comptype}}`. + + + + The limits range :math:`{}[ n .. {m^?} ]` is :ref:`valid ` within :math:`k` if: @@ -15145,6 +15189,16 @@ The value type :math:`t` is defaultable if: +:math:`\{ \mathsf{align}~n,\;\allowbreak \mathsf{offset}~m \}` is valid for :math:`{\mathit{at}}` and :math:`N` if: + + + * :math:`{2^{n}}` is less than or equal to :math:`N / 8`. + + * :math:`m` is less than :math:`{2^{{|{\mathit{at}}|}}}`. + + + + The instruction :math:`\mathsf{nop}` is :ref:`valid ` with the instruction type :math:`\epsilon~\rightarrow~\epsilon`. @@ -15991,7 +16045,7 @@ The instruction :math:`({{\mathit{nt}}{.}\mathsf{load}}{{{\mathit{loadop}}^?}}~x * The value type :math:`{\mathit{valtype}}` is of the form :math:`{\mathit{nt}}`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`{|{\mathit{nt}}|} / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`{|{\mathit{nt}}|}`. * Or: @@ -16001,7 +16055,7 @@ The instruction :math:`({{\mathit{nt}}{.}\mathsf{load}}{{{\mathit{loadop}}^?}}~x * The value type :math:`{\mathit{valtype}}` is of the form :math:`{\mathsf{i}}{N}`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`M / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`M`. @@ -16019,7 +16073,7 @@ The instruction :math:`({{\mathit{nt}}{.}\mathsf{store}}{{{\mathit{storeop}}^?}} * The value type :math:`{\mathit{valtype}}` is of the form :math:`{\mathit{nt}}`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`{|{\mathit{nt}}|} / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`{|{\mathit{nt}}|}`. * Or: @@ -16029,7 +16083,7 @@ The instruction :math:`({{\mathit{nt}}{.}\mathsf{store}}{{{\mathit{storeop}}^?}} * The value type :math:`{\mathit{valtype}}` is of the form :math:`{\mathsf{i}}{N}`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`M / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`M`. @@ -16045,23 +16099,23 @@ The instruction :math:`({\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{{{\mathit * :math:`{{\mathit{vloadop}}^?}` is absent. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`{|\mathsf{v{\scriptstyle 128}}|} / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`{|\mathsf{v{\scriptstyle 128}}|}`. * Or: * :math:`{{\mathit{vloadop}}^?}` is of the form :math:`({M}{\mathsf{x}}{N}{\mathsf{\_}}{{\mathit{sx}}})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`M / 8 \cdot N`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`M \cdot N`. * Or: * :math:`{{\mathit{vloadop}}^?}` is of the form :math:`({N}{\mathsf{\_}}{\mathsf{splat}})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`N / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`N`. * Or: * :math:`{{\mathit{vloadop}}^?}` is of the form :math:`({N}{\mathsf{\_}}{\mathsf{zero}})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`N / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`N`. @@ -16073,7 +16127,7 @@ The instruction :math:`({\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{N}{\maths * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`N / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`N`. * :math:`i` is less than :math:`128 / N`. @@ -16087,7 +16141,7 @@ The instruction :math:`(\mathsf{v{\scriptstyle 128}}{.}\mathsf{store}~x~{\mathit * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`{|\mathsf{v{\scriptstyle 128}}|} / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`{|\mathsf{v{\scriptstyle 128}}|}`. @@ -16099,7 +16153,7 @@ The instruction :math:`({\mathsf{v{\scriptstyle 128}}{.}\mathsf{store}}{N}{\math * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`N / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`N`. * :math:`i` is less than :math:`128 / N`. @@ -16291,7 +16345,7 @@ The instruction :math:`({\mathit{nt}}{.}\mathsf{load}~x~{\mathit{memarg}})` is : * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`{|{\mathit{nt}}|} / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`{|{\mathit{nt}}|}`. @@ -16303,7 +16357,7 @@ The instruction :math:`({{\mathsf{i}}{N}{.}\mathsf{load}}{{M}{\mathsf{\_}}{{\mat * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`M / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`M`. @@ -16315,7 +16369,7 @@ The instruction :math:`({\mathit{nt}}{.}\mathsf{store}~x~{\mathit{memarg}})` is * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`{|{\mathit{nt}}|} / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`{|{\mathit{nt}}|}`. @@ -16327,7 +16381,7 @@ The instruction :math:`({{\mathsf{i}}{N}{.}\mathsf{store}}{M}~x~{\mathit{memarg} * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`M / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`M`. @@ -16339,7 +16393,7 @@ The instruction :math:`(\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}~x~{\mathit{ * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`{|\mathsf{v{\scriptstyle 128}}|} / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`{|\mathsf{v{\scriptstyle 128}}|}`. @@ -16351,7 +16405,7 @@ The instruction :math:`({\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{{M}{\math * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`M / 8 \cdot N`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`M \cdot N`. @@ -16363,7 +16417,7 @@ The instruction :math:`({\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{{N}{\math * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`N / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`N`. @@ -16375,7 +16429,7 @@ The instruction :math:`({\mathsf{v{\scriptstyle 128}}{.}\mathsf{load}}{{N}{\math * The memory :math:`C{.}\mathsf{mems}{}[x]` is of the form :math:`({\mathit{at}}~{\mathit{lim}}~\mathsf{page})`. - * :math:`{2^{{\mathit{memarg}}{.}\mathsf{align}}}` is less than or equal to :math:`N / 8`. + * :math:`{\mathit{memarg}}` is valid for :math:`{\mathit{at}}` and :math:`N`. @@ -18686,7 +18740,7 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Pop the value :math:`(\mathsf{v{\scriptstyle 128}}{.}\mathsf{const}~c_1)` from the stack. -#. Let :math:`c` be :math:`{{\mathrm{ine}}}_{{|\mathsf{v{\scriptstyle 128}}|}}(c_1, 0)`. +#. Let :math:`c` be :math:`{{\mathrm{inez}}}_{{|\mathsf{v{\scriptstyle 128}}|}}(c_1)`. #. Push the value :math:`(\mathsf{i{\scriptstyle 32}}{.}\mathsf{const}~c)` to the stack. @@ -18754,17 +18808,19 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Push the value :math:`(\mathsf{v{\scriptstyle 128}}{.}\mathsf{const}~c)` to the stack. -:math:`{\mathit{sh}} {.} {\mathit{vtestop}}` -............................................ +:math:`{{\mathsf{i}}{N}}{\mathsf{x}}{M} {.} \mathsf{all\_true}` +............................................................... 1. Assert: Due to validation, a value of vector type :math:`\mathsf{v{\scriptstyle 128}}` is on the top of the stack. #. Pop the value :math:`(\mathsf{v{\scriptstyle 128}}{.}\mathsf{const}~c_1)` from the stack. -#. Let :math:`i` be :math:`{{\mathit{vtestop}}}{{}_{{\mathit{sh}}}(c_1)}`. +#. Let :math:`{i^\ast}` be :math:`{{\mathrm{lanes}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}(c_1)`. + +#. Let :math:`c` be :math:`{\Pi}\, {{{\mathrm{inez}}}_{N}(i)^\ast}`. -#. Push the value :math:`(\mathsf{i{\scriptstyle 32}}{.}\mathsf{const}~i)` to the stack. +#. Push the value :math:`(\mathsf{i{\scriptstyle 32}}{.}\mathsf{const}~c)` to the stack. :math:`{\mathit{sh}} {.} {\mathit{vrelop}}` @@ -19272,7 +19328,7 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #) Execute the instruction :math:`\mathsf{throw\_ref}`. - #) Else if not the first non-value entry of the stack is a :math:`\mathsf{handler}`, then: + #) Else if the first non-value entry of the stack is not a :math:`\mathsf{handler}`, then: a) Throw the exception :math:`{\mathit{val}'}` as a result. @@ -19424,11 +19480,11 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Else: - a. Assert: Due to validation, not the first non-value entry of the stack is a :math:`\mathsf{label}`. + a. Assert: Due to validation, the first non-value entry of the stack is not a :math:`\mathsf{label}`. - #. Assert: Due to validation, not the first non-value entry of the stack is a :math:`\mathsf{frame}`. + #. Assert: Due to validation, the first non-value entry of the stack is not a :math:`\mathsf{frame}`. - #. Assert: Due to validation, not the first non-value entry of the stack is a :math:`\mathsf{handler}`. + #. Assert: Due to validation, the first non-value entry of the stack is not a :math:`\mathsf{handler}`. #. Throw the exception :math:`{\mathit{val}'}` as a result. @@ -22680,11 +22736,11 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Return :math:`{\mathrm{free}}_{\mathit{opt}}({{\mathrm{free}}_{\mathit{valtype}}({\mathit{valtype}})^?})`. -#. Assert: Due to validation, :math:`{\mathit{blocktype}}` is some :math:`{\mathit{funcidx}}`. +#. Assert: Due to validation, :math:`{\mathit{blocktype}}` is some :math:`{\mathit{typeidx}}`. -#. Let :math:`{\mathit{funcidx}}` be the block type :math:`{\mathit{blocktype}}`. +#. Let :math:`{\mathit{typeidx}}` be the block type :math:`{\mathit{blocktype}}`. -#. Return :math:`{\mathrm{free}}_{\mathit{funcidx}}({\mathit{funcidx}})`. +#. Return :math:`{\mathrm{free}}_{\mathit{typeidx}}({\mathit{typeidx}})`. :math:`{\mathrm{shift}}_{\mathit{labelidxs}}({{\mathit{labelidx}''}^\ast})` @@ -24559,40 +24615,6 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Return :math:`{{{{{\mathrm{lanes}}}_{{{\mathsf{f}}{N}}{\mathsf{x}}{M}}^{{-1}}}}{({c^\ast})}^\ast}`. -:math:`{{\mathrm{ivtestop}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}({\mathrm{f}}, v_1)` -................................................................................... - - -1. Let :math:`{c_1^\ast}` be :math:`{{\mathrm{lanes}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}(v_1)`. - -#. Let :math:`{c^\ast}` be :math:`\epsilon`. - -#. For each :math:`c_1` in :math:`{c_1^\ast}`, do: - - a. Let :math:`c` be :math:`{{\mathrm{f}}}_{N}(c_1)`. - - #. Append :math:`c` to :math:`{c^\ast}`. - -#. Return :math:`{\Pi}\, {c^\ast}`. - - -:math:`{{\mathrm{fvtestop}}}_{{{\mathsf{f}}{N}}{\mathsf{x}}{M}}({\mathrm{f}}, v_1)` -................................................................................... - - -1. Let :math:`{c_1^\ast}` be :math:`{{\mathrm{lanes}}}_{{{\mathsf{f}}{N}}{\mathsf{x}}{M}}(v_1)`. - -#. Let :math:`{c^\ast}` be :math:`\epsilon`. - -#. For each :math:`c_1` in :math:`{c_1^\ast}`, do: - - a. Let :math:`c` be :math:`{{\mathrm{f}}}_{N}(c_1)`. - - #. Append :math:`c` to :math:`{c^\ast}`. - -#. Return :math:`{\Pi}\, {c^\ast}`. - - :math:`{{\mathrm{ivrelop}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}({\mathrm{f}}, v_1, v_2)` ....................................................................................... @@ -24935,13 +24957,6 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Return :math:`{{\mathrm{fvternop}}}_{{{\mathit{lanetype}}}{\mathsf{x}}{M}}({\mathrm{frelaxed}}_{{\mathit{nmadd}}}, v_1, v_2, v_3)`. -:math:`{\mathsf{all\_true}}{{}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}(v)}` -...................................................................... - - -1. Return :math:`{{\mathrm{ivtestop}}}_{{{\mathsf{i}}{N}}{\mathsf{x}}{M}}({\mathrm{inez}}, v)`. - - :math:`{{\mathit{vrelop}}}{{}_{{{\mathit{lanetype}}}{\mathsf{x}}{M}}(v_1, v_2)}` ................................................................................ @@ -25784,7 +25799,7 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i ........................................................ -1. If :math:`{\mathit{blocktype}}` is some :math:`{\mathit{funcidx}}`, then: +1. If :math:`{\mathit{blocktype}}` is some :math:`{\mathit{typeidx}}`, then: a. Let :math:`x` be the block type :math:`{\mathit{blocktype}}`. @@ -26488,8 +26503,8 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i #. Return :math:`{{\mathit{val}'}^{k}}`. -:math:`{\mathrm{concat}}_{\mathit{idctxt}}({{\mathit{idctxt}}^\ast})` -..................................................................... +:math:`{\bigoplus}\, {{\mathit{idctxt}}^\ast}` +.............................................. 1. If :math:`{{\mathit{idctxt}}^\ast} = \epsilon`, then: @@ -26648,12 +26663,10 @@ The instruction sequence :math:`(\mathsf{block}~{\mathit{blocktype}}~{{\mathit{i .................................................. -1. If :math:`{{\mathit{decl}}^\ast} = \epsilon`, then: +1. If :math:`{\mathrm{imports}}({{\mathit{decl}}^\ast}) = \epsilon`, then: a. Return true. -#. Return :math:`{\mathrm{imports}}({{\mathit{decl}}^\ast}) = \epsilon`. - #. Assert: Due to validation, YetE: Nondeterministic assignment target: decl_1*{decl_1 <- decl_1*} :: [import] :: decl_2*{decl_2 <- decl_2*}. #. Let :math:`{{\mathit{decl}}_1^\ast}~{\mathit{import}}~{{\mathit{decl}}_2^\ast}` be :math:`{{\mathit{decl}}^\ast}`. @@ -26713,8 +26726,6 @@ spectec 0.5 generator == IL Validation after pass sideconditions... == Translating to AL... == Prose Generation... -Untranslated relation Expand: `%~~%`(deftype, comptype) -Untranslated relation Expand_use: `%~~_%%`(typeuse, context, comptype) Numtype_ok - the number type numtype is always valid. @@ -26730,8 +26741,12 @@ Packtype_sub Numtype_sub - numtype matches only itself. +Expand +- The :ref:`expansion ` of deftype is comptype if: + - the composite type $expanddt(deftype) is comptype. + Vectype_sub -- vectype matches only itself. +- the vector type vectype matches only itself. Heaptype_ok - the heap type heaptype is valid if: @@ -27210,6 +27225,25 @@ Instrtype_ok - For all x in x*: - the local C.LOCALS[x] exists. +Expand_use +- The :ref:`expansion ` of C is comptype if: + - Either: + - the type use typeuse is deftype. + - The :ref:`expansion ` of deftype is comptype. + - Or: + - typeuse is (_IDX typeidx). + - the type C.TYPES[typeidx] exists. + - The :ref:`expansion ` of C.TYPES[typeidx] is comptype. + +Expand_use/deftype +- The :ref:`expansion ` of C is comptype if: + - The :ref:`expansion ` of deftype is comptype. + +Expand_use/typeidx +- The :ref:`expansion ` of C is comptype if: + - the type C.TYPES[typeidx] exists. + - The :ref:`expansion ` of C.TYPES[typeidx] is comptype. + Limits_ok - the limits range ([ n .. m? ]) is valid within k if: - n is less than or equal to k. @@ -27438,6 +27472,11 @@ Defaultable - the value type t is defaultable if: - the value $default_(t) is not ?(). +Memarg_ok +- { ALIGN: n; OFFSET: m } is valid for at and N if: + - (2 ^ n) is less than or equal to (N / 8). + - m is less than (2 ^ $size(at)). + Instr_ok/nop - the instruction NOP is valid with the instruction type [] -> []. @@ -27864,12 +27903,12 @@ Instr_ok/load - Either: - loadop_? is ?(). - the value type valtype is nt. - - (2 ^ memarg.ALIGN) is less than or equal to ($size(nt) / 8). + - memarg is valid for at and $size(nt). - Or: - the number type nt is Inn. - loadop_? is ?(M _ sx). - valtype is Inn. - - (2 ^ memarg.ALIGN) is less than or equal to (M / 8). + - memarg is valid for at and M. Instr_ok/store - the instruction (STORE nt storeop_? x memarg) is valid with the instruction type [at, valtype] -> [] if: @@ -27878,12 +27917,12 @@ Instr_ok/store - Either: - storeop_? is ?(). - the value type valtype is nt. - - (2 ^ memarg.ALIGN) is less than or equal to ($size(nt) / 8). + - memarg is valid for at and $size(nt). - Or: - the number type nt is Inn. - storeop_? is ?(M). - valtype is Inn. - - (2 ^ memarg.ALIGN) is less than or equal to (M / 8). + - memarg is valid for at and M. Instr_ok/vload - the instruction (VLOAD V128 vloadop_? x memarg) is valid with the instruction type [at] -> [V128] if: @@ -27891,35 +27930,35 @@ Instr_ok/vload - C.MEMS[x] is at lim PAGE. - Either: - vloadop_? is ?(). - - (2 ^ memarg.ALIGN) is less than or equal to ($vsize(V128) / 8). + - memarg is valid for at and $vsize(V128). - Or: - vloadop_? is ?((SHAPE M X N _ sx)). - - (2 ^ memarg.ALIGN) is less than or equal to ((M / 8) * N). + - memarg is valid for at and (M * N). - Or: - vloadop_? is ?((SPLAT N)). - - (2 ^ memarg.ALIGN) is less than or equal to (N / 8). + - memarg is valid for at and N. - Or: - vloadop_? is ?((ZERO N)). - - (2 ^ memarg.ALIGN) is less than or equal to (N / 8). + - memarg is valid for at and N. Instr_ok/vload_lane - the instruction (VLOAD_LANE V128 N x memarg i) is valid with the instruction type [at, V128] -> [V128] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to (N / 8). + - memarg is valid for at and N. - i is less than (128 / N). Instr_ok/vstore - the instruction (VSTORE V128 x memarg) is valid with the instruction type [at, V128] -> [] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to ($vsize(V128) / 8). + - memarg is valid for at and $vsize(V128). Instr_ok/vstore_lane - the instruction (VSTORE_LANE V128 N x memarg i) is valid with the instruction type [at, V128] -> [] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to (N / 8). + - memarg is valid for at and N. - i is less than (128 / N). Instr_ok/const @@ -28027,49 +28066,49 @@ Instr_ok/load-val - the instruction (LOAD nt ?() x memarg) is valid with the instruction type [at] -> [nt] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to ($size(nt) / 8). + - memarg is valid for at and $size(nt). Instr_ok/load-pack - the instruction (LOAD Inn ?(M _ sx) x memarg) is valid with the instruction type [at] -> [Inn] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to (M / 8). + - memarg is valid for at and M. Instr_ok/store-val - the instruction (STORE nt ?() x memarg) is valid with the instruction type [at, nt] -> [] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to ($size(nt) / 8). + - memarg is valid for at and $size(nt). Instr_ok/store-pack - the instruction (STORE Inn ?(M) x memarg) is valid with the instruction type [at, Inn] -> [] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to (M / 8). + - memarg is valid for at and M. Instr_ok/vload-val - the instruction (VLOAD V128 ?() x memarg) is valid with the instruction type [at] -> [V128] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to ($vsize(V128) / 8). + - memarg is valid for at and $vsize(V128). Instr_ok/vload-pack - the instruction (VLOAD V128 ?((SHAPE M X N _ sx)) x memarg) is valid with the instruction type [at] -> [V128] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to ((M / 8) * N). + - memarg is valid for at and (M * N). Instr_ok/vload-splat - the instruction (VLOAD V128 ?((SPLAT N)) x memarg) is valid with the instruction type [at] -> [V128] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to (N / 8). + - memarg is valid for at and N. Instr_ok/vload-zero - the instruction (VLOAD V128 ?((ZERO N)) x memarg) is valid with the instruction type [at] -> [V128] if: - the memory C.MEMS[x] exists. - C.MEMS[x] is at lim PAGE. - - (2 ^ memarg.ALIGN) is less than or equal to (N / 8). + - memarg is valid for at and N. Instrs_ok - the instruction sequence instr* is valid with the instruction type it if: @@ -29216,7 +29255,7 @@ Step_pure/vvternop V128 vvternop Step_pure/vvtestop V128 ANY_TRUE 1. Assert: Due to validation, a value of value type V128 is on the top of the stack. 2. Pop the value (V128.CONST c_1) from the stack. -3. Let c be $ine_($vsize(V128), c_1, 0). +3. Let c be $inez_($vsize(V128), c_1). 4. Push the value (I32.CONST c) to the stack. Step_pure/vunop sh vunop @@ -29249,11 +29288,12 @@ Step_pure/vternop sh vternop 8. Let c be an element of $vternop_(sh, vternop, c_1, c_2, c_3). 9. Push the value (V128.CONST c) to the stack. -Step_pure/vtestop sh vtestop +Step_pure/vtestop Jnn X M ALL_TRUE 1. Assert: Due to validation, a value of value type V128 is on the top of the stack. 2. Pop the value (V128.CONST c_1) from the stack. -3. Let i be $vtestop_(sh, vtestop, c_1). -4. Push the value (I32.CONST i) to the stack. +3. Let i* be $lanes_(Jnn X M, c_1). +4. Let c be $prod($inez_($jsizenn(Jnn), i)*). +5. Push the value (I32.CONST c) to the stack. Step_pure/vrelop sh vrelop 1. Assert: Due to validation, a value of value type V128 is on the top of the stack. @@ -29491,7 +29531,7 @@ Step_read/throw_ref 1) Pop the frame (FRAME_ _ { _ }) from the stack. 2) Push the value (REF.EXN_ADDR a) to the stack. 3) Execute the instruction THROW_REF. - f. Else if not the first non-value entry of the stack is a HANDLER_, then: + f. Else if the first non-value entry of the stack is not a HANDLER_, then: 1) Throw the exception val' as a result. g. Else: 1) Let (HANDLER_ n { catch''* }) be the topmost HANDLER_. @@ -29560,9 +29600,9 @@ Step_read/throw_ref 3. Push the value (REF.EXN_ADDR a) to the stack. 4. Execute the instruction (BR l). 6. Else: - a. Assert: Due to validation, not the first non-value entry of the stack is a LABEL_. - b. Assert: Due to validation, not the first non-value entry of the stack is a FRAME_. - c. Assert: Due to validation, not the first non-value entry of the stack is a HANDLER_. + a. Assert: Due to validation, the first non-value entry of the stack is not a LABEL_. + b. Assert: Due to validation, the first non-value entry of the stack is not a FRAME_. + c. Assert: Due to validation, the first non-value entry of the stack is not a HANDLER_. d. Throw the exception val' as a result. Step_read/try_table bt catch* instr* @@ -31085,8 +31125,8 @@ free_blocktype blocktype a. Let (_RESULT valtype?) be blocktype. b. Return $free_opt($free_valtype(valtype)?). 2. Assert: Due to validation, blocktype is some _IDX. -3. Let (_IDX funcidx) be blocktype. -4. Return $free_funcidx(funcidx). +3. Let (_IDX typeidx) be blocktype. +4. Return $free_typeidx(typeidx). shift_labelidxs labelidx''* 1. If (labelidx''* = []), then: @@ -31982,22 +32022,6 @@ fvternop_ Fnn X M $f_ v_1 v_2 v_3 4. Let c** be $setproduct_(`lane_((Fnn : Fnn <: lanetype)), $f_($sizenn(Fnn), c_1, c_2, c_3)*). 5. Return $inv_lanes_(Fnn X M, c*)*. -ivtestop_ Jnn X M $f_ v_1 -1. Let c_1* be $lanes_(Jnn X M, v_1). -2. Let c* be []. -3. For each c_1 in c_1*, do: - a. Let c be $f_($lsizenn(Jnn), c_1). - b. Append c to the c*. -4. Return $prod(c*). - -fvtestop_ Fnn X M $f_ v_1 -1. Let c_1* be $lanes_(Fnn X M, v_1). -2. Let c* be []. -3. For each c_1 in c_1*, do: - a. Let c be $f_($sizenn(Fnn), c_1). - b. Append c to the c*. -4. Return $prod(c*). - ivrelop_ Jnn X M $f_ v_1 v_2 1. Let c_1* be $lanes_(Jnn X M, v_1). 2. Let c_2* be $lanes_(Jnn X M, v_2). @@ -32162,9 +32186,6 @@ vternop_ lanetype X M vternop_ v_1 v_2 v_3 4. Assert: Due to validation, (vternop_ = RELAXED_NMADD). 5. Return $fvternop_(lanetype X M, $frelaxed_nmadd_, v_1, v_2, v_3). -vtestop_ Jnn X M ALL_TRUE v -1. Return $ivtestop_(Jnn X M, $inez_, v). - vrelop_ lanetype X M vrelop_ v_1 v_2 1. If lanetype is Jnn, then: a. If (vrelop_ = EQ), then: @@ -32954,12 +32975,11 @@ exportsd decl'* 3. Return [export] :: $exportsd(decl'*). ordered decl* -1. If (decl* = []), then: +1. If ($importsd(decl*) = []), then: a. Return true. -2. Return ($importsd(decl*) = []). -3. Assert: Due to validation, YetE (Nondeterministic assignment target: decl_1*{decl_1 <- decl_1*} :: [import] :: decl_2*{decl_2 <- decl_2*}). -4. Let decl_1* :: [import] :: decl_2* be decl*. -5. Return (((((($importsd(decl_1*) = []) /\ ($tagsd(decl_1*) = [])) /\ ($globalsd(decl_1*) = [])) /\ ($memsd(decl_1*) = [])) /\ ($tablesd(decl_1*) = [])) /\ ($funcsd(decl_1*) = [])). +2. Assert: Due to validation, YetE (Nondeterministic assignment target: decl_1*{decl_1 <- decl_1*} :: [import] :: decl_2*{decl_2 <- decl_2*}). +3. Let decl_1* :: [import] :: decl_2* be decl*. +4. Return (((((($importsd(decl_1*) = []) /\ ($tagsd(decl_1*) = [])) /\ ($globalsd(decl_1*) = [])) /\ ($memsd(decl_1*) = [])) /\ ($tablesd(decl_1*) = [])) /\ ($funcsd(decl_1*) = [])). allocXs `X `Y s X''* Y''* 1. If (X''* = []), then: diff --git a/spectec/test-splice/TEST.md b/spectec/test-splice/TEST.md index a15b06f2f..3995aa014 100644 --- a/spectec/test-splice/TEST.md +++ b/spectec/test-splice/TEST.md @@ -9,8 +9,6 @@ $ (../src/exe-spectec/main.exe ../../../../specification/wasm-3.0/*.spectec -l - == IL Validation after pass sideconditions... == Translating to AL... == Prose Generation... -Untranslated relation Expand: `%~~%`(deftype, comptype) -Untranslated relation Expand_use: `%~~_%%`(typeuse, context, comptype) == Splicing... \documentclass[a4paper]{scrartcl} @@ -59,7 +57,6 @@ $$ & & | & \mathsf{block}~{\mathit{blocktype}}~{{\mathit{instr}}^\ast} \\ & & | & \mathsf{loop}~{\mathit{blocktype}}~{{\mathit{instr}}^\ast} \\ & & | & \mathsf{if}~{\mathit{blocktype}}~{{\mathit{instr}}^\ast}~\mathsf{else}~{{\mathit{instr}}^\ast} \\ -& & | & \dots \\ \end{array} $$ @@ -87,8 +84,7 @@ $$ & & | & \mathsf{memory{.}grow}~{\mathit{memidx}} \\ & & | & \mathsf{memory{.}fill}~{\mathit{memidx}} \\ & & | & \mathsf{memory{.}copy}~{\mathit{memidx}}~{\mathit{memidx}} \\ -& & | & \mathsf{memory{.}init}~{\mathit{memidx}}~{\mathit{dataidx}} \\ -& & | & \dots \\[0.8ex] +& & | & \mathsf{memory{.}init}~{\mathit{memidx}}~{\mathit{dataidx}} \\[0.8ex] & {\mathit{expr}} & ::= & {{\mathit{instr}}^\ast} \\ \end{array} $$ @@ -187,7 +183,7 @@ C \vdash {\mathit{bt}} : {t_1^\ast} \rightarrow {t_2^\ast} \{ \mathsf{labels}~({t_2^\ast}) \} \oplus C \vdash {{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow_{{x^\ast}} {t_2^\ast} }{ C \vdash \mathsf{block}~{\mathit{bt}}~{{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}block}]} +} \, {[\textsc{\scriptsize T{-}instr{-}block}]} \qquad \end{array} $$ @@ -200,7 +196,7 @@ C \vdash {\mathit{bt}} : {t_1^\ast} \rightarrow {t_2^\ast} \{ \mathsf{labels}~({t_1^\ast}) \} \oplus C \vdash {{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow_{{x^\ast}} {t_2^\ast} }{ C \vdash \mathsf{loop}~{\mathit{bt}}~{{\mathit{instr}}^\ast} : {t_1^\ast} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}loop}]} +} \, {[\textsc{\scriptsize T{-}instr{-}loop}]} \qquad \end{array} $$ @@ -215,7 +211,7 @@ C \vdash {\mathit{bt}} : {t_1^\ast} \rightarrow {t_2^\ast} \{ \mathsf{labels}~({t_2^\ast}) \} \oplus C \vdash {{\mathit{instr}}_2^\ast} : {t_1^\ast} \rightarrow_{{x_2^\ast}} {t_2^\ast} }{ C \vdash \mathsf{if}~{\mathit{bt}}~{{\mathit{instr}}_1^\ast}~\mathsf{else}~{{\mathit{instr}}_2^\ast} : {t_1^\ast}~\mathsf{i{\scriptstyle 32}} \rightarrow {t_2^\ast} -} \, {[\textsc{\scriptsize T{-}if}]} +} \, {[\textsc{\scriptsize T{-}instr{-}if}]} \qquad \end{array} $$ @@ -693,7 +689,7 @@ warning: grammar `Tannot` was never spliced warning: grammar `Tannotid` was never spliced warning: grammar `Tblockchar` was never spliced warning: grammar `Tblockcomment` was never spliced -warning: grammar `Tblockinstr_` was never spliced +warning: grammar `Tblockinstr_/plain` was never spliced warning: grammar `Tblockinstr_/abbrev` was never spliced warning: grammar `Tblocktype_` was never spliced warning: grammar `Tcatch_` was never spliced @@ -702,15 +698,17 @@ warning: grammar `Tcomment` was never spliced warning: grammar `Tcomptype_` was never spliced warning: grammar `Tdata_` was never spliced warning: grammar `Tdataidx_` was never spliced -warning: grammar `Tdatamemory_/abbrev` was never spliced +warning: grammar `Tdatamem_/abbrev` was never spliced warning: grammar `Tdatastring` was never spliced warning: grammar `Tdecl_` was never spliced +warning: grammar `Tdecldots_` was never spliced warning: grammar `Tdigit` was never spliced -warning: grammar `Telem_` was never spliced -warning: grammar `Telemexpr_` was never spliced +warning: grammar `Telem_/plain` was never spliced +warning: grammar `Telem_/abbrev` was never spliced +warning: grammar `Telemexpr_/plain` was never spliced warning: grammar `Telemexpr_/abbrev` was never spliced warning: grammar `Telemidx_` was never spliced -warning: grammar `Telemlist_` was never spliced +warning: grammar `Telemlist_/plain` was never spliced warning: grammar `Telemlist_/abbrev` was never spliced warning: grammar `Telemtable_/abbrev` was never spliced warning: grammar `Teof` was never spliced @@ -720,8 +718,8 @@ warning: grammar `Texportfunc_/abbrev` was never spliced warning: grammar `Texportfuncdots_` was never spliced warning: grammar `Texportglobal_/abbrev` was never spliced warning: grammar `Texportglobaldots_` was never spliced -warning: grammar `Texportmemory_/abbrev` was never spliced -warning: grammar `Texportmemorydots_` was never spliced +warning: grammar `Texportmem_/abbrev` was never spliced +warning: grammar `Texportmemdots_` was never spliced warning: grammar `Texporttable_/abbrev` was never spliced warning: grammar `Texporttabledots_` was never spliced warning: grammar `Texporttag_/abbrev` was never spliced @@ -764,11 +762,15 @@ warning: grammar `TiN` was never spliced warning: grammar `Tid` was never spliced warning: grammar `Tidchar` was never spliced warning: grammar `Tidx_` was never spliced -warning: grammar `Timport_` was never spliced -warning: grammar `Timport_/abbrev` was never spliced +warning: grammar `Timport_/plain` was never spliced +warning: grammar `Timport_/abbrev-tag` was never spliced +warning: grammar `Timport_/abbrev-global` was never spliced +warning: grammar `Timport_/abbrev-mem` was never spliced +warning: grammar `Timport_/abbrev-table` was never spliced +warning: grammar `Timport_/abbrev-func` was never spliced warning: grammar `Timportdots` was never spliced warning: grammar `Tinstr_` was never spliced -warning: grammar `Tinstrs_` was never spliced +warning: grammar `Tinstrs_/unfolded` was never spliced warning: grammar `Tinstrs_/folded` was never spliced warning: grammar `Tkeyword` was never spliced warning: grammar `Tlabel_` was never spliced @@ -778,7 +780,7 @@ warning: grammar `Tlimits` was never spliced warning: grammar `Tlinechar` was never spliced warning: grammar `Tlinecomment` was never spliced warning: grammar `Tlist` was never spliced -warning: grammar `Tlocal_` was never spliced +warning: grammar `Tlocal_/plain` was never spliced warning: grammar `Tlocal_/abbrev` was never spliced warning: grammar `Tlocalidx_` was never spliced warning: grammar `Tmant` was never spliced @@ -786,9 +788,9 @@ warning: grammar `Tmem_` was never spliced warning: grammar `Tmemarg_` was never spliced warning: grammar `Tmemidx_` was never spliced warning: grammar `Tmemtype_` was never spliced -warning: grammar `Tmemuse_` was never spliced +warning: grammar `Tmemuse_/plain` was never spliced warning: grammar `Tmemuse_/abbrev` was never spliced -warning: grammar `Tmodule` was never spliced +warning: grammar `Tmodule/plain` was never spliced warning: grammar `Tmodule/abbrev` was never spliced warning: grammar `Tname` was never spliced warning: grammar `Tnewline` was never spliced @@ -796,23 +798,23 @@ warning: grammar `Tnull` was never spliced warning: grammar `Tnum` was never spliced warning: grammar `Tnumtype` was never spliced warning: grammar `Toffset` was never spliced -warning: grammar `Toffset_` was never spliced +warning: grammar `Toffset_/plain` was never spliced warning: grammar `Toffset_/abbrev` was never spliced warning: grammar `Tpacktype` was never spliced warning: grammar `Tparam_/base` was never spliced warning: grammar `Tparam_/abbrev` was never spliced warning: grammar `Tplaininstr_/parametric` was never spliced warning: grammar `Tplaininstr_/br` was never spliced -warning: grammar `Tplaininstr_/func` was never spliced -warning: grammar `Tplaininstr_/func/abbrev` was never spliced +warning: grammar `Tplaininstr_/func-plain` was never spliced +warning: grammar `Tplaininstr_/func-abbrev` was never spliced warning: grammar `Tplaininstr_/exn` was never spliced warning: grammar `Tplaininstr_/local` was never spliced warning: grammar `Tplaininstr_/global` was never spliced -warning: grammar `Tplaininstr_/table` was never spliced -warning: grammar `Tplaininstr_/table/abbrev` was never spliced +warning: grammar `Tplaininstr_/table-plain` was never spliced +warning: grammar `Tplaininstr_/table-abbrev` was never spliced warning: grammar `Tplaininstr_/elem` was never spliced -warning: grammar `Tplaininstr_/memory` was never spliced -warning: grammar `Tplaininstr_/memory/abbrev` was never spliced +warning: grammar `Tplaininstr_/memory-plain` was never spliced +warning: grammar `Tplaininstr_/memory-abbrev` was never spliced warning: grammar `Tplaininstr_/data` was never spliced warning: grammar `Tplaininstr_/ref` was never spliced warning: grammar `Tplaininstr_/i31` was never spliced @@ -918,11 +920,11 @@ warning: grammar `Tsubtype_/abbrev` was never spliced warning: grammar `Tsym` was never spliced warning: grammar `Tsymsplit/1` was never spliced warning: grammar `Tsymsplit/2` was never spliced -warning: grammar `Ttable_` was never spliced +warning: grammar `Ttable_/plain` was never spliced warning: grammar `Ttable_/abbrev` was never spliced warning: grammar `Ttableidx_` was never spliced warning: grammar `Ttabletype_` was never spliced -warning: grammar `Ttableuse_` was never spliced +warning: grammar `Ttableuse_/plain` was never spliced warning: grammar `Ttableuse_/abbrev` was never spliced warning: grammar `Ttag_` was never spliced warning: grammar `Ttagidx_` was never spliced @@ -1152,6 +1154,7 @@ warning: rule `Limits_sub` was never spliced warning: rule `Local_ok/set` was never spliced warning: rule `Local_ok/unset` was never spliced warning: rule `Mem_ok` was never spliced +warning: rule `Memarg_ok` was never spliced warning: rule `Memtype_ok` was never spliced warning: rule `Memtype_sub` was never spliced warning: rule `Module_ok` was never spliced @@ -1517,6 +1520,7 @@ warning: definition `demote__` was never spliced warning: definition `diffrt` was never spliced warning: definition `dim` was never spliced warning: definition `disjoint_` was never spliced +warning: definition `dots` was never spliced warning: definition `elem` was never spliced warning: definition `eleminst` was never spliced warning: definition `elemsd` was never spliced @@ -1626,7 +1630,6 @@ warning: definition `funcsxx` was never spliced warning: definition `fvbinop_` was never spliced warning: definition `fvrelop_` was never spliced warning: definition `fvternop_` was never spliced -warning: definition `fvtestop_` was never spliced warning: definition `fvunop_` was never spliced warning: definition `fzero` was never spliced warning: definition `global` was never spliced @@ -1725,7 +1728,6 @@ warning: definition `ivshiftopsx_` was never spliced warning: definition `ivshufflop_` was never spliced warning: definition `ivswizzlop_` was never spliced warning: definition `ivternopnd_` was never spliced -warning: definition `ivtestop_` was never spliced warning: definition `ivunop_` was never spliced warning: definition `ixor_` was never spliced warning: definition `jsize` was never spliced @@ -1863,7 +1865,6 @@ warning: definition `vsize` was never spliced warning: definition `vsizenn` was never spliced warning: definition `vswizzlop_` was never spliced warning: definition `vternop_` was never spliced -warning: definition `vtestop_` was never spliced warning: definition `vunop_` was never spliced warning: definition `vunpack` was never spliced warning: definition `vvbinop_` was never spliced @@ -1916,6 +1917,10 @@ warning: rule prose `Elemmode_ok/active` was never spliced warning: rule prose `Elemmode_ok/declare` was never spliced warning: rule prose `Elemmode_ok/passive` was never spliced warning: rule prose `Eval_expr` was never spliced +warning: rule prose `Expand` was never spliced +warning: rule prose `Expand_use` was never spliced +warning: rule prose `Expand_use/deftype` was never spliced +warning: rule prose `Expand_use/typeidx` was never spliced warning: rule prose `Export_ok` was never spliced warning: rule prose `Expr_const` was never spliced warning: rule prose `Expr_ok` was never spliced @@ -2120,6 +2125,7 @@ warning: rule prose `Local_ok` was never spliced warning: rule prose `Local_ok/set` was never spliced warning: rule prose `Local_ok/unset` was never spliced warning: rule prose `Mem_ok` was never spliced +warning: rule prose `Memarg_ok` was never spliced warning: rule prose `Memtype_ok` was never spliced warning: rule prose `Memtype_sub` was never spliced warning: rule prose `Module_ok` was never spliced @@ -2468,7 +2474,6 @@ warning: definition prose `funcsxx` was never spliced warning: definition prose `fvbinop_` was never spliced warning: definition prose `fvrelop_` was never spliced warning: definition prose `fvternop_` was never spliced -warning: definition prose `fvtestop_` was never spliced warning: definition prose `fvunop_` was never spliced warning: definition prose `fzero` was never spliced warning: definition prose `global` was never spliced @@ -2535,7 +2540,6 @@ warning: definition prose `ivshiftopsx_` was never spliced warning: definition prose `ivshufflop_` was never spliced warning: definition prose `ivswizzlop_` was never spliced warning: definition prose `ivternopnd_` was never spliced -warning: definition prose `ivtestop_` was never spliced warning: definition prose `ivunop_` was never spliced warning: definition prose `jsize` was never spliced warning: definition prose `jsizenn` was never spliced @@ -2662,7 +2666,6 @@ warning: definition prose `vsize` was never spliced warning: definition prose `vsizenn` was never spliced warning: definition prose `vswizzlop_` was never spliced warning: definition prose `vternop_` was never spliced -warning: definition prose `vtestop_` was never spliced warning: definition prose `vunop_` was never spliced warning: definition prose `vunpack` was never spliced warning: definition prose `vvbinop_` was never spliced diff --git a/test/core/gc/array_fill.wast b/test/core/gc/array_fill.wast index 0379ad537..731221780 100644 --- a/test/core/gc/array_fill.wast +++ b/test/core/gc/array_fill.wast @@ -79,3 +79,22 @@ (assert_return (invoke "array_get_nth" (i32.const 2)) (i32.const 11)) (assert_return (invoke "array_get_nth" (i32.const 3)) (i32.const 11)) (assert_return (invoke "array_get_nth" (i32.const 4)) (i32.const 0)) + +;; fill the whole array +(assert_return (invoke "array_fill" (i32.const 0) (i32.const 42) (i32.const 12))) +(assert_return (invoke "array_get_nth" (i32.const 0)) (i32.const 42)) +(assert_return (invoke "array_get_nth" (i32.const 2)) (i32.const 42)) +(assert_return (invoke "array_get_nth" (i32.const 5)) (i32.const 42)) +(assert_return (invoke "array_get_nth" (i32.const 11)) (i32.const 42)) + +;; fill the first element +(assert_return (invoke "array_fill" (i32.const 0) (i32.const 7) (i32.const 1))) +(assert_return (invoke "array_get_nth" (i32.const 0)) (i32.const 7)) +(assert_return (invoke "array_get_nth" (i32.const 1)) (i32.const 42)) +(assert_return (invoke "array_get_nth" (i32.const 11)) (i32.const 42)) + +;; fill the last 2 elements +(assert_return (invoke "array_fill" (i32.const 10) (i32.const 9) (i32.const 2))) +(assert_return (invoke "array_get_nth" (i32.const 9)) (i32.const 42)) +(assert_return (invoke "array_get_nth" (i32.const 10)) (i32.const 9)) +(assert_return (invoke "array_get_nth" (i32.const 11)) (i32.const 9)) diff --git a/test/harness/async_index.js b/test/harness/async_index.js index 7b4fcd1ae..5418624a5 100644 --- a/test/harness/async_index.js +++ b/test/harness/async_index.js @@ -281,6 +281,26 @@ function assert_trap(action, source) { .catch(_ => {}); } +function assert_exception(action, source) { + const test = `Test that a WebAssembly code throws an exception (${source})`; + const loc = new Error().stack.toString().replace("Error", ""); + chain = Promise.all([chain, action()]) + .then( + result => { + uniqueTest(_ => { + assert_true(false, loc); + }, test); + }, + error => { + uniqueTest(_ => { + // Pass + }, test); + } + ) + // Clear all exceptions, so that subsequent tests get executed. + .catch(_ => {}); +} + function assert_return(action, source, ...expected) { const test = `Test that a WebAssembly code returns a specific result (${source})`; const loc = new Error().stack.toString().replace("Error", ""); @@ -298,16 +318,18 @@ function assert_return(action, source, ...expected) { throw new Error(expected.length + " value(s) expected, got " + actual.length); } for (let i = 0; i < actual.length; ++i) { + let actual_i; + try { actual_i = "" + actual[i] } catch (e) { actual_i = typeof actual[i] } switch (expected[i]) { case "nan:canonical": case "nan:arithmetic": case "nan:any": // Note that JS can't reliably distinguish different NaN values, // so there's no good way to test that it's a canonical NaN. - assert_true(Number.isNaN(actual[i]), `expected NaN, observed ${actual[i]}.`); + assert_true(Number.isNaN(actual[i]), `expected NaN, observed ${actual_i}.`); return; case "ref.i31": - assert_true(typeof actual[i] === "number" && (actual[i] & 0x7fffffff) === actual[i], `expected Wasm i31, got ${actual[i]}`); + assert_true(typeof actual[i] === "number" && (actual[i] & 0x7fffffff) === actual[i], `expected Wasm i31, got ${actual_i}`); return; case "ref.any": case "ref.eq": @@ -315,16 +337,16 @@ function assert_return(action, source, ...expected) { case "ref.array": // For now, JS can't distinguish exported Wasm GC values, // so we only test for object. - assert_true(typeof actual[i] === "object", `expected Wasm GC object, got ${actual[i]}`); + assert_true(typeof actual[i] === "object", `expected Wasm GC object, got ${actual_i}`); return; case "ref.func": - assert_true(typeof actual[i] === "function", `expected Wasm function, got ${actual[i]}`); + assert_true(typeof actual[i] === "function", `expected Wasm function, got ${actual_i}`); return; case "ref.extern": - assert_true(actual[i] !== null, `expected Wasm reference, got ${actual[i]}`); + assert_true(actual[i] !== null, `expected Wasm reference, got ${actual_i}`); return; case "ref.null": - assert_true(actual[i] === null, `expected Wasm null reference, got ${actual[i]}`); + assert_true(actual[i] === null, `expected Wasm null reference, got ${actual_i}`); return; default: assert_equals(actual[i], expected[i], loc); @@ -355,7 +377,7 @@ try { } function assert_exhaustion(action) { - const test = "Test that a WebAssembly code exhauts the stack space"; + const test = "Test that a WebAssembly code exhausts the stack space"; const loc = new Error().stack.toString().replace("Error", ""); chain = Promise.all([action(), chain]) .then( diff --git a/test/harness/sync_index.js b/test/harness/sync_index.js index 77f601f59..0785ae020 100644 --- a/test/harness/sync_index.js +++ b/test/harness/sync_index.js @@ -339,6 +339,16 @@ function assert_trap(action, source) { }, `A wast module that must trap at runtime. (${source})`); } +function assert_exception(action, source) { + let result = action(); + + _assert(result instanceof Result); + + uniqueTest(() => { + assert_true(result.isError(), 'expected error result'); + }, `A wast module that must throw an exception at runtime. (${source})`); +} + let StackOverflow; try { (function f() { 1 + f() })() } catch (e) { StackOverflow = e.constructor } @@ -377,16 +387,18 @@ function assert_return(action, source, ...expected) { return; expected[i] = expected[i].value; } + let actual_i; + try { actual_i = "" + actual[i] } catch (e) { actual_i = typeof actual[i] } switch (expected[i]) { case "nan:canonical": case "nan:arithmetic": case "nan:any": // Note that JS can't reliably distinguish different NaN values, // so there's no good way to test that it's a canonical NaN. - assert_true(Number.isNaN(actual[i]), `expected NaN, observed ${actual[i]}.`); + assert_true(Number.isNaN(actual[i]), `expected NaN, observed ${actual_i}.`); return; case "ref.i31": - assert_true(typeof actual[i] === "number" && (actual[i] & 0x7fffffff) === actual[i], `expected Wasm i31, got ${actual[i]}`); + assert_true(typeof actual[i] === "number" && (actual[i] & 0x7fffffff) === actual[i], `expected Wasm i31, got ${actual_i}`); return; case "ref.any": case "ref.eq": @@ -394,16 +406,16 @@ function assert_return(action, source, ...expected) { case "ref.array": // For now, JS can't distinguish exported Wasm GC values, // so we only test for object. - assert_true(typeof actual[i] === "object", `expected Wasm GC object, got ${actual[i]}`); + assert_true(typeof actual[i] === "object", `expected Wasm GC object, got ${actual_i}`); return; case "ref.func": - assert_true(typeof actual[i] === "function", `expected Wasm function, got ${actual[i]}`); + assert_true(typeof actual[i] === "function", `expected Wasm function, got ${actual_i}`); return; case "ref.extern": - assert_true(actual[i] !== null, `expected Wasm reference, got ${actual[i]}`); + assert_true(actual[i] !== null, `expected Wasm reference, got ${actual_i}`); return; case "ref.null": - assert_true(actual[i] === null, `expected Wasm null reference, got ${actual[i]}`); + assert_true(actual[i] === null, `expected Wasm null reference, got ${actual_i}`); return; default: assert_equals(actual[i], expected[i]); diff --git a/test/harness/testharness.js b/test/harness/testharness.js index 7c1ded21d..150e7ab9c 100644 --- a/test/harness/testharness.js +++ b/test/harness/testharness.js @@ -9,12 +9,11 @@ policies and contribution forms [3]. [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license [3] http://www.w3.org/2004/10/27-testcases */ +/* Documentation: https://web-platform-tests.org/writing-tests/testharness-api.html + * (../docs/_writing-tests/testharness-api.md) */ -/* Documentation is in docs/api.md */ - -(function () +(function (global_scope) { - var debug = false; // default timeout is 10 seconds, test can override if needed var settings = { output:true, @@ -23,7 +22,8 @@ policies and contribution forms [3]. "long":60000 }, test_timeout:null, - message_events: ["start", "test_state", "result", "completion"] + message_events: ["start", "test_state", "result", "completion"], + debug: false, }; var xhtml_ns = "http://www.w3.org/1999/xhtml"; @@ -47,9 +47,6 @@ policies and contribution forms [3]. * * // Should return the test harness timeout duration in milliseconds. * float test_timeout(); - * - * // Should return the global scope object. - * object global_scope(); * }; */ @@ -66,6 +63,7 @@ policies and contribution forms [3]. this.all_loaded = false; var this_obj = this; this.message_events = []; + this.dispatched_messages = []; this.message_functions = { start: [add_start_callback, remove_start_callback, @@ -88,23 +86,43 @@ policies and contribution forms [3]. test: test.structured_clone()}); }], completion: [add_completion_callback, remove_completion_callback, - function (tests, harness_status) { + function (tests, harness_status, asserts) { var cloned_tests = map(tests, function(test) { return test.structured_clone(); }); this_obj._dispatch("completion_callback", [tests, harness_status], {type: "complete", tests: cloned_tests, - status: harness_status.structured_clone()}); + status: harness_status.structured_clone(), + asserts: asserts.map(assert => assert.structured_clone())}); }] - } + }; on_event(window, 'load', function() { + setTimeout(() => { this_obj.all_loaded = true; + if (tests.all_done()) { + tests.complete(); + } + },0); + }); + + on_event(window, 'message', function(event) { + if (event.data && event.data.type === "getmessages" && event.source) { + // A window can post "getmessages" to receive a duplicate of every + // message posted by this environment so far. This allows subscribers + // from fetch_tests_from_window to 'catch up' to the current state of + // this environment. + for (var i = 0; i < this_obj.dispatched_messages.length; ++i) + { + event.source.postMessage(this_obj.dispatched_messages[i], "*"); + } + } }); } WindowTestEnvironment.prototype._dispatch = function(selector, callback_args, message_arg) { + this.dispatched_messages.push(message_arg); this._forEach_windows( function(w, same_origin) { if (same_origin) { @@ -118,23 +136,19 @@ policies and contribution forms [3]. if (has_selector) { try { w[selector].apply(undefined, callback_args); - } catch (e) { - if (debug) { - throw e; - } - } + } catch (e) {} } } - if (supports_post_message(w) && w !== self) { + if (w !== self) { w.postMessage(message_arg, "*"); } }); }; WindowTestEnvironment.prototype._forEach_windows = function(callback) { - // Iterate of the windows [self ... top, opener]. The callback is passed - // two objects, the first one is the windows object itself, the second one - // is a boolean indicating whether or not its on the same origin as the + // Iterate over the windows [self ... top, opener]. The callback is passed + // two objects, the first one is the window object itself, the second one + // is a boolean indicating whether or not it's on the same origin as the // current window. var cache = this.window_cache; if (!cache) { @@ -142,33 +156,14 @@ policies and contribution forms [3]. var w = self; var i = 0; var so; - var origins = location.ancestorOrigins; while (w != w.parent) { w = w.parent; - // In WebKit, calls to parent windows' properties that aren't on the same - // origin cause an error message to be displayed in the error console but - // don't throw an exception. This is a deviation from the current HTML5 - // spec. See: https://bugs.webkit.org/show_bug.cgi?id=43504 - // The problem with WebKit's behavior is that it pollutes the error console - // with error messages that can't be caught. - // - // This issue can be mitigated by relying on the (for now) proprietary - // `location.ancestorOrigins` property which returns an ordered list of - // the origins of enclosing windows. See: - // http://trac.webkit.org/changeset/113945. - if (origins) { - so = (location.origin == origins[i]); - } else { - so = is_same_origin(w); - } + so = is_same_origin(w); cache.push([w, so]); i++; } w = window.opener; if (w) { - // window.opener isn't included in the `location.ancestorOrigins` prop. - // We'll just have to deal with a simple check and an error msg on WebKit - // browsers in this case. cache.push([w, is_same_origin(w)]); } this.window_cache = cache; @@ -198,8 +193,8 @@ policies and contribution forms [3]. this_obj.output_handler.show_status(); }); - add_completion_callback(function (tests, harness_status) { - this_obj.output_handler.show_results(tests, harness_status); + add_completion_callback(function (tests, harness_status, asserts_run) { + this_obj.output_handler.show_results(tests, harness_status, asserts_run); }); this.setup_messages(settings.message_events); }; @@ -216,15 +211,12 @@ policies and contribution forms [3]. } }); this.message_events = new_events; - } + }; WindowTestEnvironment.prototype.next_default_test_name = function() { - //Don't use document.title to work around an Opera bug in XHTML documents - var title = document.getElementsByTagName("title")[0]; - var prefix = (title && title.firstChild && title.firstChild.data) || "Untitled"; var suffix = this.name_counter > 0 ? " " + this.name_counter : ""; this.name_counter++; - return prefix + suffix; + return get_title() + suffix; }; WindowTestEnvironment.prototype.on_new_harness_properties = function(properties) { @@ -241,8 +233,8 @@ policies and contribution forms [3]. WindowTestEnvironment.prototype.test_timeout = function() { var metas = document.getElementsByTagName("meta"); for (var i = 0; i < metas.length; i++) { - if (metas[i].name == "timeout") { - if (metas[i].content == "long") { + if (metas[i].name === "timeout") { + if (metas[i].content === "long") { return settings.harness_timeout.long; } break; @@ -251,10 +243,6 @@ policies and contribution forms [3]. return settings.harness_timeout.normal; }; - WindowTestEnvironment.prototype.global_scope = function() { - return window; - }; - /* * Base TestEnvironment implementation for a generic web worker. * @@ -298,7 +286,7 @@ policies and contribution forms [3]. WorkerTestEnvironment.prototype.next_default_test_name = function() { var suffix = this.name_counter > 0 ? " " + this.name_counter : ""; this.name_counter++; - return "Untitled" + suffix; + return get_title() + suffix; }; WorkerTestEnvironment.prototype.on_new_harness_properties = function() {}; @@ -327,14 +315,15 @@ policies and contribution forms [3]. }); }); add_completion_callback( - function(tests, harness_status) { + function(tests, harness_status, asserts) { this_obj._dispatch({ type: "complete", tests: map(tests, function(test) { return test.structured_clone(); }), - status: harness_status.structured_clone() + status: harness_status.structured_clone(), + asserts: asserts.map(assert => assert.structured_clone()), }); }); }; @@ -347,10 +336,6 @@ policies and contribution forms [3]. return null; }; - WorkerTestEnvironment.prototype.global_scope = function() { - return self; - }; - /* * Dedicated web workers. * https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope @@ -389,7 +374,7 @@ policies and contribution forms [3]. self.addEventListener("connect", function(message_event) { this_obj._add_message_port(message_event.source); - }); + }, false); } SharedWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype); @@ -414,37 +399,34 @@ policies and contribution forms [3]. var this_obj = this; self.addEventListener("message", function(event) { - if (event.data.type && event.data.type === "connect") { - if (event.ports && event.ports[0]) { - // If a MessageChannel was passed, then use it to - // send results back to the main window. This - // allows the tests to work even if the browser - // does not fully support MessageEvent.source in - // ServiceWorkers yet. - this_obj._add_message_port(event.ports[0]); - event.ports[0].start(); - } else { - // If there is no MessageChannel, then attempt to - // use the MessageEvent.source to send results - // back to the main window. - this_obj._add_message_port(event.source); - } + if (event.data && event.data.type && event.data.type === "connect") { + this_obj._add_message_port(event.source); } - }); + }, false); // The oninstall event is received after the service worker script and // all imported scripts have been fetched and executed. It's the // equivalent of an onload event for a document. All tests should have // been added by the time this event is received, thus it's not - // necessary to wait until the onactivate event. - on_event(self, "install", - function(event) { - this_obj.all_loaded = true; - if (this_obj.on_loaded_callback) { - this_obj.on_loaded_callback(); - } - }); + // necessary to wait until the onactivate event. However, tests for + // installed service workers need another event which is equivalent to + // the onload event because oninstall is fired only on installation. The + // onmessage event is used for that purpose since tests using + // testharness.js should ask the result to its service worker by + // PostMessage. If the onmessage event is triggered on the service + // worker's context, that means the worker's script has been evaluated. + on_event(self, "install", on_all_loaded); + on_event(self, "message", on_all_loaded); + function on_all_loaded() { + if (this_obj.all_loaded) + return; + this_obj.all_loaded = true; + if (this_obj.on_loaded_callback) { + this_obj.on_loaded_callback(); + } + } } + ServiceWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype); ServiceWorkerTestEnvironment.prototype.add_on_loaded_callback = function(callback) { @@ -455,123 +437,553 @@ policies and contribution forms [3]. } }; + /* + * Shadow realms. + * https://github.com/tc39/proposal-shadowrealm + * + * This class is used as the test_environment when testharness is running + * inside a shadow realm. + */ + function ShadowRealmTestEnvironment() { + WorkerTestEnvironment.call(this); + this.all_loaded = false; + this.on_loaded_callback = null; + } + + ShadowRealmTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype); + + /** + * Signal to the test environment that the tests are ready and the on-loaded + * callback should be run. + * + * Shadow realms are not *really* a DOM context: they have no `onload` or similar + * event for us to use to set up the test environment; so, instead, this method + * is manually triggered from the incubating realm + * + * @param {Function} message_destination - a function that receives JSON-serializable + * data to send to the incubating realm, in the same format as used by RemoteContext + */ + ShadowRealmTestEnvironment.prototype.begin = function(message_destination) { + if (this.all_loaded) { + throw new Error("Tried to start a shadow realm test environment after it has already started"); + } + var fakeMessagePort = {}; + fakeMessagePort.postMessage = message_destination; + this._add_message_port(fakeMessagePort); + this.all_loaded = true; + if (this.on_loaded_callback) { + this.on_loaded_callback(); + } + }; + + ShadowRealmTestEnvironment.prototype.add_on_loaded_callback = function(callback) { + if (this.all_loaded) { + callback(); + } else { + this.on_loaded_callback = callback; + } + }; + + /* + * JavaScript shells. + * + * This class is used as the test_environment when testharness is running + * inside a JavaScript shell. + */ + function ShellTestEnvironment() { + this.name_counter = 0; + this.all_loaded = false; + this.on_loaded_callback = null; + Promise.resolve().then(function() { + this.all_loaded = true; + if (this.on_loaded_callback) { + this.on_loaded_callback(); + } + }.bind(this)); + this.message_list = []; + this.message_ports = []; + } + + ShellTestEnvironment.prototype.next_default_test_name = function() { + var suffix = this.name_counter > 0 ? " " + this.name_counter : ""; + this.name_counter++; + return get_title() + suffix; + }; + + ShellTestEnvironment.prototype.on_new_harness_properties = function() {}; + + ShellTestEnvironment.prototype.on_tests_ready = function() {}; + + ShellTestEnvironment.prototype.add_on_loaded_callback = function(callback) { + if (this.all_loaded) { + callback(); + } else { + this.on_loaded_callback = callback; + } + }; + + ShellTestEnvironment.prototype.test_timeout = function() { + // Tests running in a shell don't have a default timeout, so behave as + // if settings.explicit_timeout is true. + return null; + }; + function create_test_environment() { - if ('document' in self) { + if ('document' in global_scope) { return new WindowTestEnvironment(); } - if ('DedicatedWorkerGlobalScope' in self && - self instanceof DedicatedWorkerGlobalScope) { + if ('DedicatedWorkerGlobalScope' in global_scope && + global_scope instanceof DedicatedWorkerGlobalScope) { return new DedicatedWorkerTestEnvironment(); } - if ('SharedWorkerGlobalScope' in self && - self instanceof SharedWorkerGlobalScope) { + if ('SharedWorkerGlobalScope' in global_scope && + global_scope instanceof SharedWorkerGlobalScope) { return new SharedWorkerTestEnvironment(); } - if ('ServiceWorkerGlobalScope' in self && - self instanceof ServiceWorkerGlobalScope) { + if ('ServiceWorkerGlobalScope' in global_scope && + global_scope instanceof ServiceWorkerGlobalScope) { return new ServiceWorkerTestEnvironment(); } - if ('WorkerGlobalScope' in self && - self instanceof WorkerGlobalScope) { + if ('WorkerGlobalScope' in global_scope && + global_scope instanceof WorkerGlobalScope) { return new DedicatedWorkerTestEnvironment(); } + /* Shadow realm global objects are _ordinary_ objects (i.e. their prototype is + * Object) so we don't have a nice `instanceof` test to use; instead, we + * check if the there is a GLOBAL.isShadowRealm() property + * on the global object. that was set by the test harness when it + * created the ShadowRealm. + */ + if (global_scope.GLOBAL && global_scope.GLOBAL.isShadowRealm()) { + return new ShadowRealmTestEnvironment(); + } - throw new Error("Unsupported test environment"); + return new ShellTestEnvironment(); } var test_environment = create_test_environment(); function is_shared_worker(worker) { - return 'SharedWorker' in self && worker instanceof SharedWorker; + return 'SharedWorker' in global_scope && worker instanceof SharedWorker; } function is_service_worker(worker) { - return 'ServiceWorker' in self && worker instanceof ServiceWorker; + // The worker object may be from another execution context, + // so do not use instanceof here. + return 'ServiceWorker' in global_scope && + Object.prototype.toString.call(worker) === '[object ServiceWorker]'; } - /* - * API functions + var seen_func_name = Object.create(null); + + function get_test_name(func, name) + { + if (name) { + return name; + } + + if (func) { + var func_code = func.toString(); + + // Try and match with brackets, but fallback to matching without + var arrow = func_code.match(/^\(\)\s*=>\s*(?:{(.*)}\s*|(.*))$/); + + // Check for JS line separators + if (arrow !== null && !/[\u000A\u000D\u2028\u2029]/.test(func_code)) { + var trimmed = (arrow[1] !== undefined ? arrow[1] : arrow[2]).trim(); + // drop trailing ; if there's no earlier ones + trimmed = trimmed.replace(/^([^;]*)(;\s*)+$/, "$1"); + + if (trimmed) { + let name = trimmed; + if (seen_func_name[trimmed]) { + // This subtest name already exists, so add a suffix. + name += " " + seen_func_name[trimmed]; + } else { + seen_func_name[trimmed] = 0; + } + seen_func_name[trimmed] += 1; + return name; + } + } + } + + return test_environment.next_default_test_name(); + } + + /** + * @callback TestFunction + * @param {Test} test - The test currnetly being run. + * @param {Any[]} args - Additional args to pass to function. + * */ + /** + * Create a synchronous test + * + * @param {TestFunction} func - Test function. This is executed + * immediately. If it returns without error, the test status is + * set to ``PASS``. If it throws an :js:class:`AssertionError`, or + * any other exception, the test status is set to ``FAIL`` + * (typically from an `assert` function). + * @param {String} name - Test name. This must be unique in a + * given file and must be invariant between runs. + */ function test(func, name, properties) { - var test_name = name ? name : test_environment.next_default_test_name(); - properties = properties ? properties : {}; + if (tests.promise_setup_called) { + tests.status.status = tests.status.ERROR; + tests.status.message = '`test` invoked after `promise_setup`'; + tests.complete(); + } + var test_name = get_test_name(func, name); var test_obj = new Test(test_name, properties); - test_obj.step(func, test_obj, test_obj); + var value = test_obj.step(func, test_obj, test_obj); + + if (value !== undefined) { + var msg = 'Test named "' + test_name + + '" passed a function to `test` that returned a value.'; + + try { + if (value && typeof value.then === 'function') { + msg += ' Consider using `promise_test` instead when ' + + 'using Promises or async/await.'; + } + } catch (err) {} + + tests.status.status = tests.status.ERROR; + tests.status.message = msg; + } + if (test_obj.phase === test_obj.phases.STARTED) { test_obj.done(); } } + /** + * Create an asynchronous test + * + * @param {TestFunction|string} funcOrName - Initial step function + * to call immediately with the test name as an argument (if any), + * or name of the test. + * @param {String} name - Test name (if a test function was + * provided). This must be unique in a given file and must be + * invariant between runs. + * @returns {Test} An object representing the ongoing test. + */ function async_test(func, name, properties) { + if (tests.promise_setup_called) { + tests.status.status = tests.status.ERROR; + tests.status.message = '`async_test` invoked after `promise_setup`'; + tests.complete(); + } if (typeof func !== "function") { properties = name; name = func; func = null; } - var test_name = name ? name : test_environment.next_default_test_name(); - properties = properties ? properties : {}; + var test_name = get_test_name(func, name); var test_obj = new Test(test_name, properties); if (func) { - test_obj.step(func, test_obj, test_obj); + var value = test_obj.step(func, test_obj, test_obj); + + // Test authors sometimes return values to async_test, expecting us + // to handle the value somehow. Make doing so a harness error to be + // clear this is invalid, and point authors to promise_test if it + // may be appropriate. + // + // Note that we only perform this check on the initial function + // passed to async_test, not on any later steps - we haven't seen a + // consistent problem with those (and it's harder to check). + if (value !== undefined) { + var msg = 'Test named "' + test_name + + '" passed a function to `async_test` that returned a value.'; + + try { + if (value && typeof value.then === 'function') { + msg += ' Consider using `promise_test` instead when ' + + 'using Promises or async/await.'; + } + } catch (err) {} + + tests.set_status(tests.status.ERROR, msg); + tests.complete(); + } } return test_obj; } + /** + * Create a promise test. + * + * Promise tests are tests which are represented by a promise + * object. If the promise is fulfilled the test passes, if it's + * rejected the test fails, otherwise the test passes. + * + * @param {TestFunction} func - Test function. This must return a + * promise. The test is automatically marked as complete once the + * promise settles. + * @param {String} name - Test name. This must be unique in a + * given file and must be invariant between runs. + */ function promise_test(func, name, properties) { - var test = async_test(name, properties); + if (typeof func !== "function") { + properties = name; + name = func; + func = null; + } + var test_name = get_test_name(func, name); + var test = new Test(test_name, properties); + test._is_promise_test = true; + // If there is no promise tests queue make one. if (!tests.promise_tests) { tests.promise_tests = Promise.resolve(); } tests.promise_tests = tests.promise_tests.then(function() { - var promise = test.step(func, test, test); - test.step(function() { - assert_not_equals(promise, undefined); - }); - return Promise.resolve(promise) - .then( - function() { + return new Promise(function(resolve) { + var promise = test.step(func, test, test); + + test.step(function() { + assert(!!promise, "promise_test", null, + "test body must return a 'thenable' object (received ${value})", + {value:promise}); + assert(typeof promise.then === "function", "promise_test", null, + "test body must return a 'thenable' object (received an object with no `then` method)", + null); + }); + + // Test authors may use the `step` method within a + // `promise_test` even though this reflects a mixture of + // asynchronous control flow paradigms. The "done" callback + // should be registered prior to the resolution of the + // user-provided Promise to avoid timeouts in cases where the + // Promise does not settle but a `step` function has thrown an + // error. + add_test_done_callback(test, resolve); + + Promise.resolve(promise) + .catch(test.step_func( + function(value) { + if (value instanceof AssertionError) { + throw value; + } + assert(false, "promise_test", null, + "Unhandled rejection with value: ${value}", {value:value}); + })) + .then(function() { test.done(); - }) - .catch(test.step_func( - function(value) { - if (value instanceof AssertionError) { - throw value; - } - assert(false, "promise_test", null, - "Unhandled rejection with value: ${value}", {value:value}); - })); + }); + }); }); } - function promise_rejects(test, expected, promise, description) { - return promise.then(test.unreached_func("Should have rejected: " + description)).catch(function(e) { - assert_throws(expected, function() { throw e }, description); - }); + /** + * Make a copy of a Promise in the current realm. + * + * @param {Promise} promise the given promise that may be from a different + * realm + * @returns {Promise} + * + * An arbitrary promise provided by the caller may have originated + * in another frame that have since navigated away, rendering the + * frame's document inactive. Such a promise cannot be used with + * `await` or Promise.resolve(), as microtasks associated with it + * may be prevented from being run. See `issue + * 5319`_ for a + * particular case. + * + * In functions we define here, there is an expectation from the caller + * that the promise is from the current realm, that can always be used with + * `await`, etc. We therefore create a new promise in this realm that + * inherit the value and status from the given promise. + */ + + function bring_promise_to_current_realm(promise) { + return new Promise(promise.then.bind(promise)); + } + + /** + * Assert that a Promise is rejected with the right ECMAScript exception. + * + * @param {Test} test - the `Test` to use for the assertion. + * @param {Function} constructor - The expected exception constructor. + * @param {Promise} promise - The promise that's expected to + * reject with the given exception. + * @param {string} [description] Error message to add to assert in case of + * failure. + */ + function promise_rejects_js(test, constructor, promise, description) { + return bring_promise_to_current_realm(promise) + .then(test.unreached_func("Should have rejected: " + description)) + .catch(function(e) { + assert_throws_js_impl(constructor, function() { throw e; }, + description, "promise_rejects_js"); + }); + } + + /** + * Assert that a Promise is rejected with the right DOMException. + * + * For the remaining arguments, there are two ways of calling + * promise_rejects_dom: + * + * 1) If the DOMException is expected to come from the current global, the + * third argument should be the promise expected to reject, and a fourth, + * optional, argument is the assertion description. + * + * 2) If the DOMException is expected to come from some other global, the + * third argument should be the DOMException constructor from that global, + * the fourth argument the promise expected to reject, and the fifth, + * optional, argument the assertion description. + * + * @param {Test} test - the `Test` to use for the assertion. + * @param {number|string} type - See documentation for + * `assert_throws_dom <#assert_throws_dom>`_. + * @param {Function} promiseOrConstructor - Either the constructor + * for the expected exception (if the exception comes from another + * global), or the promise that's expected to reject (if the + * exception comes from the current global). + * @param {Function|string} descriptionOrPromise - Either the + * promise that's expected to reject (if the exception comes from + * another global), or the optional description of the condition + * being tested (if the exception comes from the current global). + * @param {string} [description] - Description of the condition + * being tested (if the exception comes from another global). + * + */ + function promise_rejects_dom(test, type, promiseOrConstructor, descriptionOrPromise, maybeDescription) { + let constructor, promise, description; + if (typeof promiseOrConstructor === "function" && + promiseOrConstructor.name === "DOMException") { + constructor = promiseOrConstructor; + promise = descriptionOrPromise; + description = maybeDescription; + } else { + constructor = self.DOMException; + promise = promiseOrConstructor; + description = descriptionOrPromise; + assert(maybeDescription === undefined, + "Too many args passed to no-constructor version of promise_rejects_dom, or accidentally explicitly passed undefined"); + } + return bring_promise_to_current_realm(promise) + .then(test.unreached_func("Should have rejected: " + description)) + .catch(function(e) { + assert_throws_dom_impl(type, function() { throw e; }, description, + "promise_rejects_dom", constructor); + }); + } + +/** + * Assert that a `Promise` is rejected with a `QuotaExceededError` with the + * expected values. + * + * For the remaining arguments, there are two ways of calling + * `promise_rejects_quotaexceedederror`: + * + * 1) If the `QuotaExceededError` is expected to come from the + * current global, the second argument should be the promise + * expected to reject, the third and a fourth the expected + * `requested` and `quota` property values, and the fifth, + * optional, argument is the assertion description. + * + * 2) If the `QuotaExceededError` is expected to come from some + * other global, the second argument should be the + * `QuotaExceededError` constructor from that global, the third + * argument should be the promise expected to reject, the fourth + * and fifth the expected `requested` and `quota` property + * values, and the sixth, optional, argument is the assertion + * description. + * + */ + function promise_rejects_quotaexceedederror(test, promiseOrConstructor, requestedOrPromise, quotaOrRequested, descriptionOrQuota, maybeDescription) + { + let constructor, promise, requested, quota, description; + if (typeof promiseOrConstructor === "function" && + promiseOrConstructor.name === "QuotaExceededError") { + constructor = promiseOrConstructor; + promise = requestedOrPromise; + requested = quotaOrRequested; + quota = descriptionOrQuota; + description = maybeDescription; + } else { + constructor = self.QuotaExceededError; + promise = promiseOrConstructor; + requested = requestedOrPromise; + quota = quotaOrRequested; + description = descriptionOrQuota; + assert(maybeDescription === undefined, + "Too many args passed to no-constructor version of promise_rejects_quotaexceedederror"); + } + return bring_promise_to_current_realm(promise) + .then(test.unreached_func("Should have rejected: " + description)) + .catch(function(e) { + assert_throws_quotaexceedederror_impl(function() { throw e; }, requested, quota, description, "promise_rejects_quotaexceedederror", constructor); + }); + } + + /** + * Assert that a Promise is rejected with the provided value. + * + * @param {Test} test - the `Test` to use for the assertion. + * @param {Any} exception - The expected value of the rejected promise. + * @param {Promise} promise - The promise that's expected to + * reject. + * @param {string} [description] Error message to add to assert in case of + * failure. + */ + function promise_rejects_exactly(test, exception, promise, description) { + return bring_promise_to_current_realm(promise) + .then(test.unreached_func("Should have rejected: " + description)) + .catch(function(e) { + assert_throws_exactly_impl(exception, function() { throw e; }, + description, "promise_rejects_exactly"); + }); } /** - * This constructor helper allows DOM events to be handled using Promises, - * which can make it a lot easier to test a very specific series of events, + * Allow DOM events to be handled using Promises. + * + * This can make it a lot easier to test a very specific series of events, * including ensuring that unexpected events are not fired at any point. + * + * `EventWatcher` will assert if an event occurs while there is no `wait_for` + * created Promise waiting to be fulfilled, or if the event is of a different type + * to the type currently expected. This ensures that only the events that are + * expected occur, in the correct order, and with the correct timing. + * + * @constructor + * @param {Test} test - The `Test` to use for the assertion. + * @param {EventTarget} watchedNode - The target expected to receive the events. + * @param {string[]} eventTypes - List of events to watch for. + * @param {Promise} timeoutPromise - Promise that will cause the + * test to be set to `TIMEOUT` once fulfilled. + * */ - function EventWatcher(test, watchedNode, eventTypes) + function EventWatcher(test, watchedNode, eventTypes, timeoutPromise) { - if (typeof eventTypes == 'string') { + if (typeof eventTypes === 'string') { eventTypes = [eventTypes]; } var waitingFor = null; + // This is null unless we are recording all events, in which case it + // will be an Array object. + var recordedEvents = null; + var eventHandler = test.step_func(function(evt) { assert_true(!!waitingFor, 'Not expecting event, but got ' + evt.type + ' event'); assert_equals(evt.type, waitingFor.types[0], 'Expected ' + waitingFor.types[0] + ' event, but got ' + evt.type + ' event instead'); + + if (Array.isArray(recordedEvents)) { + recordedEvents.push(evt); + } + if (waitingFor.types.length > 1) { // Pop first event from array waitingFor.types.shift(); @@ -582,25 +994,68 @@ policies and contribution forms [3]. // need to set waitingFor. var resolveFunc = waitingFor.resolve; waitingFor = null; - resolveFunc(evt); + // Likewise, we should reset the state of recordedEvents. + var result = recordedEvents || evt; + recordedEvents = null; + resolveFunc(result); }); for (var i = 0; i < eventTypes.length; i++) { - watchedNode.addEventListener(eventTypes[i], eventHandler); + watchedNode.addEventListener(eventTypes[i], eventHandler, false); } /** * Returns a Promise that will resolve after the specified event or * series of events has occurred. + * + * @param {Object} options An optional options object. If the 'record' property + * on this object has the value 'all', when the Promise + * returned by this function is resolved, *all* Event + * objects that were waited for will be returned as an + * array. + * + * @example + * const watcher = new EventWatcher(t, div, [ 'animationstart', + * 'animationiteration', + * 'animationend' ]); + * return watcher.wait_for([ 'animationstart', 'animationend' ], + * { record: 'all' }).then(evts => { + * assert_equals(evts[0].elapsedTime, 0.0); + * assert_equals(evts[1].elapsedTime, 2.0); + * }); */ - this.wait_for = function(types) { + this.wait_for = function(types, options) { if (waitingFor) { return Promise.reject('Already waiting for an event or events'); } - if (typeof types == 'string') { + if (typeof types === 'string') { types = [types]; } + if (options && options.record && options.record === 'all') { + recordedEvents = []; + } return new Promise(function(resolve, reject) { + var timeout = test.step_func(function() { + // If the timeout fires after the events have been received + // or during a subsequent call to wait_for, ignore it. + if (!waitingFor || waitingFor.resolve !== resolve) + return; + + // This should always fail, otherwise we should have + // resolved the promise. + assert_true(waitingFor.types.length === 0, + 'Timed out waiting for ' + waitingFor.types.join(', ')); + var result = recordedEvents; + recordedEvents = null; + var resolveFunc = waitingFor.resolve; + waitingFor = null; + resolveFunc(result); + }); + + if (timeoutPromise) { + timeoutPromise().then(timeout); + } + waitingFor = { types: types, resolve: resolve, @@ -609,18 +1064,61 @@ policies and contribution forms [3]. }); }; - function stop_watching() { + /** + * Stop listening for events + */ + this.stop_watching = function() { for (var i = 0; i < eventTypes.length; i++) { - watchedNode.removeEventListener(eventTypes[i], eventHandler); + watchedNode.removeEventListener(eventTypes[i], eventHandler, false); } }; - test.add_cleanup(stop_watching); + test._add_cleanup(this.stop_watching); return this; } expose(EventWatcher, 'EventWatcher'); + /** + * @typedef {Object} SettingsObject + * @property {bool} single_test - Use the single-page-test + * mode. In this mode the Document represents a single + * `async_test`. Asserts may be used directly without requiring + * `Test.step` or similar wrappers, and any exceptions set the + * status of the test rather than the status of the harness. + * @property {bool} allow_uncaught_exception - don't treat an + * uncaught exception as an error; needed when e.g. testing the + * `window.onerror` handler. + * @property {boolean} explicit_done - Wait for a call to `done()` + * before declaring all tests complete (this is always true for + * single-page tests). + * @property hide_test_state - hide the test state output while + * the test is running; This is helpful when the output of the test state + * may interfere the test results. + * @property {bool} explicit_timeout - disable file timeout; only + * stop waiting for results when the `timeout()` function is + * called This should typically only be set for manual tests, or + * by a test runner that providees its own timeout mechanism. + * @property {number} timeout_multiplier - Multiplier to apply to + * per-test timeouts. This should only be set by a test runner. + * @property {Document} output_document - The document to which + * results should be logged. By default this is the current + * document but could be an ancestor document in some cases e.g. a + * SVG test loaded in an HTML wrapper + * + */ + + /** + * Configure the harness + * + * @param {Function|SettingsObject} funcOrProperties - Either a + * setup function to run, or a set of properties. If this is a + * function that function is run synchronously. Any exception in + * the function will set the overall harness status to `ERROR`. + * @param {SettingsObject} maybeProperties - An object containing + * the settings to use, if the first argument is a function. + * + */ function setup(func_or_properties, maybe_properties) { var func = null; @@ -637,16 +1135,100 @@ policies and contribution forms [3]. test_environment.on_new_harness_properties(properties); } + /** + * Configure the harness, waiting for a promise to resolve + * before running any `promise_test` tests. + * + * @param {Function} func - Function returning a promise that's + * run synchronously. Promise tests are not run until after this + * function has resolved. + * @param {SettingsObject} [properties] - An object containing + * the harness settings to use. + * + */ + function promise_setup(func, properties={}) + { + if (typeof func !== "function") { + tests.set_status(tests.status.ERROR, + "`promise_setup` invoked without a function"); + tests.complete(); + return; + } + tests.promise_setup_called = true; + + if (!tests.promise_tests) { + tests.promise_tests = Promise.resolve(); + } + + tests.promise_tests = tests.promise_tests + .then(function() + { + var result; + + tests.setup(null, properties); + result = func(); + test_environment.on_new_harness_properties(properties); + + if (!result || typeof result.then !== "function") { + throw "Non-thenable returned by function passed to `promise_setup`"; + } + return result; + }) + .catch(function(e) + { + tests.set_status(tests.status.ERROR, + String(e), + e && e.stack); + tests.complete(); + }); + } + + /** + * Mark test loading as complete. + * + * Typically this function is called implicitly on page load; it's + * only necessary for users to call this when either the + * ``explicit_done`` or ``single_test`` properties have been set + * via the :js:func:`setup` function. + * + * For single page tests this marks the test as complete and sets its status. + * For other tests, this marks test loading as complete, but doesn't affect ongoing tests. + */ function done() { if (tests.tests.length === 0) { - tests.set_file_is_test(); + // `done` is invoked after handling uncaught exceptions, so if the + // harness status is already set, the corresponding message is more + // descriptive than the generic message defined here. + if (tests.status.status === null) { + tests.status.status = tests.status.ERROR; + tests.status.message = "done() was called without first defining any tests"; + } + + tests.complete(); + return; } if (tests.file_is_test) { + // file is test files never have asynchronous cleanup logic, + // meaning the fully-synchronous `done` function can be used here. tests.tests[0].done(); } tests.end_wait(); } + /** + * @deprecated generate a list of tests from a function and list of arguments + * + * This is deprecated because it runs all the tests outside of the test functions + * and as a result any test throwing an exception will result in no tests being + * run. In almost all cases, you should simply call test within the loop you would + * use to generate the parameter list array. + * + * @param {Function} func - The function that will be called for each generated tests. + * @param {Any[][]} args - An array of arrays. Each nested array + * has the structure `[testName, ...testArgs]`. For each of these nested arrays + * array, a test is generated with name `testName` and test function equivalent to + * `func(..testArgs)`. + */ function generate_tests(func, args, properties) { forEach(args, function(x, i) { @@ -660,25 +1242,65 @@ policies and contribution forms [3]. }); } + /** + * @deprecated + * + * Register a function as a DOM event listener to the + * given object for the event bubbling phase. + * + * @param {EventTarget} object - Event target + * @param {string} event - Event name + * @param {Function} callback - Event handler. + */ function on_event(object, event, callback) { object.addEventListener(event, callback, false); } - function step_timeout(f, t) { + // Internal helper function to provide timeout-like functionality in + // environments where there is no setTimeout(). (No timeout ID or + // clearTimeout().) + function fake_set_timeout(callback, delay) { + var p = Promise.resolve(); + var start = Date.now(); + var end = start + delay; + function check() { + if ((end - Date.now()) > 0) { + p.then(check); + } else { + callback(); + } + } + p.then(check); + } + + /** + * Global version of :js:func:`Test.step_timeout` for use in single page tests. + * + * @param {Function} func - Function to run after the timeout + * @param {number} timeout - Time in ms to wait before running the + * test step. The actual wait time is ``timeout`` x + * ``timeout_multiplier``. + */ + function step_timeout(func, timeout) { var outer_this = this; var args = Array.prototype.slice.call(arguments, 2); - return setTimeout(function() { - f.apply(outer_this, args); - }, t * tests.timeout_multiplier); + var local_set_timeout = typeof global_scope.setTimeout === "undefined" ? fake_set_timeout : setTimeout; + return local_set_timeout(function() { + func.apply(outer_this, args); + }, timeout * tests.timeout_multiplier); } expose(test, 'test'); expose(async_test, 'async_test'); expose(promise_test, 'promise_test'); - expose(promise_rejects, 'promise_rejects'); + expose(promise_rejects_js, 'promise_rejects_js'); + expose(promise_rejects_dom, 'promise_rejects_dom'); + expose(promise_rejects_quotaexceedederror, 'promise_rejects_quotaexceedederror'); + expose(promise_rejects_exactly, 'promise_rejects_exactly'); expose(generate_tests, 'generate_tests'); expose(setup, 'setup'); + expose(promise_setup, 'promise_setup'); expose(done, 'done'); expose(on_event, 'on_event'); expose(step_timeout, 'step_timeout'); @@ -765,9 +1387,40 @@ policies and contribution forms [3]. "0xffff": "uffff", }; - /* + const formatEscapeMap = { + "\\": "\\\\", + '"': '\\"' + }; + for (const p in replacements) { + formatEscapeMap[String.fromCharCode(p)] = "\\" + replacements[p]; + } + const formatEscapePattern = new RegExp(`[${Object.keys(formatEscapeMap).map(k => k === "\\" ? "\\\\" : k).join("")}]`, "g"); + + /** * Convert a value to a nice, human-readable string - */ + * + * When many JavaScript Object values are coerced to a String, the + * resulting value will be ``"[object Object]"``. This obscures + * helpful information, making the coerced value unsuitable for + * use in assertion messages, test names, and debugging + * statements. `format_value` produces more distinctive string + * representations of many kinds of objects, including arrays and + * the more important DOM Node types. It also translates String + * values containing control characters to include human-readable + * representations. + * + * @example + * // "Document node with 2 children" + * format_value(document); + * @example + * // "\"foo\\uffffbar\"" + * format_value("foo\uffffbar"); + * @example + * // "[-0, Infinity]" + * format_value([-0, Infinity]); + * @param {Any} val - The value to convert to a string. + * @returns {string} - A string representation of ``val``, optimised for human readability. + */ function format_value(val, seen) { if (!seen) { @@ -780,17 +1433,20 @@ policies and contribution forms [3]. seen.push(val); } if (Array.isArray(val)) { - return "[" + val.map(function(x) {return format_value(x, seen);}).join(", ") + "]"; + let output = "["; + if (val.beginEllipsis !== undefined) { + output += "…, "; + } + output += val.map(function(x) {return format_value(x, seen);}).join(", "); + if (val.endEllipsis !== undefined) { + output += ", …"; + } + return output + "]"; } switch (typeof val) { case "string": - val = val.replace("\\", "\\\\"); - for (var p in replacements) { - var replace = "\\" + replacements[p]; - val = val.replace(RegExp(String.fromCharCode(p), "g"), replace); - } - return '"' + val.replace(/"/g, '\\"') + '"'; + return '"' + val.replace(formatEscapePattern, match => formatEscapeMap[match]) + '"'; case "boolean": case "undefined": return String(val); @@ -801,6 +1457,8 @@ policies and contribution forms [3]. return "-0"; } return String(val); + case "bigint": + return String(val) + 'n'; case "object": if (val === null) { return "null"; @@ -824,11 +1482,11 @@ policies and contribution forms [3]. case Node.COMMENT_NODE: return "Comment node "; case Node.DOCUMENT_NODE: - return "Document node with " + val.childNodes.length + (val.childNodes.length == 1 ? " child" : " children"); + return "Document node with " + val.childNodes.length + (val.childNodes.length === 1 ? " child" : " children"); case Node.DOCUMENT_TYPE_NODE: return "DocumentType node"; case Node.DOCUMENT_FRAGMENT_NODE: - return "DocumentFragment node with " + val.childNodes.length + (val.childNodes.length == 1 ? " child" : " children"); + return "DocumentFragment node with " + val.childNodes.length + (val.childNodes.length === 1 ? " child" : " children"); default: return "Node object of unknown type"; } @@ -850,19 +1508,65 @@ policies and contribution forms [3]. * Assertions */ + function expose_assert(f, name) { + function assert_wrapper(...args) { + let status = Test.statuses.TIMEOUT; + let stack = null; + let new_assert_index = null; + try { + if (settings.debug) { + console.debug("ASSERT", name, tests.current_test && tests.current_test.name, args); + } + if (tests.output) { + tests.set_assert(name, args); + // Remember the newly pushed assert's index, because `apply` + // below might push new asserts. + new_assert_index = tests.asserts_run.length - 1; + } + const rv = f.apply(undefined, args); + status = Test.statuses.PASS; + return rv; + } catch(e) { + status = Test.statuses.FAIL; + stack = e.stack ? e.stack : null; + throw e; + } finally { + if (tests.output && !stack) { + stack = get_stack(); + } + if (tests.output) { + tests.set_assert_status(new_assert_index, status, stack); + } + } + } + expose(assert_wrapper, name); + } + + /** + * Assert that ``actual`` is strictly true + * + * @param {Any} actual - Value that is asserted to be true + * @param {string} [description] - Description of the condition being tested + */ function assert_true(actual, description) { assert(actual === true, "assert_true", description, "expected true got ${actual}", {actual:actual}); } - expose(assert_true, "assert_true"); + expose_assert(assert_true, "assert_true"); + /** + * Assert that ``actual`` is strictly false + * + * @param {Any} actual - Value that is asserted to be false + * @param {string} [description] - Description of the condition being tested + */ function assert_false(actual, description) { assert(actual === false, "assert_false", description, "expected false got ${actual}", {actual:actual}); } - expose(assert_false, "assert_false"); + expose_assert(assert_false, "assert_false"); function same_value(x, y) { if (y !== y) { @@ -876,6 +1580,17 @@ policies and contribution forms [3]. return x === y; } + /** + * Assert that ``actual`` is the same value as ``expected``. + * + * For objects this compares by object identity; for primitives + * this distinguishes between 0 and -0, and has correct handling + * of NaN. + * + * @param {Any} actual - Test value. + * @param {Any} expected - Expected value. + * @param {string} [description] - Description of the condition being tested. + */ function assert_equals(actual, expected, description) { /* @@ -892,30 +1607,61 @@ policies and contribution forms [3]. "expected ${expected} but got ${actual}", {expected:expected, actual:actual}); } - expose(assert_equals, "assert_equals"); + expose_assert(assert_equals, "assert_equals"); + /** + * Assert that ``actual`` is not the same value as ``expected``. + * + * Comparison is as for :js:func:`assert_equals`. + * + * @param {Any} actual - Test value. + * @param {Any} expected - The value ``actual`` is expected to be different to. + * @param {string} [description] - Description of the condition being tested. + */ function assert_not_equals(actual, expected, description) { - /* - * Test if two primitives are unequal or two objects - * are different objects - */ assert(!same_value(actual, expected), "assert_not_equals", description, "got disallowed value ${actual}", {actual:actual}); } - expose(assert_not_equals, "assert_not_equals"); + expose_assert(assert_not_equals, "assert_not_equals"); + /** + * Assert that ``expected`` is an array and ``actual`` is one of the members. + * This is implemented using ``indexOf``, so doesn't handle NaN or ±0 correctly. + * + * @param {Any} actual - Test value. + * @param {Array} expected - An array that ``actual`` is expected to + * be a member of. + * @param {string} [description] - Description of the condition being tested. + */ function assert_in_array(actual, expected, description) { assert(expected.indexOf(actual) != -1, "assert_in_array", description, "value ${actual} not in array ${expected}", {actual:actual, expected:expected}); } - expose(assert_in_array, "assert_in_array"); + expose_assert(assert_in_array, "assert_in_array"); + // This function was deprecated in July of 2015. + // See https://github.com/web-platform-tests/wpt/issues/2033 + /** + * @deprecated + * Recursively compare two objects for equality. + * + * See `Issue 2033 + * `_ for + * more information. + * + * @param {Object} actual - Test value. + * @param {Object} expected - Expected value. + * @param {string} [description] - Description of the condition being tested. + */ function assert_object_equals(actual, expected, description) { + assert(typeof actual === "object" && actual !== null, "assert_object_equals", description, + "value is ${actual}, expected object", + {actual: actual}); //This needs to be improved a great deal function check_equal(actual, expected, stack) { @@ -933,7 +1679,7 @@ policies and contribution forms [3]. } else { assert(same_value(actual[p], expected[p]), "assert_object_equals", description, "property ${p} expected ${expected} got ${actual}", - {p:p, expected:expected, actual:actual}); + {p:p, expected:expected[p], actual:actual[p]}); } } for (p in expected) { @@ -945,29 +1691,119 @@ policies and contribution forms [3]. } check_equal(actual, expected, []); } - expose(assert_object_equals, "assert_object_equals"); + expose_assert(assert_object_equals, "assert_object_equals"); + /** + * Assert that ``actual`` and ``expected`` are both arrays, and that the array properties of + * ``actual`` and ``expected`` are all the same value (as for :js:func:`assert_equals`). + * + * @param {Array} actual - Test array. + * @param {Array} expected - Array that is expected to contain the same values as ``actual``. + * @param {string} [description] - Description of the condition being tested. + */ function assert_array_equals(actual, expected, description) { + const max_array_length = 20; + function shorten_array(arr, offset = 0) { + // Make ", …" only show up when it would likely reduce the length, not accounting for + // fonts. + if (arr.length < max_array_length + 2) { + return arr; + } + // By default we want half the elements after the offset and half before + // But if that takes us past the end of the array, we have more before, and + // if it takes us before the start we have more after. + const length_after_offset = Math.floor(max_array_length / 2); + let upper_bound = Math.min(length_after_offset + offset, arr.length); + const lower_bound = Math.max(upper_bound - max_array_length, 0); + + if (lower_bound === 0) { + upper_bound = max_array_length; + } + + const output = arr.slice(lower_bound, upper_bound); + if (lower_bound > 0) { + output.beginEllipsis = true; + } + if (upper_bound < arr.length) { + output.endEllipsis = true; + } + return output; + } + + assert(typeof actual === "object" && actual !== null && "length" in actual, + "assert_array_equals", description, + "value is ${actual}, expected array", + {actual:actual}); assert(actual.length === expected.length, "assert_array_equals", description, - "lengths differ, expected ${expected} got ${actual}", - {expected:expected.length, actual:actual.length}); + "lengths differ, expected array ${expected} length ${expectedLength}, got ${actual} length ${actualLength}", + {expected:shorten_array(expected, expected.length - 1), expectedLength:expected.length, + actual:shorten_array(actual, actual.length - 1), actualLength:actual.length + }); for (var i = 0; i < actual.length; i++) { assert(actual.hasOwnProperty(i) === expected.hasOwnProperty(i), "assert_array_equals", description, - "property ${i}, property expected to be ${expected} but was ${actual}", + "expected property ${i} to be ${expected} but was ${actual} (expected array ${arrayExpected} got ${arrayActual})", {i:i, expected:expected.hasOwnProperty(i) ? "present" : "missing", - actual:actual.hasOwnProperty(i) ? "present" : "missing"}); + actual:actual.hasOwnProperty(i) ? "present" : "missing", + arrayExpected:shorten_array(expected, i), arrayActual:shorten_array(actual, i)}); assert(same_value(expected[i], actual[i]), "assert_array_equals", description, - "property ${i}, expected ${expected} but got ${actual}", - {i:i, expected:expected[i], actual:actual[i]}); + "expected property ${i} to be ${expected} but got ${actual} (expected array ${arrayExpected} got ${arrayActual})", + {i:i, expected:expected[i], actual:actual[i], + arrayExpected:shorten_array(expected, i), arrayActual:shorten_array(actual, i)}); + } + } + expose_assert(assert_array_equals, "assert_array_equals"); + + /** + * Assert that each array property in ``actual`` is a number within + * ± `epsilon` of the corresponding property in `expected`. + * + * @param {Array} actual - Array of test values. + * @param {Array} expected - Array of values expected to be close to the values in ``actual``. + * @param {number} epsilon - Magnitude of allowed difference + * between each value in ``actual`` and ``expected``. + * @param {string} [description] - Description of the condition being tested. + */ + function assert_array_approx_equals(actual, expected, epsilon, description) + { + /* + * Test if two primitive arrays are equal within +/- epsilon + */ + assert(actual.length === expected.length, + "assert_array_approx_equals", description, + "lengths differ, expected ${expected} got ${actual}", + {expected:expected.length, actual:actual.length}); + + for (var i = 0; i < actual.length; i++) { + assert(actual.hasOwnProperty(i) === expected.hasOwnProperty(i), + "assert_array_approx_equals", description, + "property ${i}, property expected to be ${expected} but was ${actual}", + {i:i, expected:expected.hasOwnProperty(i) ? "present" : "missing", + actual:actual.hasOwnProperty(i) ? "present" : "missing"}); + assert(typeof actual[i] === "number", + "assert_array_approx_equals", description, + "property ${i}, expected a number but got a ${type_actual}", + {i:i, type_actual:typeof actual[i]}); + assert(Math.abs(actual[i] - expected[i]) <= epsilon, + "assert_array_approx_equals", description, + "property ${i}, expected ${expected} +/- ${epsilon}, expected ${expected} but got ${actual}", + {i:i, expected:expected[i], actual:actual[i], epsilon:epsilon}); } } - expose(assert_array_equals, "assert_array_equals"); + expose_assert(assert_array_approx_equals, "assert_array_approx_equals"); + /** + * Assert that ``actual`` is within ± ``epsilon`` of ``expected``. + * + * @param {number} actual - Test value. + * @param {number} expected - Value number is expected to be close to. + * @param {number} epsilon - Magnitude of allowed difference between ``actual`` and ``expected``. + * @param {string} [description] - Description of the condition being tested. + */ function assert_approx_equals(actual, expected, epsilon, description) { /* @@ -978,117 +1814,218 @@ policies and contribution forms [3]. "expected a number but got a ${type_actual}", {type_actual:typeof actual}); - assert(Math.abs(actual - expected) <= epsilon, - "assert_approx_equals", description, - "expected ${expected} +/- ${epsilon} but got ${actual}", - {expected:expected, actual:actual, epsilon:epsilon}); + // The epsilon math below does not place nice with NaN and Infinity + // But in this case Infinity = Infinity and NaN = NaN + if (isFinite(actual) || isFinite(expected)) { + assert(Math.abs(actual - expected) <= epsilon, + "assert_approx_equals", description, + "expected ${expected} +/- ${epsilon} but got ${actual}", + {expected:expected, actual:actual, epsilon:epsilon}); + } else { + assert_equals(actual, expected); + } } - expose(assert_approx_equals, "assert_approx_equals"); + expose_assert(assert_approx_equals, "assert_approx_equals"); + /** + * Assert that ``actual`` is a number less than ``expected``. + * + * @param {number|bigint} actual - Test value. + * @param {number|bigint} expected - Value that ``actual`` must be less than. + * @param {string} [description] - Description of the condition being tested. + */ function assert_less_than(actual, expected, description) { /* - * Test if a primitive number is less than another + * Test if a primitive number (or bigint) is less than another */ - assert(typeof actual === "number", + assert(typeof actual === "number" || typeof actual === "bigint", "assert_less_than", description, "expected a number but got a ${type_actual}", {type_actual:typeof actual}); + assert(typeof actual === typeof expected, + "assert_less_than", description, + "expected a ${type_expected} but got a ${type_actual}", + {type_expected:typeof expected, type_actual:typeof actual}); + assert(actual < expected, "assert_less_than", description, "expected a number less than ${expected} but got ${actual}", {expected:expected, actual:actual}); } - expose(assert_less_than, "assert_less_than"); + expose_assert(assert_less_than, "assert_less_than"); + /** + * Assert that ``actual`` is a number greater than ``expected``. + * + * @param {number|bigint} actual - Test value. + * @param {number|bigint} expected - Value that ``actual`` must be greater than. + * @param {string} [description] - Description of the condition being tested. + */ function assert_greater_than(actual, expected, description) { /* - * Test if a primitive number is greater than another + * Test if a primitive number (or bigint) is greater than another */ - assert(typeof actual === "number", + assert(typeof actual === "number" || typeof actual === "bigint", "assert_greater_than", description, "expected a number but got a ${type_actual}", {type_actual:typeof actual}); + assert(typeof actual === typeof expected, + "assert_greater_than", description, + "expected a ${type_expected} but got a ${type_actual}", + {type_expected:typeof expected, type_actual:typeof actual}); + assert(actual > expected, "assert_greater_than", description, "expected a number greater than ${expected} but got ${actual}", {expected:expected, actual:actual}); } - expose(assert_greater_than, "assert_greater_than"); + expose_assert(assert_greater_than, "assert_greater_than"); + /** + * Assert that ``actual`` is a number greater than ``lower`` and less + * than ``upper`` but not equal to either. + * + * @param {number|bigint} actual - Test value. + * @param {number|bigint} lower - Value that ``actual`` must be greater than. + * @param {number|bigint} upper - Value that ``actual`` must be less than. + * @param {string} [description] - Description of the condition being tested. + */ function assert_between_exclusive(actual, lower, upper, description) { /* - * Test if a primitive number is between two others + * Test if a primitive number (or bigint) is between two others */ - assert(typeof actual === "number", + assert(typeof lower === typeof upper, + "assert_between_exclusive", description, + "expected lower (${type_lower}) and upper (${type_upper}) types to match (test error)", + {type_lower:typeof lower, type_upper:typeof upper}); + + assert(typeof actual === "number" || typeof actual === "bigint", "assert_between_exclusive", description, "expected a number but got a ${type_actual}", {type_actual:typeof actual}); + assert(typeof actual === typeof lower, + "assert_between_exclusive", description, + "expected a ${type_lower} but got a ${type_actual}", + {type_lower:typeof lower, type_actual:typeof actual}); + assert(actual > lower && actual < upper, "assert_between_exclusive", description, "expected a number greater than ${lower} " + "and less than ${upper} but got ${actual}", {lower:lower, upper:upper, actual:actual}); } - expose(assert_between_exclusive, "assert_between_exclusive"); + expose_assert(assert_between_exclusive, "assert_between_exclusive"); + /** + * Assert that ``actual`` is a number less than or equal to ``expected``. + * + * @param {number|bigint} actual - Test value. + * @param {number|bigint} expected - Value that ``actual`` must be less + * than or equal to. + * @param {string} [description] - Description of the condition being tested. + */ function assert_less_than_equal(actual, expected, description) { /* - * Test if a primitive number is less than or equal to another + * Test if a primitive number (or bigint) is less than or equal to another */ - assert(typeof actual === "number", + assert(typeof actual === "number" || typeof actual === "bigint", "assert_less_than_equal", description, "expected a number but got a ${type_actual}", {type_actual:typeof actual}); + assert(typeof actual === typeof expected, + "assert_less_than_equal", description, + "expected a ${type_expected} but got a ${type_actual}", + {type_expected:typeof expected, type_actual:typeof actual}); + assert(actual <= expected, "assert_less_than_equal", description, "expected a number less than or equal to ${expected} but got ${actual}", {expected:expected, actual:actual}); } - expose(assert_less_than_equal, "assert_less_than_equal"); + expose_assert(assert_less_than_equal, "assert_less_than_equal"); + /** + * Assert that ``actual`` is a number greater than or equal to ``expected``. + * + * @param {number|bigint} actual - Test value. + * @param {number|bigint} expected - Value that ``actual`` must be greater + * than or equal to. + * @param {string} [description] - Description of the condition being tested. + */ function assert_greater_than_equal(actual, expected, description) { /* - * Test if a primitive number is greater than or equal to another + * Test if a primitive number (or bigint) is greater than or equal to another */ - assert(typeof actual === "number", + assert(typeof actual === "number" || typeof actual === "bigint", "assert_greater_than_equal", description, "expected a number but got a ${type_actual}", {type_actual:typeof actual}); + assert(typeof actual === typeof expected, + "assert_greater_than_equal", description, + "expected a ${type_expected} but got a ${type_actual}", + {type_expected:typeof expected, type_actual:typeof actual}); + assert(actual >= expected, "assert_greater_than_equal", description, "expected a number greater than or equal to ${expected} but got ${actual}", {expected:expected, actual:actual}); } - expose(assert_greater_than_equal, "assert_greater_than_equal"); + expose_assert(assert_greater_than_equal, "assert_greater_than_equal"); + /** + * Assert that ``actual`` is a number greater than or equal to ``lower`` and less + * than or equal to ``upper``. + * + * @param {number|bigint} actual - Test value. + * @param {number|bigint} lower - Value that ``actual`` must be greater than or equal to. + * @param {number|bigint} upper - Value that ``actual`` must be less than or equal to. + * @param {string} [description] - Description of the condition being tested. + */ function assert_between_inclusive(actual, lower, upper, description) { /* - * Test if a primitive number is between to two others or equal to either of them + * Test if a primitive number (or bigint) is between to two others or equal to either of them */ - assert(typeof actual === "number", + assert(typeof lower === typeof upper, + "assert_between_inclusive", description, + "expected lower (${type_lower}) and upper (${type_upper}) types to match (test error)", + {type_lower:typeof lower, type_upper:typeof upper}); + + assert(typeof actual === "number" || typeof actual === "bigint", "assert_between_inclusive", description, "expected a number but got a ${type_actual}", {type_actual:typeof actual}); + assert(typeof actual === typeof lower, + "assert_between_inclusive", description, + "expected a ${type_lower} but got a ${type_actual}", + {type_lower:typeof lower, type_actual:typeof actual}); + assert(actual >= lower && actual <= upper, "assert_between_inclusive", description, "expected a number greater than or equal to ${lower} " + "and less than or equal to ${upper} but got ${actual}", {lower:lower, upper:upper, actual:actual}); } - expose(assert_between_inclusive, "assert_between_inclusive"); + expose_assert(assert_between_inclusive, "assert_between_inclusive"); + /** + * Assert that ``actual`` matches the RegExp ``expected``. + * + * @param {String} actual - Test string. + * @param {RegExp} expected - RegExp ``actual`` must match. + * @param {string} [description] - Description of the condition being tested. + */ function assert_regexp_match(actual, expected, description) { /* * Test if a string (actual) matches a regexp (expected) @@ -1098,38 +2035,60 @@ policies and contribution forms [3]. "expected ${expected} but got ${actual}", {expected:expected, actual:actual}); } - expose(assert_regexp_match, "assert_regexp_match"); + expose_assert(assert_regexp_match, "assert_regexp_match"); + /** + * Assert that the class string of ``object`` as returned in + * ``Object.prototype.toString`` is equal to ``class_name``. + * + * @param {Object} object - Object to stringify. + * @param {string} class_string - Expected class string for ``object``. + * @param {string} [description] - Description of the condition being tested. + */ function assert_class_string(object, class_string, description) { - assert_equals({}.toString.call(object), "[object " + class_string + "]", - description); + var actual = {}.toString.call(object); + var expected = "[object " + class_string + "]"; + assert(same_value(actual, expected), "assert_class_string", description, + "expected ${expected} but got ${actual}", + {expected:expected, actual:actual}); } - expose(assert_class_string, "assert_class_string"); - + expose_assert(assert_class_string, "assert_class_string"); - function _assert_own_property(name) { - return function(object, property_name, description) - { - assert(object.hasOwnProperty(property_name), - name, description, - "expected property ${p} missing", {p:property_name}); - }; + /** + * Assert that ``object`` has an own property with name ``property_name``. + * + * @param {Object} object - Object that should have the given property. + * @param {string} property_name - Expected property name. + * @param {string} [description] - Description of the condition being tested. + */ + function assert_own_property(object, property_name, description) { + assert(object.hasOwnProperty(property_name), + "assert_own_property", description, + "expected property ${p} missing", {p:property_name}); } - expose(_assert_own_property("assert_exists"), "assert_exists"); - expose(_assert_own_property("assert_own_property"), "assert_own_property"); + expose_assert(assert_own_property, "assert_own_property"); - function assert_not_exists(object, property_name, description) - { + /** + * Assert that ``object`` does not have an own property with name ``property_name``. + * + * @param {Object} object - Object that should not have the given property. + * @param {string} property_name - Property name to test. + * @param {string} [description] - Description of the condition being tested. + */ + function assert_not_own_property(object, property_name, description) { assert(!object.hasOwnProperty(property_name), - "assert_not_exists", description, - "unexpected property ${p} found", {p:property_name}); + "assert_not_own_property", description, + "unexpected property ${p} is found on object", {p:property_name}); } - expose(assert_not_exists, "assert_not_exists"); + expose_assert(assert_not_own_property, "assert_not_own_property"); function _assert_inherits(name) { return function (object, property_name, description) { - assert(typeof object === "object" || typeof object === "function", + assert((typeof object === "object" && object !== null) || + typeof object === "function" || + // Or has [[IsHTMLDDA]] slot + String(object) === "[object HTMLAllCollection]", name, description, "provided value is not an object"); @@ -1148,50 +2107,234 @@ policies and contribution forms [3]. {p:property_name}); }; } - expose(_assert_inherits("assert_inherits"), "assert_inherits"); - expose(_assert_inherits("assert_idl_attribute"), "assert_idl_attribute"); + /** + * Assert that ``object`` does not have an own property with name + * ``property_name``, but inherits one through the prototype chain. + * + * @param {Object} object - Object that should have the given property in its prototype chain. + * @param {string} property_name - Expected property name. + * @param {string} [description] - Description of the condition being tested. + */ + function assert_inherits(object, property_name, description) { + return _assert_inherits("assert_inherits")(object, property_name, description); + } + expose_assert(assert_inherits, "assert_inherits"); + + /** + * Alias for :js:func:`insert_inherits`. + * + * @param {Object} object - Object that should have the given property in its prototype chain. + * @param {string} property_name - Expected property name. + * @param {string} [description] - Description of the condition being tested. + */ + function assert_idl_attribute(object, property_name, description) { + return _assert_inherits("assert_idl_attribute")(object, property_name, description); + } + expose_assert(assert_idl_attribute, "assert_idl_attribute"); + + + /** + * Assert that ``object`` has a property named ``property_name`` and that the property is not writable or has no setter. + * + * @param {Object} object - Object that should have the given (not necessarily own) property. + * @param {string} property_name - Expected property name. + * @param {string} [description] - Description of the condition being tested. + */ function assert_readonly(object, property_name, description) { - var initial_value = object[property_name]; - try { - //Note that this can have side effects in the case where - //the property has PutForwards - object[property_name] = initial_value + "a"; //XXX use some other value here? - assert(same_value(object[property_name], initial_value), - "assert_readonly", description, - "changing property ${p} succeeded", - {p:property_name}); - } finally { - object[property_name] = initial_value; - } + assert(property_name in object, + "assert_readonly", description, + "property ${p} not found", + {p:property_name}); + + let desc; + while (object && (desc = Object.getOwnPropertyDescriptor(object, property_name)) === undefined) { + object = Object.getPrototypeOf(object); + } + + assert(desc !== undefined, + "assert_readonly", description, + "could not find a descriptor for property ${p}", + {p:property_name}); + + if (desc.hasOwnProperty("value")) { + // We're a data property descriptor + assert(desc.writable === false, "assert_readonly", description, + "descriptor [[Writable]] expected false got ${actual}", {actual:desc.writable}); + } else if (desc.hasOwnProperty("get") || desc.hasOwnProperty("set")) { + // We're an accessor property descriptor + assert(desc.set === undefined, "assert_readonly", description, + "property ${p} is an accessor property with a [[Set]] attribute, cannot test readonly-ness", + {p:property_name}); + } else { + // We're a generic property descriptor + // This shouldn't happen, because Object.getOwnPropertyDescriptor + // forwards the return value of [[GetOwnProperty]] (P), which must + // be a fully populated Property Descriptor or Undefined. + assert(false, "assert_readonly", description, + "Object.getOwnPropertyDescriptor must return a fully populated property descriptor"); + } + } + expose_assert(assert_readonly, "assert_readonly"); + + /** + * Assert a JS Error with the expected constructor is thrown. + * + * @param {object} constructor The expected exception constructor. + * @param {Function} func Function which should throw. + * @param {string} [description] Error description for the case that the error is not thrown. + */ + function assert_throws_js(constructor, func, description) + { + assert_throws_js_impl(constructor, func, description, + "assert_throws_js"); } - expose(assert_readonly, "assert_readonly"); + expose_assert(assert_throws_js, "assert_throws_js"); - function assert_throws(code, func, description) + /** + * Like assert_throws_js but allows specifying the assertion type + * (assert_throws_js or promise_rejects_js, in practice). + */ + function assert_throws_js_impl(constructor, func, description, + assertion_type) { try { func.call(this); - assert(false, "assert_throws", description, + assert(false, assertion_type, description, "${func} did not throw", {func:func}); } catch (e) { if (e instanceof AssertionError) { throw e; } - if (code === null) { - return; + + // Basic sanity-checks on the thrown exception. + assert(typeof e === "object", + assertion_type, description, + "${func} threw ${e} with type ${type}, not an object", + {func:func, e:e, type:typeof e}); + + assert(e !== null, + assertion_type, description, + "${func} threw null, not an object", + {func:func}); + + // Basic sanity-check on the passed-in constructor + assert(typeof constructor === "function", + assertion_type, description, + "${constructor} is not a constructor", + {constructor:constructor}); + var obj = constructor; + while (obj) { + if (typeof obj === "function" && + obj.name === "Error") { + break; + } + obj = Object.getPrototypeOf(obj); } - if (typeof code === "object") { - assert(typeof e == "object" && "name" in e && e.name == code.name, - "assert_throws", description, - "${func} threw ${actual} (${actual_name}) expected ${expected} (${expected_name})", - {func:func, actual:e, actual_name:e.name, - expected:code, - expected_name:code.name}); - return; + assert(obj != null, + assertion_type, description, + "${constructor} is not an Error subtype", + {constructor:constructor}); + + // And checking that our exception is reasonable + assert(e.constructor === constructor && + e.name === constructor.name, + assertion_type, description, + "${func} threw ${actual} (${actual_name}) expected instance of ${expected} (${expected_name})", + {func:func, actual:e, actual_name:e.name, + expected:constructor, + expected_name:constructor.name}); + } + } + + // TODO: Figure out how to document the overloads better. + // sphinx-js doesn't seem to handle @variation correctly, + // and only expects a single JSDoc entry per function. + /** + * Assert a DOMException with the expected type is thrown. + * + * There are two ways of calling assert_throws_dom: + * + * 1) If the DOMException is expected to come from the current global, the + * second argument should be the function expected to throw and a third, + * optional, argument is the assertion description. + * + * 2) If the DOMException is expected to come from some other global, the + * second argument should be the DOMException constructor from that global, + * the third argument the function expected to throw, and the fourth, optional, + * argument the assertion description. + * + * @param {number|string} type - The expected exception name or + * code. See the `table of names and codes + * `_. If a + * number is passed it should be one of the numeric code values in + * that table (e.g. 3, 4, etc). If a string is passed it can + * either be an exception name (e.g. "HierarchyRequestError", + * "WrongDocumentError") or the name of the corresponding error + * code (e.g. "``HIERARCHY_REQUEST_ERR``", "``WRONG_DOCUMENT_ERR``"). + * @param {Function} descriptionOrFunc - The function expected to + * throw (if the exception comes from another global), or the + * optional description of the condition being tested (if the + * exception comes from the current global). + * @param {string} [description] - Description of the condition + * being tested (if the exception comes from another global). + * + */ + function assert_throws_dom(type, funcOrConstructor, descriptionOrFunc, maybeDescription) + { + let constructor, func, description; + if (funcOrConstructor.name === "DOMException") { + constructor = funcOrConstructor; + func = descriptionOrFunc; + description = maybeDescription; + } else { + constructor = self.DOMException; + func = funcOrConstructor; + description = descriptionOrFunc; + assert(maybeDescription === undefined, + "Too many args passed to no-constructor version of assert_throws_dom, or accidentally explicitly passed undefined"); + } + assert_throws_dom_impl(type, func, description, "assert_throws_dom", constructor); + } + expose_assert(assert_throws_dom, "assert_throws_dom"); + + /** + * Similar to assert_throws_dom but allows specifying the assertion type + * (assert_throws_dom or promise_rejects_dom, in practice). The + * "constructor" argument must be the DOMException constructor from the + * global we expect the exception to come from. + */ + function assert_throws_dom_impl(type, func, description, assertion_type, constructor) + { + try { + func.call(this); + assert(false, assertion_type, description, + "${func} did not throw", {func:func}); + } catch (e) { + if (e instanceof AssertionError) { + throw e; } - var code_name_map = { + // Basic sanity-checks on the thrown exception. + assert(typeof e === "object", + assertion_type, description, + "${func} threw ${e} with type ${type}, not an object", + {func:func, e:e, type:typeof e}); + + assert(e !== null, + assertion_type, description, + "${func} threw null, not an object", + {func:func}); + + // Sanity-check our type + assert(typeof type === "number" || + typeof type === "string", + assertion_type, description, + "${type} is not a number or string", + {type:type}); + + var codename_name_map = { INDEX_SIZE_ERR: 'IndexSizeError', HIERARCHY_REQUEST_ERR: 'HierarchyRequestError', WRONG_DOCUMENT_ERR: 'WrongDocumentError', @@ -1210,14 +2353,11 @@ policies and contribution forms [3]. NETWORK_ERR: 'NetworkError', ABORT_ERR: 'AbortError', URL_MISMATCH_ERR: 'URLMismatchError', - QUOTA_EXCEEDED_ERR: 'QuotaExceededError', TIMEOUT_ERR: 'TimeoutError', INVALID_NODE_TYPE_ERR: 'InvalidNodeTypeError', DATA_CLONE_ERR: 'DataCloneError' }; - var name = code in code_name_map ? code_name_map[code] : code; - var name_code_map = { IndexSizeError: 1, HierarchyRequestError: 3, @@ -1237,7 +2377,6 @@ policies and contribution forms [3]. NetworkError: 19, AbortError: 20, URLMismatchError: 21, - QuotaExceededError: 22, TimeoutError: 23, InvalidNodeTypeError: 24, DataCloneError: 25, @@ -1251,107 +2390,406 @@ policies and contribution forms [3]. ReadOnlyError: 0, VersionError: 0, OperationError: 0, - NotAllowedError: 0 + NotAllowedError: 0, + OptOutError: 0 }; - if (!(name in name_code_map)) { - throw new AssertionError('Test bug: unrecognized DOMException code "' + code + '" passed to assert_throws()'); + var code_name_map = {}; + for (var key in name_code_map) { + if (name_code_map[key] > 0) { + code_name_map[name_code_map[key]] = key; + } } - var required_props = { code: name_code_map[name] }; + var required_props = {}; + var name; + + if (typeof type === "number") { + if (type === 0) { + throw new AssertionError('Test bug: ambiguous DOMException code 0 passed to assert_throws_dom()'); + } + if (type === 22) { + throw new AssertionError('Test bug: QuotaExceededError needs to be tested for using assert_throws_quotaexceedederror()'); + } + if (!(type in code_name_map)) { + throw new AssertionError('Test bug: unrecognized DOMException code "' + type + '" passed to assert_throws_dom()'); + } + name = code_name_map[type]; + required_props.code = type; + } else if (typeof type === "string") { + if (name === "QuotaExceededError") { + throw new AssertionError('Test bug: QuotaExceededError needs to be tested for using assert_throws_quotaexceedederror()'); + } + name = type in codename_name_map ? codename_name_map[type] : type; + if (!(name in name_code_map)) { + throw new AssertionError('Test bug: unrecognized DOMException code name or name "' + type + '" passed to assert_throws_dom()'); + } + + required_props.code = name_code_map[name]; + } if (required_props.code === 0 || - (typeof e == "object" && - "name" in e && + ("name" in e && e.name !== e.name.toUpperCase() && e.name !== "DOMException")) { // New style exception: also test the name property. required_props.name = name; } - //We'd like to test that e instanceof the appropriate interface, - //but we can't, because we don't know what window it was created - //in. It might be an instanceof the appropriate interface on some - //unknown other window. TODO: Work around this somehow? - - assert(typeof e == "object", - "assert_throws", description, - "${func} threw ${e} with type ${type}, not an object", - {func:func, e:e, type:typeof e}); - for (var prop in required_props) { - assert(typeof e == "object" && prop in e && e[prop] == required_props[prop], - "assert_throws", description, - "${func} threw ${e} that is not a DOMException " + code + ": property ${prop} is equal to ${actual}, expected ${expected}", + assert(prop in e && e[prop] == required_props[prop], + assertion_type, description, + "${func} threw ${e} that is not a DOMException " + type + ": property ${prop} is equal to ${actual}, expected ${expected}", {func:func, e:e, prop:prop, actual:e[prop], expected:required_props[prop]}); } - } - } - expose(assert_throws, "assert_throws"); - function assert_unreached(description) { - assert(false, "assert_unreached", description, - "Reached unreachable code"); - } - expose(assert_unreached, "assert_unreached"); + // Check that the exception is from the right global. This check is last + // so more specific, and more informative, checks on the properties can + // happen in case a totally incorrect exception is thrown. + assert(e.constructor === constructor, + assertion_type, description, + "${func} threw an exception from the wrong global", + {func}); - function assert_any(assert_func, actual, expected_array) - { - var args = [].slice.call(arguments, 3); - var errors = []; - var passed = false; - forEach(expected_array, - function(expected) - { - try { - assert_func.apply(this, [actual, expected].concat(args)); - passed = true; - } catch (e) { - errors.push(e.message); - } - }); - if (!passed) { - throw new AssertionError(errors.join("\n\n")); } } - expose(assert_any, "assert_any"); - function Test(name, properties) + /** + * Assert a `QuotaExceededError` with the expected values is thrown. + * + * There are two ways of calling `assert_throws_quotaexceedederror`: + * + * 1) If the `QuotaExceededError` is expected to come from the + * current global, the first argument should be the function + * expected to throw, the second and a third the expected + * `requested` and `quota` property values, and the fourth, + * optional, argument is the assertion description. + * + * 2) If the `QuotaExceededError` is expected to come from some + * other global, the first argument should be the + * `QuotaExceededError` constructor from that global, the second + * argument should be the function expected to throw, the third + * and fourth the expected `requested` and `quota` property + * values, and the fifth, optional, argument is the assertion + * description. + * + * For the `requested` and `quota` values, instead of `null` or a + * number, the caller can provide a function which determines + * whether the value is acceptable by returning a boolean. + * + */ + function assert_throws_quotaexceedederror(funcOrConstructor, requestedOrFunc, quotaOrRequested, descriptionOrQuota, maybeDescription) { - if (tests.file_is_test && tests.tests.length) { - throw new Error("Tried to create a test with file_is_test"); - } - this.name = name; - - this.phase = this.phases.INITIAL; - - this.status = this.NOTRUN; - this.timeout_id = null; - this.index = null; - - this.properties = properties; - var timeout = properties.timeout ? properties.timeout : settings.test_timeout; - if (timeout !== null) { - this.timeout_length = timeout * tests.timeout_multiplier; + let constructor, func, requested, quota, description; + if (funcOrConstructor.name === "QuotaExceededError") { + constructor = funcOrConstructor; + func = requestedOrFunc; + requested = quotaOrRequested; + quota = descriptionOrQuota; + description = maybeDescription; } else { - this.timeout_length = null; + constructor = self.QuotaExceededError; + func = funcOrConstructor; + requested = requestedOrFunc; + quota = quotaOrRequested; + description = descriptionOrQuota; + assert(maybeDescription === undefined, + "Too many args passed to no-constructor version of assert_throws_quotaexceedederror"); } + assert_throws_quotaexceedederror_impl(func, requested, quota, description, "assert_throws_quotaexceedederror", constructor); + } + expose_assert(assert_throws_quotaexceedederror, "assert_throws_quotaexceedederror"); + + /** + * Similar to `assert_throws_quotaexceedederror` but allows + * specifying the assertion type + * (`"assert_throws_quotaexceedederror"` or + * `"promise_rejects_quotaexceedederror"`, in practice). The + * `constructor` argument must be the `QuotaExceededError` + * constructor from the global we expect the exception to come from. + */ + function assert_throws_quotaexceedederror_impl(func, requested, quota, description, assertion_type, constructor) + { + try { + func.call(this); + assert(false, assertion_type, description, "${func} did not throw", + {func}); + } catch (e) { + if (e instanceof AssertionError) { + throw e; + } + + // Basic sanity-checks on the thrown exception. + assert(typeof e === "object", + assertion_type, description, + "${func} threw ${e} with type ${type}, not an object", + {func, e, type:typeof e}); + + assert(e !== null, + assertion_type, description, + "${func} threw null, not an object", + {func}); + + // Sanity-check our requested and quota. + assert(requested === null || + typeof requested === "number" || + typeof requested === "function", + assertion_type, description, + "${requested} is not null, a number, or a function", + {requested}); + assert(quota === null || + typeof quota === "number" || + typeof quota === "function", + assertion_type, description, + "${quota} is not null or a number", + {quota}); + + const required_props = { + code: 22, + name: "QuotaExceededError" + }; + if (typeof requested !== "function") { + required_props.requested = requested; + } + if (typeof quota !== "function") { + required_props.quota = quota; + } + + for (const [prop, expected] of Object.entries(required_props)) { + assert(prop in e && e[prop] == expected, + assertion_type, description, + "${func} threw ${e} that is not a correct QuotaExceededError: property ${prop} is equal to ${actual}, expected ${expected}", + {func, e, prop, actual:e[prop], expected}); + } + + if (typeof requested === "function") { + assert(requested(e.requested), + assertion_type, description, + "${func} threw ${e} that is not a correct QuotaExceededError: requested value ${requested} did not pass the requested predicate", + {func, e, requested}); + } + if (typeof quota === "function") { + assert(quota(e.quota), + assertion_type, description, + "${func} threw ${e} that is not a correct QuotaExceededError: quota value ${quota} did not pass the quota predicate", + {func, e, quota}); + } + + // Check that the exception is from the right global. This check is last + // so more specific, and more informative, checks on the properties can + // happen in case a totally incorrect exception is thrown. + assert(e.constructor === constructor, + assertion_type, description, + "${func} threw an exception from the wrong global", + {func}); + } + } + + /** + * Assert the provided value is thrown. + * + * @param {value} exception The expected exception. + * @param {Function} func Function which should throw. + * @param {string} [description] Error description for the case that the error is not thrown. + */ + function assert_throws_exactly(exception, func, description) + { + assert_throws_exactly_impl(exception, func, description, + "assert_throws_exactly"); + } + expose_assert(assert_throws_exactly, "assert_throws_exactly"); + + /** + * Like assert_throws_exactly but allows specifying the assertion type + * (assert_throws_exactly or promise_rejects_exactly, in practice). + */ + function assert_throws_exactly_impl(exception, func, description, + assertion_type) + { + try { + func.call(this); + assert(false, assertion_type, description, + "${func} did not throw", {func:func}); + } catch (e) { + if (e instanceof AssertionError) { + throw e; + } + + assert(same_value(e, exception), assertion_type, description, + "${func} threw ${e} but we expected it to throw ${exception}", + {func:func, e:e, exception:exception}); + } + } + + /** + * Asserts if called. Used to ensure that a specific codepath is + * not taken e.g. that an error event isn't fired. + * + * @param {string} [description] - Description of the condition being tested. + */ + function assert_unreached(description) { + assert(false, "assert_unreached", description, + "Reached unreachable code"); + } + expose_assert(assert_unreached, "assert_unreached"); + + /** + * @callback AssertFunc + * @param {Any} actual + * @param {Any} expected + * @param {Any[]} args + */ + + /** + * Asserts that ``actual`` matches at least one value of ``expected`` + * according to a comparison defined by ``assert_func``. + * + * Note that tests with multiple allowed pass conditions are bad + * practice unless the spec specifically allows multiple + * behaviours. Test authors should not use this method simply to + * hide UA bugs. + * + * @param {AssertFunc} assert_func - Function to compare actual + * and expected. It must throw when the comparison fails and + * return when the comparison passes. + * @param {Any} actual - Test value. + * @param {Array} expected_array - Array of possible expected values. + * @param {Any[]} args - Additional arguments to pass to ``assert_func``. + */ + function assert_any(assert_func, actual, expected_array, ...args) + { + var errors = []; + var passed = false; + forEach(expected_array, + function(expected) + { + try { + assert_func.apply(this, [actual, expected].concat(args)); + passed = true; + } catch (e) { + errors.push(e.message); + } + }); + if (!passed) { + throw new AssertionError(errors.join("\n\n")); + } + } + // FIXME: assert_any cannot use expose_assert, because assert_wrapper does + // not support nested assert calls (e.g. to assert_func). We need to + // support bypassing assert_wrapper for the inner asserts here. + expose(assert_any, "assert_any"); + + /** + * Assert that a feature is implemented, based on a 'truthy' condition. + * + * This function should be used to early-exit from tests in which there is + * no point continuing without support for a non-optional spec or spec + * feature. For example: + * + * assert_implements(window.Foo, 'Foo is not supported'); + * + * @param {object} condition The truthy value to test + * @param {string} [description] Error description for the case that the condition is not truthy. + */ + function assert_implements(condition, description) { + assert(!!condition, "assert_implements", description); + } + expose_assert(assert_implements, "assert_implements"); + /** + * Assert that an optional feature is implemented, based on a 'truthy' condition. + * + * This function should be used to early-exit from tests in which there is + * no point continuing without support for an explicitly optional spec or + * spec feature. For example: + * + * assert_implements_optional(video.canPlayType("video/webm"), + * "webm video playback not supported"); + * + * @param {object} condition The truthy value to test + * @param {string} [description] Error description for the case that the condition is not truthy. + */ + function assert_implements_optional(condition, description) { + if (!condition) { + throw new OptionalFeatureUnsupportedError(description); + } + } + expose_assert(assert_implements_optional, "assert_implements_optional"); + + /** + * @class + * + * A single subtest. A Test is not constructed directly but via the + * :js:func:`test`, :js:func:`async_test` or :js:func:`promise_test` functions. + * + * @param {string} name - This must be unique in a given file and must be + * invariant between runs. + * + */ + function Test(name, properties) + { + if (tests.file_is_test && tests.tests.length) { + throw new Error("Tried to create a test with file_is_test"); + } + /** The test name. */ + this.name = name; + + this.phase = (tests.is_aborted || tests.phase === tests.phases.COMPLETE) ? + this.phases.COMPLETE : this.phases.INITIAL; + + /** The test status code.*/ + this.status = this.NOTRUN; + this.timeout_id = null; + this.index = null; + + this.properties = properties || {}; + this.timeout_length = settings.test_timeout; + if (this.timeout_length !== null) { + this.timeout_length *= tests.timeout_multiplier; + } + + /** A message indicating the reason for test failure. */ this.message = null; + /** Stack trace in case of failure. */ this.stack = null; this.steps = []; + this._is_promise_test = false; this.cleanup_callbacks = []; + this._user_defined_cleanup_count = 0; + this._done_callbacks = []; + + if (typeof AbortController === "function") { + this._abortController = new AbortController(); + } + + // Tests declared following harness completion are likely an indication + // of a programming error, but they cannot be reported + // deterministically. + if (tests.phase === tests.phases.COMPLETE) { + return; + } tests.push(this); } + /** + * Enum of possible test statuses. + * + * :values: + * - ``PASS`` + * - ``FAIL`` + * - ``TIMEOUT`` + * - ``NOTRUN`` + * - ``PRECONDITION_FAILED`` + */ Test.statuses = { PASS:0, FAIL:1, TIMEOUT:2, - NOTRUN:3 + NOTRUN:3, + PRECONDITION_FAILED:4 }; Test.prototype = merge({}, Test.statuses); @@ -1360,7 +2798,20 @@ policies and contribution forms [3]. INITIAL:0, STARTED:1, HAS_RESULT:2, - COMPLETE:3 + CLEANING:3, + COMPLETE:4 + }; + + Test.prototype.status_formats = { + 0: "Pass", + 1: "Fail", + 2: "Timeout", + 3: "Not Run", + 4: "Optional Feature Unsupported", + }; + + Test.prototype.format_status = function() { + return this.status_formats[this.status]; }; Test.prototype.structured_clone = function() @@ -1371,25 +2822,41 @@ policies and contribution forms [3]. this._structured_clone = merge({ name:String(this.name), properties:merge({}, this.properties), + phases:merge({}, this.phases) }, Test.statuses); } this._structured_clone.status = this.status; this._structured_clone.message = this.message; this._structured_clone.stack = this.stack; this._structured_clone.index = this.index; + this._structured_clone.phase = this.phase; return this._structured_clone; }; + /** + * Run a single step of an ongoing test. + * + * @param {string} func - Callback function to run as a step. If + * this throws an :js:func:`AssertionError`, or any other + * exception, the :js:class:`Test` status is set to ``FAIL``. + * @param {Object} [this_obj] - The object to use as the this + * value when calling ``func``. Defaults to the :js:class:`Test` object. + */ Test.prototype.step = function(func, this_obj) { if (this.phase > this.phases.STARTED) { return; } + + if (settings.debug && this.phase !== this.phases.STARTED) { + console.log("TEST START", this.name); + } this.phase = this.phases.STARTED; - //If we don't get a result before the harness times out that will be a test timout + //If we don't get a result before the harness times out that will be a test timeout this.set_status(this.TIMEOUT, "Test timed out"); tests.started = true; + tests.current_test = this; tests.notify_test_state(this); if (this.timeout_id === null) { @@ -1402,21 +2869,48 @@ policies and contribution forms [3]. this_obj = this; } + if (settings.debug) { + console.debug("TEST STEP", this.name); + } + try { return func.apply(this_obj, Array.prototype.slice.call(arguments, 2)); } catch (e) { if (this.phase >= this.phases.HAS_RESULT) { return; } + var status = e instanceof OptionalFeatureUnsupportedError ? this.PRECONDITION_FAILED : this.FAIL; var message = String((typeof e === "object" && e !== null) ? e.message : e); var stack = e.stack ? e.stack : null; - this.set_status(this.FAIL, message, stack); + this.set_status(status, message, stack); this.phase = this.phases.HAS_RESULT; this.done(); + } finally { + this.current_test = null; } }; + /** + * Wrap a function so that it runs as a step of the current test. + * + * This allows creating a callback function that will run as a + * test step. + * + * @example + * let t = async_test("Example"); + * onload = t.step_func(e => { + * assert_equals(e.name, "load"); + * // Mark the test as complete. + * t.done(); + * }) + * + * @param {string} func - Function to run as a step. If this + * throws an :js:func:`AssertionError`, or any other exception, + * the :js:class:`Test` status is set to ``FAIL``. + * @param {Object} [this_obj] - The object to use as the this + * value when calling ``func``. Defaults to the :js:class:`Test` object. + */ Test.prototype.step_func = function(func, this_obj) { var test_this = this; @@ -1432,6 +2926,18 @@ policies and contribution forms [3]. }; }; + /** + * Wrap a function so that it runs as a step of the current test, + * and automatically marks the test as complete if the function + * returns without error. + * + * @param {string} func - Function to run as a step. If this + * throws an :js:func:`AssertionError`, or any other exception, + * the :js:class:`Test` status is set to ``FAIL``. If it returns + * without error the status is set to ``PASS``. + * @param {Object} [this_obj] - The object to use as the this + * value when calling `func`. Defaults to the :js:class:`Test` object. + */ Test.prototype.step_func_done = function(func, this_obj) { var test_this = this; @@ -1450,6 +2956,14 @@ policies and contribution forms [3]. }; }; + /** + * Return a function that automatically sets the current test to + * ``FAIL`` if it's called. + * + * @param {string} [description] - Error message to add to assert + * in case of failure. + * + */ Test.prototype.unreached_func = function(description) { return this.step_func(function() { @@ -1457,21 +2971,183 @@ policies and contribution forms [3]. }); }; - Test.prototype.step_timeout = function(f, timeout) { + /** + * Run a function as a step of the test after a given timeout. + * + * This multiplies the timeout by the global timeout multiplier to + * account for the expected execution speed of the current test + * environment. For example ``test.step_timeout(f, 2000)`` with a + * timeout multiplier of 2 will wait for 4000ms before calling ``f``. + * + * In general it's encouraged to use :js:func:`Test.step_wait` or + * :js:func:`step_wait_func` in preference to this function where possible, + * as they provide better test performance. + * + * @param {Function} func - Function to run as a test + * step. + * @param {number} timeout - Time in ms to wait before running the + * test step. The actual wait time is ``timeout`` x + * ``timeout_multiplier``. + * + */ + Test.prototype.step_timeout = function(func, timeout) { var test_this = this; var args = Array.prototype.slice.call(arguments, 2); - return setTimeout(this.step_func(function() { - return f.apply(test_this, args); + var local_set_timeout = typeof global_scope.setTimeout === "undefined" ? fake_set_timeout : setTimeout; + return local_set_timeout(this.step_func(function() { + return func.apply(test_this, args); }), timeout * tests.timeout_multiplier); - } + }; - Test.prototype.add_cleanup = function(callback) { + /** + * Poll for a function to return true, and call a callback + * function once it does, or assert if a timeout is + * reached. This is preferred over a simple step_timeout + * whenever possible since it allows the timeout to be longer + * to reduce intermittents without compromising test execution + * speed when the condition is quickly met. + * + * @param {Function} cond A function taking no arguments and + * returning a boolean or a Promise. The callback is + * called when this function returns true, or the + * returned Promise is resolved with true. + * @param {Function} func A function taking no arguments to call once + * the condition is met. + * @param {string} [description] Error message to add to assert in case of + * failure. + * @param {number} timeout Timeout in ms. This is multiplied by the global + * timeout_multiplier + * @param {number} interval Polling interval in ms + * + */ + Test.prototype.step_wait_func = function(cond, func, description, + timeout=3000, interval=100) { + var timeout_full = timeout * tests.timeout_multiplier; + var remaining = Math.ceil(timeout_full / interval); + var test_this = this; + var local_set_timeout = typeof global_scope.setTimeout === 'undefined' ? fake_set_timeout : setTimeout; + + const step = test_this.step_func((result) => { + if (result) { + func(); + } else { + if (remaining === 0) { + assert(false, "step_wait_func", description, + "Timed out waiting on condition"); + } + remaining--; + local_set_timeout(wait_for_inner, interval); + } + }); + + var wait_for_inner = test_this.step_func(() => { + Promise.resolve(cond()).then( + step, + test_this.unreached_func("step_wait_func")); + }); + + wait_for_inner(); + }; + + /** + * Poll for a function to return true, and invoke a callback + * followed by this.done() once it does, or assert if a timeout + * is reached. This is preferred over a simple step_timeout + * whenever possible since it allows the timeout to be longer + * to reduce intermittents without compromising test execution speed + * when the condition is quickly met. + * + * @example + * async_test(t => { + * const popup = window.open("resources/coop-coep.py?coop=same-origin&coep=&navigate=about:blank"); + * t.add_cleanup(() => popup.close()); + * assert_equals(window, popup.opener); + * + * popup.onload = t.step_func(() => { + * assert_true(popup.location.href.endsWith("&navigate=about:blank")); + * // Use step_wait_func_done as about:blank cannot message back. + * t.step_wait_func_done(() => popup.location.href === "about:blank"); + * }); + * }, "Navigating a popup to about:blank"); + * + * @param {Function} cond A function taking no arguments and + * returning a boolean or a Promise. The callback is + * called when this function returns true, or the + * returned Promise is resolved with true. + * @param {Function} func A function taking no arguments to call once + * the condition is met. + * @param {string} [description] Error message to add to assert in case of + * failure. + * @param {number} timeout Timeout in ms. This is multiplied by the global + * timeout_multiplier + * @param {number} interval Polling interval in ms + * + */ + Test.prototype.step_wait_func_done = function(cond, func, description, + timeout=3000, interval=100) { + this.step_wait_func(cond, () => { + if (func) { + func(); + } + this.done(); + }, description, timeout, interval); + }; + + /** + * Poll for a function to return true, and resolve a promise + * once it does, or assert if a timeout is reached. This is + * preferred over a simple step_timeout whenever possible + * since it allows the timeout to be longer to reduce + * intermittents without compromising test execution speed + * when the condition is quickly met. + * + * @example + * promise_test(async t => { + * // … + * await t.step_wait(() => frame.contentDocument === null, "Frame navigated to a cross-origin document"); + * // … + * }, ""); + * + * @param {Function} cond A function taking no arguments and + * returning a boolean or a Promise. + * @param {string} [description] Error message to add to assert in case of + * failure. + * @param {number} timeout Timeout in ms. This is multiplied by the global + * timeout_multiplier + * @param {number} interval Polling interval in ms + * @returns {Promise} Promise resolved once cond is met. + * + */ + Test.prototype.step_wait = function(cond, description, timeout=3000, interval=100) { + return new Promise(resolve => { + this.step_wait_func(cond, resolve, description, timeout, interval); + }); + }; + + /* + * Private method for registering cleanup functions. `testharness.js` + * internals should use this method instead of the public `add_cleanup` + * method in order to hide implementation details from the harness status + * message in the case errors. + */ + Test.prototype._add_cleanup = function(callback) { this.cleanup_callbacks.push(callback); }; - Test.prototype.force_timeout = function() { - this.set_status(this.TIMEOUT); - this.phase = this.phases.HAS_RESULT; + /** + * Schedule a function to be run after the test result is known, regardless + * of passing or failing state. + * + * The behavior of this function will not + * influence the result of the test, but if an exception is thrown, the + * test harness will report an error. + * + * @param {Function} callback - The cleanup function to run. This + * is called with no arguments. + */ + Test.prototype.add_cleanup = function(callback) { + this._user_defined_cleanup_count += 1; + this._add_cleanup(callback); }; Test.prototype.set_timeout = function() @@ -1492,6 +3168,9 @@ policies and contribution forms [3]. this.stack = stack ? stack : null; }; + /** + * Manually set the test status to ``TIMEOUT``. + */ Test.prototype.timeout = function() { this.timeout_id = null; @@ -1500,9 +3179,28 @@ policies and contribution forms [3]. this.done(); }; + /** + * Manually set the test status to ``TIMEOUT``. + * + * Alias for `Test.timeout <#Test.timeout>`_. + */ + Test.prototype.force_timeout = function() { + return this.timeout(); + }; + + /** + * Mark the test as complete. + * + * This sets the test status to ``PASS`` if no other status was + * already recorded. Any subsequent attempts to run additional + * test steps will be ignored. + * + * After setting the test status any test cleanup functions will + * be run. + */ Test.prototype.done = function() { - if (this.phase == this.phases.COMPLETE) { + if (this.phase >= this.phases.CLEANING) { return; } @@ -1510,21 +3208,156 @@ policies and contribution forms [3]. this.set_status(this.PASS, null); } - this.phase = this.phases.COMPLETE; + if (global_scope.clearTimeout) { + clearTimeout(this.timeout_id); + } + + if (settings.debug) { + console.log("TEST DONE", + this.status, + this.name); + } - clearTimeout(this.timeout_id); - tests.result(this); this.cleanup(); }; + function add_test_done_callback(test, callback) + { + if (test.phase === test.phases.COMPLETE) { + callback(); + return; + } + + test._done_callbacks.push(callback); + } + + /* + * Invoke all specified cleanup functions. If one or more produce an error, + * the context is in an unpredictable state, so all further testing should + * be cancelled. + */ Test.prototype.cleanup = function() { + var errors = []; + var bad_value_count = 0; + function on_error(e) { + errors.push(e); + // Abort tests immediately so that tests declared within subsequent + // cleanup functions are not run. + tests.abort(); + } + var this_obj = this; + var results = []; + + this.phase = this.phases.CLEANING; + + if (this._abortController) { + this._abortController.abort("Test cleanup"); + } + forEach(this.cleanup_callbacks, function(cleanup_callback) { - cleanup_callback(); + var result; + + try { + result = cleanup_callback(); + } catch (e) { + on_error(e); + return; + } + + if (!is_valid_cleanup_result(this_obj, result)) { + bad_value_count += 1; + // Abort tests immediately so that tests declared + // within subsequent cleanup functions are not run. + tests.abort(); + } + + results.push(result); }); + + if (!this._is_promise_test) { + cleanup_done(this_obj, errors, bad_value_count); + } else { + all_async(results, + function(result, done) { + if (result && typeof result.then === "function") { + result + .then(null, on_error) + .then(done); + } else { + done(); + } + }, + function() { + cleanup_done(this_obj, errors, bad_value_count); + }); + } }; /* + * Determine if the return value of a cleanup function is valid for a given + * test. Any test may return the value `undefined`. Tests created with + * `promise_test` may alternatively return "thenable" object values. + */ + function is_valid_cleanup_result(test, result) { + if (result === undefined) { + return true; + } + + if (test._is_promise_test) { + return result && typeof result.then === "function"; + } + + return false; + } + + function cleanup_done(test, errors, bad_value_count) { + if (errors.length || bad_value_count) { + var total = test._user_defined_cleanup_count; + + tests.status.status = tests.status.ERROR; + tests.status.stack = null; + tests.status.message = "Test named '" + test.name + + "' specified " + total + + " 'cleanup' function" + (total > 1 ? "s" : ""); + + if (errors.length) { + tests.status.message += ", and " + errors.length + " failed"; + tests.status.stack = ((typeof errors[0] === "object" && + errors[0].hasOwnProperty("stack")) ? + errors[0].stack : null); + } + + if (bad_value_count) { + var type = test._is_promise_test ? + "non-thenable" : "non-undefined"; + tests.status.message += ", and " + bad_value_count + + " returned a " + type + " value"; + } + + tests.status.message += "."; + } + + test.phase = test.phases.COMPLETE; + tests.result(test); + forEach(test._done_callbacks, + function(callback) { + callback(); + }); + test._done_callbacks.length = 0; + } + + /** + * Gives an AbortSignal that will be aborted when the test finishes. + */ + Test.prototype.get_signal = function() { + if (!this._abortController) { + throw new Error("AbortController is not supported in this browser"); + } + return this._abortController.signal; + }; + + /** * A RemoteTest object mirrors a Test object on a remote worker. The * associated RemoteWorker updates the RemoteTest object in response to * received events. In turn, the RemoteTest object replicates these events @@ -1540,6 +3373,7 @@ policies and contribution forms [3]. this.index = null; this.phase = this.phases.INITIAL; this.update_state_from(clone); + this._done_callbacks = []; tests.push(this); } @@ -1547,17 +3381,40 @@ policies and contribution forms [3]. var clone = {}; Object.keys(this).forEach( (function(key) { - if (typeof(this[key]) === "object") { - clone[key] = merge({}, this[key]); + var value = this[key]; + // `RemoteTest` instances are responsible for managing + // their own "done" callback functions, so those functions + // are not relevant in other execution contexts. Because of + // this (and because Function values cannot be serialized + // for cross-realm transmittance), the property should not + // be considered when cloning instances. + if (key === '_done_callbacks' ) { + return; + } + + if (typeof value === "object" && value !== null) { + clone[key] = merge({}, value); } else { - clone[key] = this[key]; + clone[key] = value; } }).bind(this)); clone.phases = merge({}, this.phases); return clone; }; - RemoteTest.prototype.cleanup = function() {}; + /** + * `RemoteTest` instances are objects which represent tests running in + * another realm. They do not define "cleanup" functions (if necessary, + * such functions are defined on the associated `Test` instance within the + * external realm). However, `RemoteTests` may have "done" callbacks (e.g. + * as attached by the `Tests` instance responsible for tracking the overall + * test status in the parent realm). The `cleanup` method delegates to + * `done` in order to ensure that such callbacks are invoked following the + * completion of the `RemoteTest`. + */ + RemoteTest.prototype.cleanup = function() { + this.done(); + }; RemoteTest.prototype.phases = Test.prototype.phases; RemoteTest.prototype.update_state_from = function(clone) { this.status = clone.status; @@ -1569,76 +3426,103 @@ policies and contribution forms [3]. }; RemoteTest.prototype.done = function() { this.phase = this.phases.COMPLETE; - } + + forEach(this._done_callbacks, + function(callback) { + callback(); + }); + }; + + RemoteTest.prototype.format_status = function() { + return Test.prototype.status_formats[this.status]; + }; /* - * A RemoteWorker listens for test events from a worker. These events are - * then used to construct and maintain RemoteTest objects that mirror the - * tests running on the remote worker. + * A RemoteContext listens for test events from a remote test context, such + * as another window or a worker. These events are then used to construct + * and maintain RemoteTest objects that mirror the tests running in the + * remote context. + * + * An optional third parameter can be used as a predicate to filter incoming + * MessageEvents. */ - function RemoteWorker(worker) { + function RemoteContext(remote, message_target, message_filter) { this.running = true; + this.started = false; this.tests = new Array(); + this.early_exception = null; var this_obj = this; - worker.onerror = function(error) { this_obj.worker_error(error); }; - - var message_port; + // If remote context is cross origin assigning to onerror is not + // possible, so silently catch those errors. + try { + remote.onerror = function(error) { this_obj.remote_error(error); }; + } catch (e) { + // Ignore. + } - if (is_service_worker(worker)) { - if (window.MessageChannel) { - // The ServiceWorker's implicit MessagePort is currently not - // reliably accessible from the ServiceWorkerGlobalScope due to - // Blink setting MessageEvent.source to null for messages sent - // via ServiceWorker.postMessage(). Until that's resolved, - // create an explicit MessageChannel and pass one end to the - // worker. - var message_channel = new MessageChannel(); - message_port = message_channel.port1; - message_port.start(); - worker.postMessage({type: "connect"}, [message_channel.port2]); - } else { - // If MessageChannel is not available, then try the - // ServiceWorker.postMessage() approach using MessageEvent.source - // on the other end. - message_port = navigator.serviceWorker; - worker.postMessage({type: "connect"}); + // Keeping a reference to the remote object and the message handler until + // remote_done() is seen prevents the remote object and its message channel + // from going away before all the messages are dispatched. + this.remote = remote; + this.message_target = message_target; + this.message_handler = function(message) { + var passesFilter = !message_filter || message_filter(message); + // The reference to the `running` property in the following + // condition is unnecessary because that value is only set to + // `false` after the `message_handler` function has been + // unsubscribed. + // TODO: Simplify the condition by removing the reference. + if (this_obj.running && message.data && passesFilter && + (message.data.type in this_obj.message_handlers)) { + this_obj.message_handlers[message.data.type].call(this_obj, message.data); } - } else if (is_shared_worker(worker)) { - message_port = worker.port; - } else { - message_port = worker; - } + }; - // Keeping a reference to the worker until worker_done() is seen - // prevents the Worker object and its MessageChannel from going away - // before all the messages are dispatched. - this.worker = worker; + if (self.Promise) { + this.done = new Promise(function(resolve) { + this_obj.doneResolve = resolve; + }); + } - message_port.onmessage = - function(message) { - if (this_obj.running && (message.data.type in this_obj.message_handlers)) { - this_obj.message_handlers[message.data.type].call(this_obj, message.data); - } - }; + this.message_target.addEventListener("message", this.message_handler); } - RemoteWorker.prototype.worker_error = function(error) { + RemoteContext.prototype.remote_error = function(error) { + if (error.preventDefault) { + error.preventDefault(); + } + + // Defer interpretation of errors until the testing protocol has + // started and the remote test's `allow_uncaught_exception` property + // is available. + if (!this.started) { + this.early_exception = error; + } else if (!this.allow_uncaught_exception) { + this.report_uncaught(error); + } + }; + + RemoteContext.prototype.report_uncaught = function(error) { var message = error.message || String(error); var filename = (error.filename ? " " + error.filename: ""); - // FIXME: Display worker error states separately from main document + // FIXME: Display remote error states separately from main document // error state. - this.worker_done({ - status: { - status: tests.status.ERROR, - message: "Error in worker" + filename + ": " + message, - stack: error.stack - } - }); - error.preventDefault(); + tests.set_status(tests.status.ERROR, + "Error in remote" + filename + ": " + message, + error.stack); + }; + + RemoteContext.prototype.start = function(data) { + this.started = true; + this.allow_uncaught_exception = data.properties.allow_uncaught_exception; + + if (this.early_exception && !this.allow_uncaught_exception) { + this.report_uncaught(this.early_exception); + } }; - RemoteWorker.prototype.test_state = function(data) { + RemoteContext.prototype.test_state = function(data) { var remote_test = this.tests[data.test.index]; if (!remote_test) { remote_test = new RemoteTest(data.test); @@ -1648,52 +3532,97 @@ policies and contribution forms [3]. tests.notify_test_state(remote_test); }; - RemoteWorker.prototype.test_done = function(data) { + RemoteContext.prototype.test_done = function(data) { var remote_test = this.tests[data.test.index]; remote_test.update_state_from(data.test); remote_test.done(); tests.result(remote_test); }; - RemoteWorker.prototype.worker_done = function(data) { + RemoteContext.prototype.remote_done = function(data) { if (tests.status.status === null && data.status.status !== data.status.OK) { - tests.status.status = data.status.status; - tests.status.message = data.status.message; - tests.status.stack = data.status.stack; + tests.set_status(data.status.status, data.status.message, data.status.stack); } + + for (let assert of data.asserts) { + var record = new AssertRecord(); + record.assert_name = assert.assert_name; + record.args = assert.args; + record.test = assert.test != null ? this.tests[assert.test.index] : null; + record.status = assert.status; + record.stack = assert.stack; + tests.asserts_run.push(record); + } + + this.message_target.removeEventListener("message", this.message_handler); this.running = false; - this.worker = null; + + // If remote context is cross origin assigning to onerror is not + // possible, so silently catch those errors. + try { + this.remote.onerror = null; + } catch (e) { + // Ignore. + } + + this.remote = null; + this.message_target = null; + if (this.doneResolve) { + this.doneResolve(); + } + if (tests.all_done()) { tests.complete(); } }; - RemoteWorker.prototype.message_handlers = { - test_state: RemoteWorker.prototype.test_state, - result: RemoteWorker.prototype.test_done, - complete: RemoteWorker.prototype.worker_done + RemoteContext.prototype.message_handlers = { + start: RemoteContext.prototype.start, + test_state: RemoteContext.prototype.test_state, + result: RemoteContext.prototype.test_done, + complete: RemoteContext.prototype.remote_done }; - /* - * Harness + /** + * @class + * Status of the overall harness */ - function TestsStatus() { + /** The status code */ this.status = null; + /** Message in case of failure */ this.message = null; + /** Stack trace in case of an exception. */ this.stack = null; } + /** + * Enum of possible harness statuses. + * + * :values: + * - ``OK`` + * - ``ERROR`` + * - ``TIMEOUT`` + * - ``PRECONDITION_FAILED`` + */ TestsStatus.statuses = { OK:0, ERROR:1, - TIMEOUT:2 + TIMEOUT:2, + PRECONDITION_FAILED:3 }; TestsStatus.prototype = merge({}, TestsStatus.statuses); + TestsStatus.prototype.formats = { + 0: "OK", + 1: "Error", + 2: "Timeout", + 3: "Optional Feature Unsupported" + }; + TestsStatus.prototype.structured_clone = function() { if (!this._structured_clone) { @@ -1708,6 +3637,39 @@ policies and contribution forms [3]. return this._structured_clone; }; + TestsStatus.prototype.format_status = function() { + return this.formats[this.status]; + }; + + /** + * @class + * Record of an assert that ran. + * + * @param {Test} test - The test which ran the assert. + * @param {string} assert_name - The function name of the assert. + * @param {Any} args - The arguments passed to the assert function. + */ + function AssertRecord(test, assert_name, args = []) { + /** Name of the assert that ran */ + this.assert_name = assert_name; + /** Test that ran the assert */ + this.test = test; + // Avoid keeping complex objects alive + /** Stringification of the arguments that were passed to the assert function */ + this.args = args.map(x => format_value(x).replace(/\n/g, " ")); + /** Status of the assert */ + this.status = null; + } + + AssertRecord.prototype.structured_clone = function() { + return { + assert_name: this.assert_name, + test: this.test ? this.test.structured_clone() : null, + args: this.args, + status: this.status, + }; + }; + function Tests() { this.tests = []; @@ -1730,6 +3692,10 @@ policies and contribution forms [3]. this.allow_uncaught_exception = false; this.file_is_test = false; + // This value is lazily initialized in order to avoid introducing a + // dependency on ECMAScript 2015 Promises to all tests. + this.promise_tests = null; + this.promise_setup_called = false; this.timeout_multiplier = 1; this.timeout_length = test_environment.test_timeout(); @@ -1740,7 +3706,20 @@ policies and contribution forms [3]. this.test_done_callbacks = []; this.all_done_callbacks = []; - this.pending_workers = []; + this.hide_test_state = false; + this.remotes = []; + + this.current_test = null; + this.asserts_run = []; + + // Track whether output is enabled, and thus whether or not we should + // track asserts. + // + // On workers we don't get properties set from testharnessreport.js, so + // we don't know whether or not to track asserts. To avoid the + // resulting performance hit, we assume we are not meant to. This means + // that assert tracking does not function on workers. + this.output = settings.output && 'document' in global_scope; this.status = new TestsStatus(); @@ -1770,18 +3749,29 @@ policies and contribution forms [3]. for (var p in properties) { if (properties.hasOwnProperty(p)) { var value = properties[p]; - if (p == "allow_uncaught_exception") { + if (p === "allow_uncaught_exception") { this.allow_uncaught_exception = value; - } else if (p == "explicit_done" && value) { + } else if (p === "explicit_done" && value) { this.wait_for_finish = true; - } else if (p == "explicit_timeout" && value) { + } else if (p === "explicit_timeout" && value) { this.timeout_length = null; if (this.timeout_id) { clearTimeout(this.timeout_id); } - } else if (p == "timeout_multiplier") { + } else if (p === "single_test" && value) { + this.set_file_is_test(); + } else if (p === "timeout_multiplier") { this.timeout_multiplier = value; + if (this.timeout_length) { + this.timeout_length *= this.timeout_multiplier; + } + } else if (p === "hide_test_state") { + this.hide_test_state = value; + } else if (p === "output") { + this.output = value; + } else if (p === "debug") { + settings.debug = value; } } } @@ -1790,9 +3780,10 @@ policies and contribution forms [3]. try { func(); } catch (e) { - this.status.status = this.status.ERROR; + this.status.status = e instanceof OptionalFeatureUnsupportedError ? this.status.PRECONDITION_FAILED : this.status.ERROR; this.status.message = String(e); this.status.stack = e.stack ? e.stack : null; + this.complete(); } } this.set_timeout(); @@ -1805,23 +3796,58 @@ policies and contribution forms [3]. this.wait_for_finish = true; this.file_is_test = true; // Create the test, which will add it to the list of tests - async_test(); + tests.current_test = async_test(); + }; + + Tests.prototype.set_status = function(status, message, stack) + { + this.status.status = status; + this.status.message = message; + this.status.stack = stack ? stack : null; }; Tests.prototype.set_timeout = function() { - var this_obj = this; - clearTimeout(this.timeout_id); - if (this.timeout_length !== null) { - this.timeout_id = setTimeout(function() { - this_obj.timeout(); - }, this.timeout_length); + if (global_scope.clearTimeout) { + var this_obj = this; + clearTimeout(this.timeout_id); + if (this.timeout_length !== null) { + this.timeout_id = setTimeout(function() { + this_obj.timeout(); + }, this.timeout_length); + } } }; Tests.prototype.timeout = function() { + var test_in_cleanup = null; + if (this.status.status === null) { - this.status.status = this.status.TIMEOUT; + forEach(this.tests, + function(test) { + // No more than one test is expected to be in the + // "CLEANUP" phase at any time + if (test.phase === test.phases.CLEANING) { + test_in_cleanup = test; + } + + test.phase = test.phases.COMPLETE; + }); + + // Timeouts that occur while a test is in the "cleanup" phase + // indicate that some global state was not properly reverted. This + // invalidates the overall test execution, so the timeout should be + // reported as an error and cancel the execution of any remaining + // tests. + if (test_in_cleanup) { + this.status.status = this.status.ERROR; + this.status.message = "Timeout while running cleanup for " + + "test named \"" + test_in_cleanup.name + "\"."; + tests.status.stack = null; + } else { + this.status.status = this.status.TIMEOUT; + } } + this.complete(); }; @@ -1835,11 +3861,14 @@ policies and contribution forms [3]. Tests.prototype.push = function(test) { + if (this.phase === this.phases.COMPLETE) { + return; + } if (this.phase < this.phases.HAVE_TESTS) { this.start(); } this.num_pending++; - test.index = this.tests.push(test); + test.index = this.tests.push(test) - 1; this.notify_test_state(test); }; @@ -1852,10 +3881,11 @@ policies and contribution forms [3]. }; Tests.prototype.all_done = function() { - return (this.tests.length > 0 && test_environment.all_loaded && - this.num_pending === 0 && !this.wait_for_finish && + return (this.tests.length > 0 || this.remotes.length > 0) && + test_environment.all_loaded && + (this.num_pending === 0 || this.is_aborted) && !this.wait_for_finish && !this.processing_callbacks && - !this.pending_workers.some(function(w) { return w.running; })); + !this.remotes.some(function(w) { return w.running; }); }; Tests.prototype.start = function() { @@ -1874,10 +3904,11 @@ policies and contribution forms [3]. Tests.prototype.result = function(test) { - if (this.phase > this.phases.HAVE_RESULTS) { - return; + // If the harness has already transitioned beyond the `HAVE_RESULTS` + // phase, subsequent tests should not cause it to revert. + if (this.phase <= this.phases.HAVE_RESULTS) { + this.phase = this.phases.HAVE_RESULTS; } - this.phase = this.phases.HAVE_RESULTS; this.num_pending--; this.notify_result(test); }; @@ -1900,47 +3931,279 @@ policies and contribution forms [3]. if (this.phase === this.phases.COMPLETE) { return; } - this.phase = this.phases.COMPLETE; var this_obj = this; - this.tests.forEach( - function(x) - { - if (x.phase < x.phases.COMPLETE) { - this_obj.notify_result(x); - x.cleanup(); - x.phase = x.phases.COMPLETE; - } - } - ); - this.notify_complete(); + var all_complete = function() { + this_obj.phase = this_obj.phases.COMPLETE; + this_obj.notify_complete(); + }; + var incomplete = filter(this.tests, + function(test) { + return test.phase < test.phases.COMPLETE; + }); + + /** + * To preserve legacy behavior, overall test completion must be + * signaled synchronously. + */ + if (incomplete.length === 0) { + all_complete(); + return; + } + + all_async(incomplete, + function(test, testDone) + { + if (test.phase === test.phases.INITIAL) { + test.phase = test.phases.HAS_RESULT; + test.done(); + testDone(); + } else { + add_test_done_callback(test, testDone); + test.cleanup(); + } + }, + all_complete); + }; + + Tests.prototype.set_assert = function(assert_name, args) { + this.asserts_run.push(new AssertRecord(this.current_test, assert_name, args)); + }; + + Tests.prototype.set_assert_status = function(index, status, stack) { + let assert_record = this.asserts_run[index]; + assert_record.status = status; + assert_record.stack = stack; + }; + + /** + * Update the harness status to reflect an unrecoverable harness error that + * should cancel all further testing. Update all previously-defined tests + * which have not yet started to indicate that they will not be executed. + */ + Tests.prototype.abort = function() { + this.status.status = this.status.ERROR; + this.is_aborted = true; + + forEach(this.tests, + function(test) { + if (test.phase === test.phases.INITIAL) { + test.phase = test.phases.COMPLETE; + } + }); + }; + + /* + * Determine if any tests share the same `name` property. Return an array + * containing the names of any such duplicates. + */ + Tests.prototype.find_duplicates = function() { + var names = Object.create(null); + var duplicates = []; + + forEach (this.tests, + function(test) + { + if (test.name in names && duplicates.indexOf(test.name) === -1) { + duplicates.push(test.name); + } + names[test.name] = true; + }); + + return duplicates; }; + function code_unit_str(char) { + return 'U+' + char.charCodeAt(0).toString(16); + } + + function sanitize_unpaired_surrogates(str) { + return str.replace( + /([\ud800-\udbff]+)(?![\udc00-\udfff])|(^|[^\ud800-\udbff])([\udc00-\udfff]+)/g, + function(_, low, prefix, high) { + var output = prefix || ""; // prefix may be undefined + var string = low || high; // only one of these alternates can match + for (var i = 0; i < string.length; i++) { + output += code_unit_str(string[i]); + } + return output; + }); + } + + function sanitize_all_unpaired_surrogates(tests) { + forEach (tests, + function (test) + { + var sanitized = sanitize_unpaired_surrogates(test.name); + + if (test.name !== sanitized) { + test.name = sanitized; + delete test._structured_clone; + } + }); + } + Tests.prototype.notify_complete = function() { var this_obj = this; + var duplicates; + if (this.status.status === null) { - this.status.status = this.status.OK; + duplicates = this.find_duplicates(); + + // Some transports adhere to UTF-8's restriction on unpaired + // surrogates. Sanitize the titles so that the results can be + // consistently sent via all transports. + sanitize_all_unpaired_surrogates(this.tests); + + // Test names are presumed to be unique within test files--this + // allows consumers to use them for identification purposes. + // Duplicated names violate this expectation and should therefore + // be reported as an error. + if (duplicates.length) { + this.status.status = this.status.ERROR; + this.status.message = + duplicates.length + ' duplicate test name' + + (duplicates.length > 1 ? 's' : '') + ': "' + + duplicates.join('", "') + '"'; + } else { + this.status.status = this.status.OK; + } } forEach (this.all_done_callbacks, function(callback) { - callback(this_obj.tests, this_obj.status); + callback(this_obj.tests, this_obj.status, this_obj.asserts_run); }); }; + /* + * Constructs a RemoteContext that tracks tests from a specific worker. + */ + Tests.prototype.create_remote_worker = function(worker) { + var message_port; + + if (is_service_worker(worker)) { + message_port = navigator.serviceWorker; + worker.postMessage({type: "connect"}); + } else if (is_shared_worker(worker)) { + message_port = worker.port; + message_port.start(); + } else { + message_port = worker; + } + + return new RemoteContext(worker, message_port); + }; + + /* + * Constructs a RemoteContext that tracks tests from a specific window. + */ + Tests.prototype.create_remote_window = function(remote) { + remote.postMessage({type: "getmessages"}, "*"); + return new RemoteContext( + remote, + window, + function(msg) { + return msg.source === remote; + } + ); + }; + Tests.prototype.fetch_tests_from_worker = function(worker) { if (this.phase >= this.phases.COMPLETE) { return; } - this.pending_workers.push(new RemoteWorker(worker)); + var remoteContext = this.create_remote_worker(worker); + this.remotes.push(remoteContext); + return remoteContext.done; }; + /** + * Get test results from a worker and include them in the current test. + * + * @param {Worker|SharedWorker|ServiceWorker|MessagePort} port - + * Either a worker object or a port connected to a worker which is + * running tests.. + * @returns {Promise} - A promise that's resolved once all the remote tests are complete. + */ function fetch_tests_from_worker(port) { - tests.fetch_tests_from_worker(port); + return tests.fetch_tests_from_worker(port); } expose(fetch_tests_from_worker, 'fetch_tests_from_worker'); + Tests.prototype.fetch_tests_from_window = function(remote) { + if (this.phase >= this.phases.COMPLETE) { + return; + } + + var remoteContext = this.create_remote_window(remote); + this.remotes.push(remoteContext); + return remoteContext.done; + }; + + /** + * Aggregate tests from separate windows or iframes + * into the current document as if they were all part of the same test file. + * + * The document of the second window (or iframe) should include + * ``testharness.js``, but not ``testharnessreport.js``, and use + * :js:func:`test`, :js:func:`async_test`, and :js:func:`promise_test` in + * the usual manner. + * + * @param {Window} window - The window to fetch tests from. + */ + function fetch_tests_from_window(window) { + return tests.fetch_tests_from_window(window); + } + expose(fetch_tests_from_window, 'fetch_tests_from_window'); + + /** + * Get test results from a shadow realm and include them in the current test. + * + * @param {ShadowRealm} realm - A shadow realm also running the test harness + * @returns {Promise} - A promise that's resolved once all the remote tests are complete. + */ + function fetch_tests_from_shadow_realm(realm) { + var chan = new MessageChannel(); + function receiveMessage(msg_json) { + chan.port1.postMessage(JSON.parse(msg_json)); + } + var done = tests.fetch_tests_from_worker(chan.port2); + realm.evaluate("begin_shadow_realm_tests")(receiveMessage); + chan.port2.start(); + return done; + } + expose(fetch_tests_from_shadow_realm, 'fetch_tests_from_shadow_realm'); + + /** + * Begin running tests in this shadow realm test harness. + * + * To be called after all tests have been loaded; it is an error to call + * this more than once or in a non-Shadow Realm environment + * + * @param {Function} postMessage - A function to send test updates to the + * incubating realm-- accepts JSON-encoded messages in the format used by + * RemoteContext + */ + function begin_shadow_realm_tests(postMessage) { + if (!(test_environment instanceof ShadowRealmTestEnvironment)) { + throw new Error("begin_shadow_realm_tests called in non-Shadow Realm environment"); + } + + test_environment.begin(function (msg) { + postMessage(JSON.stringify(msg)); + }); + } + expose(begin_shadow_realm_tests, 'begin_shadow_realm_tests'); + + /** + * Timeout the tests. + * + * This only has an effect when ``explicit_timeout`` has been set + * in :js:func:`setup`. In other cases any call is a no-op. + * + */ function timeout() { if (tests.timeout_length === null) { tests.timeout(); @@ -1948,18 +4211,49 @@ policies and contribution forms [3]. } expose(timeout, 'timeout'); + /** + * Add a callback that's triggered when the first :js:class:`Test` is created. + * + * @param {Function} callback - Callback function. This is called + * without arguments. + */ function add_start_callback(callback) { tests.start_callbacks.push(callback); } + /** + * Add a callback that's triggered when a test state changes. + * + * @param {Function} callback - Callback function, called with the + * :js:class:`Test` as the only argument. + */ function add_test_state_callback(callback) { tests.test_state_callbacks.push(callback); } + /** + * Add a callback that's triggered when a test result is received. + * + * @param {Function} callback - Callback function, called with the + * :js:class:`Test` as the only argument. + */ function add_result_callback(callback) { tests.test_done_callbacks.push(callback); } + /** + * Add a callback that's triggered when all tests are complete. + * + * @param {Function} callback - Callback function, called with an + * array of :js:class:`Test` objects, a :js:class:`TestsStatus` + * object and an array of :js:class:`AssertRecord` objects. If the + * debug setting is ``false`` the final argument will be an empty + * array. + * + * For performance reasons asserts are only tracked when the debug + * setting is ``true``. In other cases the array of asserts will be + * empty. + */ function add_completion_callback(callback) { tests.all_done_callbacks.push(callback); } @@ -2033,6 +4327,9 @@ policies and contribution forms [3]. Output.prototype.resolve_log = function() { var output_document; + if (this.output_node) { + return; + } if (typeof this.output_document === "function") { output_document = this.output_document.apply(undefined); } else { @@ -2043,12 +4340,34 @@ policies and contribution forms [3]. } var node = output_document.getElementById("log"); if (!node) { - if (!document.body || document.readyState == "loading") { + if (output_document.readyState === "loading") { return; } - node = output_document.createElement("div"); + node = output_document.createElementNS("http://www.w3.org/1999/xhtml", "div"); node.id = "log"; - output_document.body.appendChild(node); + if (output_document.body) { + output_document.body.appendChild(node); + } else { + var root = output_document.documentElement; + var is_html = (root && + root.namespaceURI === "http://www.w3.org/1999/xhtml" && + root.localName === "html"); + var is_svg = (output_document.defaultView && + "SVGSVGElement" in output_document.defaultView && + root instanceof output_document.defaultView.SVGSVGElement); + if (is_svg) { + var foreignObject = output_document.createElementNS("http://www.w3.org/2000/svg", "foreignObject"); + foreignObject.setAttribute("width", "100%"); + foreignObject.setAttribute("height", "100%"); + root.appendChild(foreignObject); + foreignObject.appendChild(node); + } else if (is_html) { + root.appendChild(output_document.createElementNS("http://www.w3.org/1999/xhtml", "body")) + .appendChild(node); + } else { + root.appendChild(node); + } + } } this.output_document = output_document; this.output_node = node; @@ -2056,17 +4375,17 @@ policies and contribution forms [3]. Output.prototype.show_status = function() { if (this.phase < this.STARTED) { - this.init(); + this.init({}); } - if (!this.enabled) { + if (!this.enabled || this.phase === this.COMPLETE) { return; } + this.resolve_log(); if (this.phase < this.HAVE_RESULTS) { - this.resolve_log(); this.phase = this.HAVE_RESULTS; } var done_count = tests.tests.length - tests.num_pending; - if (this.output_node) { + if (this.output_node && !tests.hide_test_state) { if (done_count < 100 || (done_count < 1000 && done_count % 100 === 0) || done_count % 1000 === 0) { @@ -2077,7 +4396,7 @@ policies and contribution forms [3]. } }; - Output.prototype.show_results = function (tests, harness_status) { + Output.prototype.show_results = function (tests, harness_status, asserts_run) { if (this.phase >= this.COMPLETE) { return; } @@ -2099,32 +4418,17 @@ policies and contribution forms [3]. log.removeChild(log.lastChild); } - var harness_url = get_harness_url(); - if (harness_url !== null) { - var stylesheet = output_document.createElementNS(xhtml_ns, "link"); - stylesheet.setAttribute("rel", "stylesheet"); - stylesheet.setAttribute("href", harness_url + "testharness.css"); - var heads = output_document.getElementsByTagName("head"); - if (heads.length) { - heads[0].appendChild(stylesheet); - } + var stylesheet = output_document.createElementNS(xhtml_ns, "style"); + stylesheet.textContent = stylesheetContent; + var heads = output_document.getElementsByTagName("head"); + if (heads.length) { + heads[0].appendChild(stylesheet); } - var status_text_harness = {}; - status_text_harness[harness_status.OK] = "OK"; - status_text_harness[harness_status.ERROR] = "Error"; - status_text_harness[harness_status.TIMEOUT] = "Timeout"; - - var status_text = {}; - status_text[Test.prototype.PASS] = "Pass"; - status_text[Test.prototype.FAIL] = "Fail"; - status_text[Test.prototype.TIMEOUT] = "Timeout"; - status_text[Test.prototype.NOTRUN] = "Not Run"; - var status_number = {}; forEach(tests, function(test) { - var status = status_text[test.status]; + var status = test.format_status(); if (status_number.hasOwnProperty(status)) { status_number[status] += 1; } else { @@ -2141,15 +4445,15 @@ policies and contribution forms [3]. ["h2", {}, "Summary"], function() { - - var status = status_text_harness[harness_status.status]; + var status = harness_status.format_status(); var rv = [["section", {}, ["p", {}, "Harness status: ", ["span", {"class":status_class(status)}, status ], - ] + ], + ["button", {"id":"rerun"}, "Rerun"] ]]; if (harness_status.status === harness_status.ERROR) { @@ -2164,13 +4468,14 @@ policies and contribution forms [3]. function() { var rv = [["div", {}]]; var i = 0; - while (status_text.hasOwnProperty(i)) { - if (status_number.hasOwnProperty(status_text[i])) { - var status = status_text[i]; - rv[0].push(["div", {"class":status_class(status)}, + while (Test.prototype.status_formats.hasOwnProperty(i)) { + if (status_number.hasOwnProperty(Test.prototype.status_formats[i])) { + var status = Test.prototype.status_formats[i]; + rv[0].push(["div", {}, ["label", {}, ["input", {type:"checkbox", checked:"checked"}], - status_number[status] + " " + status]]); + status_number[status] + " ", + ["span", {"class":status_class(status)}, status]]]); } i++; } @@ -2180,6 +4485,13 @@ policies and contribution forms [3]. log.appendChild(render(summary_template, {num_tests:tests.length}, output_document)); + output_document.getElementById("rerun").addEventListener("click", + function() { + let evt = new Event('__test_restart'); + let canceled = !window.dispatchEvent(evt); + if (!canceled) { location.reload(); } + }); + forEach(output_document.querySelectorAll("section#summary label"), function(element) { @@ -2190,13 +4502,13 @@ policies and contribution forms [3]. e.preventDefault(); return; } - var result_class = element.parentNode.getAttribute("class"); + var result_class = element.querySelector("span[class]").getAttribute("class"); var style_element = output_document.querySelector("style#hide-" + result_class); var input_element = element.querySelector("input"); if (!style_element && !input_element.checked) { style_element = output_document.createElementNS(xhtml_ns, "style"); style_element.id = "hide-" + result_class; - style_element.textContent = "table#results > tbody > tr."+result_class+"{display:none}"; + style_element.textContent = "table#results > tbody > tr.overall-"+result_class+"{display:none}"; output_document.body.appendChild(style_element); } else if (style_element && input_element.checked) { style_element.parentNode.removeChild(style_element); @@ -2204,18 +4516,6 @@ policies and contribution forms [3]. }); }); - // This use of innerHTML plus manual escaping is not recommended in - // general, but is necessary here for performance. Using textContent - // on each individual adds tens of seconds of execution time for - // large test suites (tens of thousands of tests). - function escape_html(s) - { - return s.replace(/\&/g, "&") - .replace(/ { + if (!asserts_run_by_test.has(assert.test)) { + asserts_run_by_test.set(assert.test, []); + } + asserts_run_by_test.get(assert.test).push(assert); + }); + + function get_asserts_output(test) { + const asserts_output = render( + ["details", {}, + ["summary", {}, "Asserts run"], + ["table", {}, ""] ]); + + var asserts = asserts_run_by_test.get(test); + if (!asserts) { + asserts_output.querySelector("summary").insertAdjacentText("afterend", "No asserts ran"); + return asserts_output; + } + + const table = asserts_output.querySelector("table"); + for (const assert of asserts) { + const status_class_name = status_class(Test.prototype.status_formats[assert.status]); + var output_fn = "(" + assert.args.join(", ") + ")"; + if (assert.stack) { + output_fn += "\n"; + output_fn += assert.stack.split("\n", 1)[0].replace(/@?\w+:\/\/[^ "\/]+(?::\d+)?/g, " "); + } + table.appendChild(render( + ["tr", {"class":"overall-" + status_class_name}, + ["td", {"class":status_class_name}, Test.prototype.status_formats[assert.status]], + ["td", {}, ["pre", {}, ["strong", {}, assert.assert_name], output_fn]] ])); + } + return asserts_output; + } + var assertions = has_assertions(); - var html = "

Details

" + - "" + - (assertions ? "" : "") + - "" + - ""; - for (var i = 0; i < tests.length; i++) { - html += '"; - } - html += "
ResultTest NameAssertionMessage
' + - escape_html(status_text[tests[i].status]) + - "" + - escape_html(tests[i].name) + - "" + - (assertions ? escape_html(get_assertion(tests[i])) + "" : "") + - escape_html(tests[i].message ? tests[i].message : " ") + - (tests[i].stack ? "
" +
-                 escape_html(tests[i].stack) +
-                 "
": "") + - "
"; - try { - log.lastChild.innerHTML = html; - } catch (e) { - log.appendChild(document.createElementNS(xhtml_ns, "p")) - .textContent = "Setting innerHTML for the log threw an exception."; - log.appendChild(document.createElementNS(xhtml_ns, "pre")) - .textContent = html; + const section = render( + ["section", {}, + ["h2", {}, "Details"], + ["table", {"id":"results", "class":(assertions ? "assertions" : "")}, + ["thead", {}, + ["tr", {}, + ["th", {}, "Result"], + ["th", {}, "Test Name"], + (assertions ? ["th", {}, "Assertion"] : ""), + ["th", {}, "Message" ]]], + ["tbody", {}]]]); + + const tbody = section.querySelector("tbody"); + for (const test of tests) { + const status = test.format_status(); + const status_class_name = status_class(status); + tbody.appendChild(render( + ["tr", {"class":"overall-" + status_class_name}, + ["td", {"class":status_class_name}, status], + ["td", {}, test.name], + (assertions ? ["td", {}, get_assertion(test)] : ""), + ["td", {}, + test.message ?? "", + ["pre", {}, test.stack ?? ""]]])); + if (!(test instanceof RemoteTest)) { + tbody.lastChild.lastChild.appendChild(get_asserts_output(test)); + } } + log.appendChild(section); }; /* * Template code * - * A template is just a javascript structure. An element is represented as: + * A template is just a JavaScript structure. An element is represented as: * * [tag_name, {attr_name:attr_value}, child1, child2] * @@ -2332,13 +4667,20 @@ policies and contribution forms [3]. { var substitution_re = /\$\{([^ }]*)\}/g; - function do_substitution(input) { + function do_substitution(input) + { var components = input.split(substitution_re); var rv = []; - for (var i = 0; i < components.length; i += 2) { - rv.push(components[i]); - if (components[i + 1]) { - rv.push(String(substitutions[components[i + 1]])); + if (components.length === 1) { + rv = components; + } else if (substitutions) { + for (var i = 0; i < components.length; i += 2) { + if (components[i]) { + rv.push(components[i]); + } + if (substitutions[components[i + 1]]) { + rv.push(String(substitutions[components[i + 1]])); + } } } return rv; @@ -2435,13 +4777,10 @@ policies and contribution forms [3]. } /* - * Utility funcions + * Utility functions */ function assert(expected_true, function_name, description, error, substitutions) { - if (tests.tests.length === 0) { - tests.set_file_is_test(); - } if (expected_true !== true) { var msg = make_message(function_name, description, error, substitutions); @@ -2449,24 +4788,26 @@ policies and contribution forms [3]. } } + /** + * @class + * Exception type that represents a failing assert. + * + * @param {string} message - Error message. + */ function AssertionError(message) { + if (typeof message === "string") { + message = sanitize_unpaired_surrogates(message); + } this.message = message; - this.stack = this.get_stack(); + this.stack = get_stack(); } + expose(AssertionError, "AssertionError"); AssertionError.prototype = Object.create(Error.prototype); - AssertionError.prototype.get_stack = function() { + const get_stack = function() { var stack = new Error().stack; - // IE11 does not initialize 'Error.stack' until the object is thrown. - if (!stack) { - try { - throw new Error(); - } catch (e) { - stack = e.stack; - } - } // 'Error.stack' is not supported in all browsers/versions if (!stack) { @@ -2501,7 +4842,14 @@ policies and contribution forms [3]. } return lines.slice(i).join("\n"); + }; + + function OptionalFeatureUnsupportedError(message) + { + AssertionError.call(this, message); } + OptionalFeatureUnsupportedError.prototype = Object.create(AssertionError.prototype); + expose(OptionalFeatureUnsupportedError, "OptionalFeatureUnsupportedError"); function make_message(function_name, description, error, substitutions) { @@ -2556,6 +4904,59 @@ policies and contribution forms [3]. } } + /** + * Immediately invoke a "iteratee" function with a series of values in + * parallel and invoke a final "done" function when all of the "iteratee" + * invocations have signaled completion. + * + * If all callbacks complete synchronously (or if no callbacks are + * specified), the ``done_callback`` will be invoked synchronously. It is the + * responsibility of the caller to ensure asynchronicity in cases where + * that is desired. + * + * @param {array} value Zero or more values to use in the invocation of + * ``iter_callback`` + * @param {function} iter_callback A function that will be invoked + * once for each of the values min + * ``value``. Two arguments will + * be available in each + * invocation: the value from + * ``value`` and a function that + * must be invoked to signal + * completion + * @param {function} done_callback A function that will be invoked after + * all operations initiated by the + * ``iter_callback`` function have signaled + * completion + */ + function all_async(values, iter_callback, done_callback) + { + var remaining = values.length; + + if (remaining === 0) { + done_callback(); + } + + forEach(values, + function(element) { + var invoked = false; + var elDone = function() { + if (invoked) { + return; + } + + invoked = true; + remaining -= 1; + + if (remaining === 0) { + done_callback(); + } + }; + + iter_callback(element, elDone); + }); + } + function merge(a,b) { var rv = {}; @@ -2572,7 +4973,7 @@ policies and contribution forms [3]. function expose(object, name) { var components = name.split("."); - var target = test_environment.global_scope(); + var target = global_scope; for (var i = 0; i < components.length - 1; i++) { if (!(components[i] in target)) { target[components[i]] = {}; @@ -2594,7 +4995,7 @@ policies and contribution forms [3]. /** Returns the 'src' URL of the first