From 6faed614f10efe28acdbb3a6da8877acf2c012c2 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 24 Jun 2025 07:41:54 +0200 Subject: [PATCH 1/2] [test] Update bits used for malformed memory/table/global flags (#1936) --- test/core/binary.wast | 4 ++-- test/core/global.wast | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/core/binary.wast b/test/core/binary.wast index 765101bedb..dbf433a9e3 100644 --- a/test/core/binary.wast +++ b/test/core/binary.wast @@ -815,7 +815,7 @@ "\00asm" "\01\00\00\00" "\04\04\01" ;; table section with one entry "\70" ;; anyfunc - "\02" ;; malformed table limits flag + "\08" ;; malformed table limits flag "\00" ;; dummy byte ) "integer too large" @@ -860,7 +860,7 @@ (module binary "\00asm" "\01\00\00\00" "\05\03\01" ;; memory section with one entry - "\02" ;; malformed memory limits flag + "\10" ;; malformed memory limits flag "\00" ;; dummy byte ) "integer too large" diff --git a/test/core/global.wast b/test/core/global.wast index e40a305f16..f842eaeef3 100644 --- a/test/core/global.wast +++ b/test/core/global.wast @@ -384,7 +384,7 @@ "\0a\67\6c\6f\62\61\6c\5f\69\33\32" ;; "global_i32" "\03" ;; GlobalImport "\7f" ;; i32 - "\02" ;; malformed mutability + "\04" ;; malformed mutability ) "malformed mutability" ) @@ -411,7 +411,7 @@ "\06\86\80\80\80\00" ;; global section "\01" ;; length 1 "\7f" ;; i32 - "\02" ;; malformed mutability + "\04" ;; malformed mutability "\41\00" ;; i32.const 0 "\0b" ;; end ) From 1041527d508218acc40f0278d4abc3be9ba5e3bd Mon Sep 17 00:00:00 2001 From: Vursc <80833781+vursc@users.noreply.github.com> Date: Tue, 24 Jun 2025 13:02:22 +0000 Subject: [PATCH 2/2] [spec] Conventions for "large productions" (#1937) Co-authored-by: Vursc --- document/core/binary/conventions.rst | 2 ++ document/core/binary/instructions.rst | 3 ++- document/core/text/conventions.rst | 2 ++ document/core/text/instructions.rst | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/document/core/binary/conventions.rst b/document/core/binary/conventions.rst index 7b606e1e48..6c1d610e4f 100644 --- a/document/core/binary/conventions.rst +++ b/document/core/binary/conventions.rst @@ -58,6 +58,8 @@ In order to distinguish symbols of the binary syntax from symbols of the abstrac * Productions are written :math:`\B{sym} ::= B_1 \Rightarrow A_1 ~|~ \dots ~|~ B_n \Rightarrow A_n`, where each :math:`A_i` is the attribute that is synthesized for :math:`\B{sym}` in the given case, usually from attribute variables bound in :math:`B_i`. +* Large productions may be split into multiple definitions, indicated by ending the first one with explicit ellipses, :math:`\B{sym} ::= B_1 \Rightarrow A_1 ~|~ \dots`, and starting continuations with ellipses, :math:`\B{sym} ::= \dots ~|~ B_2 \Rightarrow A_2`. + * Some productions are augmented by side conditions in parentheses, which restrict the applicability of the production. They provide a shorthand for a combinatorial expansion of the production into many separate cases. * If the same meta variable or non-terminal symbol appears multiple times in a production (in the syntax or in an attribute), then all those occurrences must have the same instantiation. diff --git a/document/core/binary/instructions.rst b/document/core/binary/instructions.rst index e13a03236e..0b04408261 100644 --- a/document/core/binary/instructions.rst +++ b/document/core/binary/instructions.rst @@ -62,7 +62,8 @@ Control Instructions &\Rightarrow& \BRTABLE~l^\ast~l_N \\ &&|& \hex{0F} &\Rightarrow& \RETURN \\ &&|& \hex{10}~~x{:}\Bfuncidx &\Rightarrow& \CALL~x \\ &&|& - \hex{11}~~y{:}\Btypeidx~~x{:}\Btableidx &\Rightarrow& \CALLINDIRECT~x~y \\ + \hex{11}~~y{:}\Btypeidx~~x{:}\Btableidx &\Rightarrow& \CALLINDIRECT~x~y \\ &&|& + \dots \end{array} .. note:: diff --git a/document/core/text/conventions.rst b/document/core/text/conventions.rst index 1efc88b036..39a1993dde 100644 --- a/document/core/text/conventions.rst +++ b/document/core/text/conventions.rst @@ -53,6 +53,8 @@ In order to distinguish symbols of the textual syntax from symbols of the abstra * Productions are written :math:`\T{sym} ::= T_1 \Rightarrow A_1 ~|~ \dots ~|~ T_n \Rightarrow A_n`, where each :math:`A_i` is the attribute that is synthesized for :math:`\T{sym}` in the given case, usually from attribute variables bound in :math:`T_i`. +* Large productions may be split into multiple definitions, indicated by ending the first one with explicit ellipses, :math:`\T{sym} ::= T_1 \Rightarrow A_1 ~|~ \dots`, and starting continuations with ellipses, :math:`\T{sym} ::= \dots ~|~ T_2 \Rightarrow A_2`. + * Some productions are augmented by side conditions in parentheses, which restrict the applicability of the production. They provide a shorthand for a combinatorial expansion of the production into many separate cases. * If the same meta variable or non-terminal symbol appears multiple times in a production (in the syntax or in an attribute), then all those occurrences must have the same instantiation. diff --git a/document/core/text/instructions.rst b/document/core/text/instructions.rst index 3029bc09f0..011fb87699 100644 --- a/document/core/text/instructions.rst +++ b/document/core/text/instructions.rst @@ -118,7 +118,8 @@ All other control instruction are represented verbatim. \text{return} &\Rightarrow& \RETURN \\ &&|& \text{call}~~x{:}\Tfuncidx_I &\Rightarrow& \CALL~x \\ &&|& \text{call\_indirect}~~x{:}\Ttableidx~~y,I'{:}\Ttypeuse_I &\Rightarrow& \CALLINDIRECT~x~y - & (\iff I' = \{\ILOCALS~(\epsilon)^\ast\}) \\ + & (\iff I' = \{\ILOCALS~(\epsilon)^\ast\}) \\ &&|& + \dots \end{array} .. note::