From 01de06257769f4e65239a18f564be7754ab57264 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 18 Jan 2018 12:33:17 +0100 Subject: [PATCH 1/2] [text] Rename memory instructions --- document/core/appendix/index-instructions.rst | 4 +- document/core/binary/instructions.rst | 10 +- document/core/exec/instructions.rst | 30 +-- document/core/syntax/instructions.rst | 8 +- document/core/text/instructions.rst | 8 +- document/core/text/modules.rst | 28 +-- document/core/util/macros.def | 4 +- document/core/valid/instructions.rst | 16 +- document/js-api/index.bs | 122 ++++++------ interpreter/README.md | 26 +-- interpreter/binary/decode.ml | 30 +-- interpreter/binary/encode.ml | 62 +++---- interpreter/exec/eval.ml | 66 +++---- interpreter/host/spectest.ml | 4 +- interpreter/runtime/instance.ml | 11 +- interpreter/runtime/{memory.ml => mem.ml} | 28 +-- interpreter/runtime/mem.mli | 44 +++++ interpreter/runtime/memory.mli | 44 ----- interpreter/script/run.ml | 4 +- interpreter/syntax/ast.ml | 34 ++-- interpreter/syntax/operators.ml | 36 ++-- interpreter/syntax/types.ml | 18 +- interpreter/text/arrange.ml | 40 ++-- interpreter/text/lexer.mll | 6 +- interpreter/text/parser.mly | 60 +++--- interpreter/valid/valid.ml | 56 +++--- interpreter/winmake.bat | 174 +++++++++--------- test/Todo.md | 6 +- test/core/address.wast | 4 +- test/core/align.wast | 12 +- test/core/br.wast | 8 +- test/core/br_table.wast | 8 +- test/core/endianness.wast | 2 +- test/core/exports.wast | 50 ++--- test/core/float_exprs.wast | 12 +- test/core/float_memory.wast | 12 +- test/core/imports.wast | 78 ++++---- test/core/inline-module.wast | 2 +- test/core/left-to-right.wast | 2 +- test/core/linking.wast | 24 +-- test/core/memory.wast | 160 ++++++++-------- test/core/memory_redundancy.wast | 2 +- test/core/memory_trap.wast | 12 +- test/core/nop.wast | 14 +- test/core/resizing.wast | 14 +- test/core/return.wast | 8 +- test/core/skip-stack-guard-page.wast | 2 +- test/core/start.wast | 4 +- test/core/store_retval.wast | 18 +- test/core/traps.wast | 2 +- test/core/typecheck.wast | 68 +++---- test/core/unreachable.wast | 8 +- 52 files changed, 752 insertions(+), 753 deletions(-) rename interpreter/runtime/{memory.ml => mem.ml} (87%) create mode 100644 interpreter/runtime/mem.mli delete mode 100644 interpreter/runtime/memory.mli diff --git a/document/core/appendix/index-instructions.rst b/document/core/appendix/index-instructions.rst index f5811e024f..0b9f571b84 100644 --- a/document/core/appendix/index-instructions.rst +++ b/document/core/appendix/index-instructions.rst @@ -70,8 +70,8 @@ Instruction Binary Opcode Type :math:`\I64.\STORE\K{8}~\memarg` :math:`\hex{3C}` :math:`[\I32~\I64] \to []` :ref:`validation ` :ref:`execution ` :math:`\I64.\STORE\K{16}~\memarg` :math:`\hex{3D}` :math:`[\I32~\I64] \to []` :ref:`validation ` :ref:`execution ` :math:`\I64.\STORE\K{32}~\memarg` :math:`\hex{3E}` :math:`[\I32~\I64] \to []` :ref:`validation ` :ref:`execution ` -:math:`\CURRENTMEMORY` :math:`\hex{3F}` :math:`[] \to [\I32]` :ref:`validation ` :ref:`execution ` -:math:`\GROWMEMORY` :math:`\hex{40}` :math:`[\I32] \to [\I32]` :ref:`validation ` :ref:`execution ` +:math:`\MEMSIZE` :math:`\hex{3F}` :math:`[] \to [\I32]` :ref:`validation ` :ref:`execution ` +:math:`\MEMGROW` :math:`\hex{40}` :math:`[\I32] \to [\I32]` :ref:`validation ` :ref:`execution ` :math:`\I32.\CONST~\i32` :math:`\hex{41}` :math:`[] \to [\I32]` :ref:`validation ` :ref:`execution ` :math:`\I64.\CONST~\i64` :math:`\hex{42}` :math:`[] \to [\I64]` :ref:`validation ` :ref:`execution ` :math:`\F32.\CONST~\f32` :math:`\hex{43}` :math:`[] \to [\F32]` :ref:`validation ` :ref:`execution ` diff --git a/document/core/binary/instructions.rst b/document/core/binary/instructions.rst index faf5411de8..1ab8586032 100644 --- a/document/core/binary/instructions.rst +++ b/document/core/binary/instructions.rst @@ -124,8 +124,8 @@ Each variant of :ref:`memory instruction ` is encoded with .. _binary-loadn: .. _binary-store: .. _binary-storen: -.. _binary-current_memory: -.. _binary-grow_memory: +.. _binary-mem.size: +.. _binary-mem.grow: .. math:: \begin{array}{llclll} @@ -155,12 +155,12 @@ Each variant of :ref:`memory instruction ` is encoded with \hex{3C}~~m{:}\Bmemarg &\Rightarrow& \I64.\STORE\K{8}~m \\ &&|& \hex{3D}~~m{:}\Bmemarg &\Rightarrow& \I64.\STORE\K{16}~m \\ &&|& \hex{3E}~~m{:}\Bmemarg &\Rightarrow& \I64.\STORE\K{32}~m \\ &&|& - \hex{3F}~~\hex{00} &\Rightarrow& \CURRENTMEMORY \\ &&|& - \hex{40}~~\hex{00} &\Rightarrow& \GROWMEMORY \\ + \hex{3F}~~\hex{00} &\Rightarrow& \MEMSIZE \\ &&|& + \hex{40}~~\hex{00} &\Rightarrow& \MEMGROW \\ \end{array} .. note:: - In future versions of WebAssembly, the additional zero bytes occurring in the encoding of the |CURRENTMEMORY| and |GROWMEMORY| instructions may be used to index additional memories. + In future versions of WebAssembly, the additional zero bytes occurring in the encoding of the |MEMSIZE| and |MEMGROW| instructions may be used to index additional memories. .. index:: numeric instruction diff --git a/document/core/exec/instructions.rst b/document/core/exec/instructions.rst index 356b8665a7..f9bf433120 100644 --- a/document/core/exec/instructions.rst +++ b/document/core/exec/instructions.rst @@ -533,18 +533,18 @@ Memory Instructions \end{array} -.. _exec-current_memory: +.. _exec-mem.size: -:math:`\CURRENTMEMORY` -...................... +:math:`\MEMSIZE` +................ 1. Let :math:`F` be the :ref:`current ` :ref:`frame `. -2. Assert: due to :ref:`validation `, :math:`F.\AMODULE.\MIMEMS[0]` exists. +2. Assert: due to :ref:`validation `, :math:`F.\AMODULE.\MIMEMS[0]` exists. 3. Let :math:`a` be the :ref:`memory address ` :math:`F.\AMODULE.\MIMEMS[0]`. -4. Assert: due to :ref:`validation `, :math:`S.\SMEMS[a]` exists. +4. Assert: due to :ref:`validation `, :math:`S.\SMEMS[a]` exists. 5. Let :math:`\X{mem}` be the :ref:`memory instance ` :math:`S.\SMEMS[a]`. @@ -555,31 +555,31 @@ Memory Instructions .. math:: \begin{array}{l} \begin{array}{lcl@{\qquad}l} - S; F; \CURRENTMEMORY &\stepto& S; F; (\I32.\CONST~\X{sz}) + S; F; \MEMSIZE &\stepto& S; F; (\I32.\CONST~\X{sz}) \end{array} \\ \qquad (\iff |S.\SMEMS[F.\AMODULE.\MIMEMS[0]].\MIDATA| = \X{sz}\cdot64\,\F{Ki}) \\ \end{array} -.. _exec-grow_memory: +.. _exec-mem.grow: -:math:`\GROWMEMORY` -................... +:math:`\MEMGROW` +................ 1. Let :math:`F` be the :ref:`current ` :ref:`frame `. -2. Assert: due to :ref:`validation `, :math:`F.\AMODULE.\MIMEMS[0]` exists. +2. Assert: due to :ref:`validation `, :math:`F.\AMODULE.\MIMEMS[0]` exists. 3. Let :math:`a` be the :ref:`memory address ` :math:`F.\AMODULE.\MIMEMS[0]`. -4. Assert: due to :ref:`validation `, :math:`S.\SMEMS[a]` exists. +4. Assert: due to :ref:`validation `, :math:`S.\SMEMS[a]` exists. 5. Let :math:`\X{mem}` be the :ref:`memory instance ` :math:`S.\SMEMS[a]`. 6. Let :math:`\X{sz}` be the length of :math:`S.\SMEMS[a]` divided by the :ref:`page size `. -7. Assert: due to :ref:`validation `, a value of :ref:`value type ` |I32| is on the top of the stack. +7. Assert: due to :ref:`validation `, a value of :ref:`value type ` |I32| is on the top of the stack. 8. Pop the value :math:`\I32.\CONST~n` from the stack. @@ -595,7 +595,7 @@ Memory Instructions ~\\[-1ex] \begin{array}{l} \begin{array}{lcl@{\qquad}l} - S; F; (\I32.\CONST~n)~\GROWMEMORY &\stepto& S'; F; (\I32.\CONST~\X{sz}) + S; F; (\I32.\CONST~n)~\MEMGROW &\stepto& S'; F; (\I32.\CONST~\X{sz}) \end{array} \\ \qquad \begin{array}[t]{@{}r@{~}l@{}} @@ -605,12 +605,12 @@ Memory Instructions \end{array} \\[1ex] \begin{array}{lcl@{\qquad}l} - S; F; (\I32.\CONST~n)~\GROWMEMORY &\stepto& S; F; (\I32.\CONST~{-1}) + S; F; (\I32.\CONST~n)~\MEMGROW &\stepto& S; F; (\I32.\CONST~{-1}) \end{array} \end{array} .. note:: - The |GROWMEMORY| instruction is non-deterministic. + The |MEMGROW| instruction is non-deterministic. It may either succeed, returning the old memory size :math:`\X{sz}`, or fail, returning :math:`{-1}`. Failure *must* occur if the referenced memory instance has a maximum size defined that would be exceeded. diff --git a/document/core/syntax/instructions.rst b/document/core/syntax/instructions.rst index 060933bf7f..171f676341 100644 --- a/document/core/syntax/instructions.rst +++ b/document/core/syntax/instructions.rst @@ -240,8 +240,8 @@ Instructions in this group are concerned with linear :ref:`memory `. \K{i}\X{nn}\K{.}\STORE\K{8}~\memarg ~|~ \K{i}\X{nn}\K{.}\STORE\K{16}~\memarg ~|~ \K{i64.}\STORE\K{32}~\memarg \\&&|& - \CURRENTMEMORY \\&&|& - \GROWMEMORY \\ + \MEMSIZE \\&&|& + \MEMGROW \\ \end{array} Memory is accessed with |LOAD| and |STORE| instructions for the different :ref:`value types `. @@ -256,8 +256,8 @@ A :ref:`trap ` results if any of the accessed memory bytes lies outside th .. note:: Future version of WebAssembly might provide memory instructions with 64 bit address ranges. -The |CURRENTMEMORY| instruction returns the current size of a memory. -The |GROWMEMORY| instruction grows memory by a given delta and returns the previous size, or :math:`-1` if enough memory cannot be allocated. +The |MEMSIZE| instruction returns the current size of a memory. +The |MEMGROW| instruction grows memory by a given delta and returns the previous size, or :math:`-1` if enough memory cannot be allocated. Both instructions operate in units of :ref:`page size `. .. note:: diff --git a/document/core/text/instructions.rst b/document/core/text/instructions.rst index a06aa981ea..217ec159b0 100644 --- a/document/core/text/instructions.rst +++ b/document/core/text/instructions.rst @@ -173,8 +173,8 @@ Memory Instructions .. _text-loadn: .. _text-store: .. _text-storen: -.. _text-current_memory: -.. _text-grow_memory: +.. _text-mem.size: +.. _text-mem.grow: 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*. @@ -214,8 +214,8 @@ Lexically, an |Toffset| or |Talign| phrase is considered a single :ref:`keyword \text{i64.store8}~~m{:}\Tmemarg_1 &\Rightarrow& \I64.\STORE\K{8}~m \\ &&|& \text{i64.store16}~~m{:}\Tmemarg_2 &\Rightarrow& \I64.\STORE\K{16}~m \\ &&|& \text{i64.store32}~~m{:}\Tmemarg_4 &\Rightarrow& \I64.\STORE\K{32}~m \\ &&|& - \text{current\_memory} &\Rightarrow& \CURRENTMEMORY \\ &&|& - \text{grow\_memory} &\Rightarrow& \GROWMEMORY \\ + \text{mem.size} &\Rightarrow& \MEMSIZE \\ &&|& + \text{mem.grow} &\Rightarrow& \MEMGROW \\ \end{array} diff --git a/document/core/text/modules.rst b/document/core/text/modules.rst index d951fc92d3..a226e3e5f8 100644 --- a/document/core/text/modules.rst +++ b/document/core/text/modules.rst @@ -159,7 +159,7 @@ The descriptors in imports can bind a symbolic function, table, memory, or globa &\Rightarrow& \IDFUNC~x \\ &&|& \text{(}~\text{table}~~\Tid^?~~\X{tt}{:}\Ttabletype~\text{)} &\Rightarrow& \IDTABLE~\X{tt} \\ &&|& - \text{(}~\text{memory}~~\Tid^?~~\X{mt}{:}\Tmemtype~\text{)} + \text{(}~\text{mem}~~\Tid^?~~\X{mt}{:}\Tmemtype~\text{)} &\Rightarrow& \IDMEM~~\X{mt} \\ &&|& \text{(}~\text{global}~~\Tid^?~~\X{gt}{:}\Tglobaltype~\text{)} &\Rightarrow& \IDGLOBAL~\X{gt} \\ @@ -314,7 +314,7 @@ Memory definitions can bind a symbolic :ref:`memory identifier `. .. math:: \begin{array}{llclll} \production{memory} & \Tmem_I &::=& - \text{(}~\text{memory}~~\Tid^?~~\X{mt}{:}\Tmemtype~\text{)} + \text{(}~\text{mem}~~\Tid^?~~\X{mt}{:}\Tmemtype~\text{)} &\Rightarrow& \{ \MTYPE~\X{mt} \} \\ \end{array} @@ -337,8 +337,8 @@ A :ref:`data segment ` can be given inline with a memory definition, .. math:: \begin{array}{llclll} \production{module field} & - \text{(}~\text{memory}~~\Tid^?~~\text{(}~\text{data}~~b^n{:}\Tdatastring~\text{)}~~\text{)} \quad\equiv \\ & \qquad - \text{(}~\text{memory}~~\Tid'~~m~~m~\text{)}~~ + \text{(}~\text{mem}~~\Tid^?~~\text{(}~\text{data}~~b^n{:}\Tdatastring~\text{)}~~\text{)} \quad\equiv \\ & \qquad + \text{(}~\text{mem}~~\Tid'~~m~~m~\text{)}~~ \text{(}~\text{data}~~\Tid'~~\text{(}~\text{i32.const}~~\text{0}~\text{)}~~\Tdatastring~\text{)} \\ & \qquad\qquad (\iff \Tid' = \Tid^? \neq \epsilon \vee \Tid' \idfresh, m = \F{ceil}(n / 64\F{Ki})) \\ @@ -349,12 +349,12 @@ Moreover, memories can be defined as :ref:`imports ` or :ref:`expor .. 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{)} + \text{(}~\text{mem}~~\Tid^?~~\text{(}~\text{import}~~\Tname_1~~\Tname_2~\text{)}~~\Tmemtype~\text{)} \quad\equiv \\ & \qquad + \text{(}~\text{import}~~\Tname_1~~\Tname_2~~\text{(}~\text{mem}~~\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{)} + \text{(}~\text{mem}~~\Tid^?~~\text{(}~\text{export}~~\Tname~\text{)}~~\dots~\text{)} \quad\equiv \\ & \qquad + \text{(}~\text{export}~~\Tname~~\text{(}~\text{mem}~~\Tid'~\text{)}~\text{)}~~ + \text{(}~\text{mem}~~\Tid'~~\dots~\text{)} \\ & \qquad\qquad (\iff \Tid' = \Tid^? \neq \epsilon \vee \Tid' \idfresh) \\ \end{array} @@ -426,7 +426,7 @@ The syntax for exports mirrors their :ref:`abstract syntax ` dire &\Rightarrow& \EDFUNC~x \\ &&|& \text{(}~\text{table}~~x{:}\Btableidx_I~\text{)} &\Rightarrow& \EDTABLE~x \\ &&|& - \text{(}~\text{memory}~~x{:}\Bmemidx_I~\text{)} + \text{(}~\text{mem}~~x{:}\Bmemidx_I~\text{)} &\Rightarrow& \EDMEM~x \\ &&|& \text{(}~\text{global}~~x{:}\Bglobalidx_I~\text{)} &\Rightarrow& \EDGLOBAL~x \\ @@ -593,7 +593,7 @@ The definition of the initial :ref:`identifier context ` :math:`I` \{\IFUNCS~(\Tid^?)\} \\ \F{idc}(\text{(}~\text{table}~\Tid^?~\dots~\text{)}) &=& \{\ITABLES~(\Tid^?)\} \\ - \F{idc}(\text{(}~\text{memory}~\Tid^?~\dots~\text{)}) &=& + \F{idc}(\text{(}~\text{mem}~\Tid^?~\dots~\text{)}) &=& \{\IMEMS~(\Tid^?)\} \\ \F{idc}(\text{(}~\text{global}~\Tid^?~\dots~\text{)}) &=& \{\IGLOBALS~(\Tid^?)\} \\ @@ -601,7 +601,7 @@ The definition of the initial :ref:`identifier context ` :math:`I` \{\IFUNCS~(\Tid^?)\} \\ \F{idc}(\text{(}~\text{import}~\dots~\text{(}~\text{table}~\Tid^?~\dots~\text{)}~\text{)}) &=& \{\ITABLES~(\Tid^?)\} \\ - \F{idc}(\text{(}~\text{import}~\dots~\text{(}~\text{memory}~\Tid^?~\dots~\text{)}~\text{)}) &=& + \F{idc}(\text{(}~\text{import}~\dots~\text{(}~\text{mem}~\Tid^?~\dots~\text{)}~\text{)}) &=& \{\IMEMS~(\Tid^?)\} \\ \F{idc}(\text{(}~\text{import}~\dots~\text{(}~\text{global}~\Tid^?~\dots~\text{)}~\text{)}) &=& \{\IGLOBALS~(\Tid^?)\} \\ @@ -623,11 +623,11 @@ The definition of the initial :ref:`identifier context ` :math:`I` \F{id}(\text{(}~\text{type}~\Tid^?~\dots~\text{)}) &=& \Tid^? \\ \F{id}(\text{(}~\text{func}~\Tid^?~\dots~\text{)}) &=& \Tid^? \\ \F{id}(\text{(}~\text{table}~\Tid^?~\dots~\text{)}) &=& \Tid^? \\ - \F{id}(\text{(}~\text{memory}~\Tid^?~\dots~\text{)}) &=& \Tid^? \\ + \F{id}(\text{(}~\text{mem}~\Tid^?~\dots~\text{)}) &=& \Tid^? \\ \F{id}(\text{(}~\text{global}~\Tid^?~\dots~\text{)}) &=& \Tid^? \\[1ex] \F{funcids}(\Timport^\ast) &=& [\Tid^? ~|~ \text{(}~\text{func}~\Tid^?~\dots~\text{)} \in \F{desc}(\Timport)^\ast] \\ \F{tableids}(\Timport^\ast) &=& [\Tid^? ~|~ \text{(}~\text{table}~\Tid^?~\dots~\text{)} \in \F{desc}(\Timport)^\ast] \\ - \F{memids}(\Timport^\ast) &=& [\Tid^? ~|~ \text{(}~\text{memory}~\Tid^?~\dots~\text{)} \in \F{desc}(\Timport)^\ast] \\ + \F{memids}(\Timport^\ast) &=& [\Tid^? ~|~ \text{(}~\text{mem}~\Tid^?~\dots~\text{)} \in \F{desc}(\Timport)^\ast] \\ \F{globalids}(\Timport^\ast) &=& [\Tid^? ~|~ \text{(}~\text{global}~\Tid^?~\dots~\text{)} \in \F{desc}(\Timport)^\ast] \\ \end{array} \\ \F{desc}(\text{(}~\text{import}~\dots~\Timportdesc~\text{)}) \quad=\quad \Timportdesc diff --git a/document/core/util/macros.def b/document/core/util/macros.def index 5ff53df7e3..0f9ff379e4 100644 --- a/document/core/util/macros.def +++ b/document/core/util/macros.def @@ -322,8 +322,8 @@ .. |LOAD| mathdef:: \xref{syntax/instructions}{syntax-instr-memory}{\K{load}} .. |STORE| mathdef:: \xref{syntax/instructions}{syntax-instr-memory}{\K{store}} -.. |CURRENTMEMORY| mathdef:: \xref{syntax/instructions}{syntax-instr-memory}{\K{current\_memory}} -.. |GROWMEMORY| mathdef:: \xref{syntax/instructions}{syntax-instr-memory}{\K{grow\_memory}} +.. |MEMSIZE| mathdef:: \xref{syntax/instructions}{syntax-instr-memory}{\K{mem.size}} +.. |MEMGROW| mathdef:: \xref{syntax/instructions}{syntax-instr-memory}{\K{mem.grow}} .. |CONST| mathdef:: \xref{syntax/instructions}{syntax-instr-numeric}{\K{const}} .. |EQZ| mathdef:: \xref{syntax/instructions}{syntax-instr-numeric}{\K{eqz}} diff --git a/document/core/valid/instructions.rst b/document/core/valid/instructions.rst index ffc308ff29..37b755d11c 100644 --- a/document/core/valid/instructions.rst +++ b/document/core/valid/instructions.rst @@ -389,10 +389,10 @@ Memory Instructions } -.. _valid-current_memory: +.. _valid-mem.size: -:math:`\CURRENTMEMORY` -...................... +:math:`\MEMSIZE` +................ * The memory :math:`C.\CMEMS[0]` must be defined in the context. @@ -402,14 +402,14 @@ Memory Instructions \frac{ C.\CMEMS[0] = \memtype }{ - C \vdashinstr \CURRENTMEMORY : [] \to [\I32] + C \vdashinstr \MEMSIZE : [] \to [\I32] } -.. _valid-grow_memory: +.. _valid-mem.grow: -:math:`\GROWMEMORY` -................... +:math:`\MEMGROW` +................ * The memory :math:`C.\CMEMS[0]` must be defined in the context. @@ -419,7 +419,7 @@ Memory Instructions \frac{ C.\CMEMS[0] = \memtype }{ - C \vdashinstr \GROWMEMORY : [\I32] \to [\I32] + C \vdashinstr \MEMGROW : [\I32] \to [\I32] } diff --git a/document/js-api/index.bs b/document/js-api/index.bs index c4c41140e8..08b27924f0 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -93,10 +93,10 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df text: trap; url: exec/runtime.html#syntax-trap url: exec/runtime.html#values text: WebAssembly value - text: π—‚πŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ— - text: 𝗂πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ— - text: 𝖿πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ— - text: π–ΏπŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ— + text: ν—‚νŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν— + text: ν—‚νŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν— + text: ν–ΏνŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν— + text: ν–ΏνŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν— text: function index; url: syntax/modules.html#syntax-funcidx text: function instance; url: exec/runtime.html#function-instances text: init_store; url: appendix/embedding.html#embed-init-store @@ -130,10 +130,10 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df text: function address; url: exec/runtime.html#syntax-funcaddr text: memory address; url: exec/runtime.html#syntax-memaddr url: syntax/types.html#syntax-valtype - text: 𝗂πŸ₯𝟀 - text: π—‚πŸ¨πŸ¦ - text: 𝖿πŸ₯𝟀 - text: π–ΏπŸ¨πŸ¦ + text: ν—‚νŸ₯ퟀ + text: ν—‚νŸ¨νŸ¦ + text: ν–ΏνŸ₯ퟀ + text: ν–ΏνŸ¨νŸ¦ text: function element; url: exec/runtime.html#syntax-funcelem text: import component; url: syntax/modules.html#imports text: external value; url: exec/runtime.html#syntax-externval @@ -142,13 +142,13 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df text: size_table; url: appendix/embedding.html#embed-size-table text: size_mem; url: appendix/embedding.html#embed-size-mem text: module; url: syntax/modules.html#syntax-module - text: π—‚π—†π—‰π—ˆπ—‹π—π—Œ; url: syntax/modules.html#syntax-module + text: ν—‚ν—†ν—‰ν—ˆν—‹ν—ν—Œ; url: syntax/modules.html#syntax-module url: syntax/types.html#external-types text: external type - text: π–Ώπ—Žπ—‡π–Ό - text: 𝗍𝖺𝖻𝗅𝖾 - text: 𝗆𝖾𝗆 - text: π—€π—…π—ˆπ–»π–Ίπ—… + text: ν–Ών—Žν—‡ν–Ό + text: 헍햺햻헅햾 + text: ν—†ν–Ύν—† + text: ν—€ν—…ν—ˆν–»ν–Ίν—… text: global type; url: syntax/types.html#syntax-globaltype text: address; url: exec/runtime.html#addresses @@ -309,13 +309,13 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
To instantiate a WebAssembly module from a {{Module}} |moduleObject| and imports |importObject|, perform the following steps: 1. Let |module| be |moduleObject|.\[[Module]]. - 1. If |module|.[=π—‚π—†π—‰π—ˆπ—‹π—π—Œ=] is not an empty list, and |importObject| is undefined, throw a {{TypeError}} exception. + 1. If |module|.[=ν—‚ν—†ν—‰ν—ˆν—‹ν—ν—Œ=] is not an empty list, and |importObject| is undefined, throw a {{TypeError}} exception. 1. Let |imports| be an empty [=list=] of [=external value=]s. 1. For each (|moduleName|, |componentName|, |externtype|) in [=module_imports=](|module|), do 1. Let |o| be ? [=Get=](|importObject|, |moduleName|). 1. If [=Type=](|o|) is not [=Object=], throw a {{TypeError}} exception. 1. Let |v| be ? [=Get=](|o|, |componentName|) - 1. If |externtype| is of the form [=π–Ώπ—Žπ—‡π–Ό=] |functype|, + 1. If |externtype| is of the form [=ν–Ών—Žν—‡ν–Ό=] |functype|, 1. If [=IsCallable=](|v|) is false, throw a {{LinkError}} exception. 1. If |v| has a \[[FunctionAddress]] internal slot, and therefore is an [=Exported Function=], 1. Let |funcaddr| be the value of |v|'s \[[FunctionAddress]] internal slot. @@ -324,31 +324,31 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje 1. Otherwise, 1. [=Create a host function=] from |v| and let |funcaddr| be the result. 1. Let |index| be the number of external functions in |imports|. This value |index| is known as the index of the host function |funcaddr|. - 1. Let |externfunc| be the [=external value=] [=external value|π–Ώπ—Žπ—‡π–Ό=] |funcaddr|. + 1. Let |externfunc| be the [=external value=] [=external value|ν–Ών—Žν—‡ν–Ό=] |funcaddr|. 1. [=Append=] |externfunc| to |imports|. - 1. If |externtype| is of the form [=π—€π—…π—ˆπ–»π–Ίπ—…=] |globaltype|, - 1. If |globaltype| is [=π—‚πŸ¨πŸ¦=] or [=Type=](|v|) is not [=Number=], throw a {{LinkError}} exception. + 1. If |externtype| is of the form [=ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaltype|, + 1. If |globaltype| is [=ν—‚νŸ¨νŸ¦=] or [=Type=](|v|) is not [=Number=], throw a {{LinkError}} exception. 1. Let |value| be [=ToWebAssemblyValue=](|v|, |globaltype|.[=global type|valtype=]) - 1. Assert: |globaltype|.[=global type|mut=] is [=global type|π–Όπ—ˆπ—‡π—Œπ—=], as verified by WebAssembly validation. + 1. Assert: |globaltype|.[=global type|mut=] is [=global type|ν–Όν—ˆν—‡ν—Œν—=], as verified by WebAssembly validation. 1. Let |store| be the current agent's [=associated store=]. 1. Let (|store|, |globaladdr|) be [=alloc_global=](|store|, |globaltype|, |value|). 1. Set the current agent's [=associated store=] to |store|. - 1. Let |externglobal| be [=external value|π—€π—…π—ˆπ–»π–Ίπ—…=] |globaladdr|. + 1. Let |externglobal| be [=external value|ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaladdr|. 1. [=Append=] |externglobal| to |imports|. - 1. If |externtype| is of the form [=𝗆𝖾𝗆=] |memtype|, + 1. If |externtype| is of the form [=ν—†ν–Ύν—†=] |memtype|, 1. If |v| is not a {{Memory}} object, throw a {{LinkError}} exception. Note: [=instantiate_module=] invoked below will check the imported {{Memory}}'s size against the importing module's requirements. - 2. Let |externmem| be the [=external value=] [=external value|𝗆𝖾𝗆=] |v|.\[[Memory]]. + 2. Let |externmem| be the [=external value=] [=external value|ν—†ν–Ύν—†=] |v|.\[[Memory]]. 1. [=Append=] |externmem| to |imports|. - 1. Otherwise, |externtype| is of the form [=𝗍𝖺𝖻𝗅𝖾=] |tabletype|, + 1. Otherwise, |externtype| is of the form [=헍햺햻헅햾=] |tabletype|, 1. If |v| is not a {{Table}} instance, throw a {{LinkError}} exception. Note: The table's length, etc. is checked by [=instantiate_module=] invoked below. 2. Let |tableaddr| be |v|.\[[Table]] - 1. Let |externtable| be the [=external value=] [=external value|𝗍𝖺𝖻𝗅𝖾=] |tableaddr|. + 1. Let |externtable| be the [=external value=] [=external value|헍햺햻헅햾=] |tableaddr|. 1. [=Append=] |externtable| to |imports|. 1. Let (|store|, |instance|) be [=instantiate_module=](|store|, |module|, |imports|). 1. If |instance| is [=error=], throw an appropriate exception type: @@ -359,25 +359,25 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje 1. For each pair (|name|, |externtype|) in [=module_exports=](|module|), 1. Let |externval| be [=get_export=](|instance|, |name|). 1. Assert: |externval| is not [=error=]. - 1. If |externtype| is of the form [=π–Ώπ—Žπ—‡π–Ό=] |functype|, - 1. Assert: |externval| is of the form [=external value|π–Ώπ—Žπ—‡π–Ό=] |funcaddr|. - 1. Let [=external value|π–Ώπ—Žπ—‡π–Ό=] |funcaddr| be |externval|. + 1. If |externtype| is of the form [=ν–Ών—Žν—‡ν–Ό=] |functype|, + 1. Assert: |externval| is of the form [=external value|ν–Ών—Žν—‡ν–Ό=] |funcaddr|. + 1. Let [=external value|ν–Ών—Žν—‡ν–Ό=] |funcaddr| be |externval|. 1. Let |func| be the result of creating [=a new Exported Function=] from |funcaddr|. 1. Let |value| be |func|. - 1. If |externtype| is of the form [=π—€π—…π—ˆπ–»π–Ίπ—…=] |globaltype|, - 1. If |globaltype|.[=global type|valtype=]) is [=π—‚πŸ¨πŸ¦=], throw a {{LinkError}} exception. - 1. Assert: |globaltype|.[=global type|mut=] is [=global type|π–Όπ—ˆπ—‡π—Œπ—=], as verified by WebAssembly validation. - 1. Assert: |externval| is of the form [=external value|π—€π—…π—ˆπ–»π–Ίπ—…=] |globaladdr|. - 1. Let [=external value|π—€π—…π—ˆπ–»π–Ίπ—…=] |globaladdr| be |externval|. + 1. If |externtype| is of the form [=ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaltype|, + 1. If |globaltype|.[=global type|valtype=]) is [=ν—‚νŸ¨νŸ¦=], throw a {{LinkError}} exception. + 1. Assert: |globaltype|.[=global type|mut=] is [=global type|ν–Όν—ˆν—‡ν—Œν—=], as verified by WebAssembly validation. + 1. Assert: |externval| is of the form [=external value|ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaladdr|. + 1. Let [=external value|ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaladdr| be |externval|. 1. Let |value| be [=ToJSValue=]([=read_global=](|store|, |globaladdr|)). - 1. If |externtype| is of the form [=𝗆𝖾𝗆=] |memtype|, - 1. Assert: |externval| is of the form [=external value|𝗆𝖾𝗆=] |memaddr|. - 1. Let [=external value|𝗆𝖾𝗆=] |memaddr| be |externval|. + 1. If |externtype| is of the form [=ν—†ν–Ύν—†=] |memtype|, + 1. Assert: |externval| is of the form [=external value|ν—†ν–Ύν—†=] |memaddr|. + 1. Let [=external value|ν—†ν–Ύν—†=] |memaddr| be |externval|. 1. Let |memory| be [=create a memory object|a new Memory object=] created from |memaddr|. 1. Let |value| be |memory|. - 1. Otherwise, |externtype| is of the form [=𝗍𝖺𝖻𝗅𝖾=] |tabletype|, - 1. Assert: |externval| is of the form [=external value|𝗍𝖺𝖻𝗅𝖾=] |tableaddr|. - 1. Let [=external value|𝗍𝖺𝖻𝗅𝖾=] |tableaddr| be |externval|. + 1. Otherwise, |externtype| is of the form [=헍햺햻헅햾=] |tabletype|, + 1. Assert: |externval| is of the form [=external value|헍햺햻헅햾=] |tableaddr|. + 1. Let [=external value|헍햺햻헅햾=] |tableaddr| be |externval|. 1. Let |table| be [=create a Table object|a new Table object=] created from |tableaddr|. 1. Let |value| be |table|. 1. Let |status| be ! [=CreateDataProperty=](|exportsObject|, |name|, |value|). @@ -455,10 +455,10 @@ interface Module {
The string value of the extern type |type| is - * "function" if |type| is of the form [=π–Ώπ—Žπ—‡π–Ό=] functype - * "table" if |type| is of the form [=𝗍𝖺𝖻𝗅𝖾=] tabletype - * "memory" if |type| is of the form [=𝗆𝖾𝗆=] memtype - * "global" if |type| is of the form [=π—€π—…π—ˆπ–»π–Ίπ—…=] globaltype + * "function" if |type| is of the form [=ν–Ών—Žν—‡ν–Ό=] functype + * "table" if |type| is of the form [=헍햺햻헅햾=] tabletype + * "memory" if |type| is of the form [=ν—†ν–Ύν—†=] memtype + * "global" if |type| is of the form [=ν—€ν—…ν—ˆν–»ν–Ίν—…=] globaltype
@@ -637,7 +637,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. If |descriptor|["initial"] is [=present=], let |n| be |descriptor|["initial"]; otherwise, let |n| be 0. 1. If |descriptor|["maximum"] is [=present=], let |m| be |descriptor|["maximum"]; otherwise, let |m| be empty. 1. If |m| is not empty and |m| < |n|, throw a {{RangeError}} exception. - 1. Let |type| be the [=table type=] {[=table type|𝗆𝗂𝗇=] n, [=table type|𝗆𝖺𝗑=] |m|} [=table type|π–Ίπ—‡π—’π–Ώπ—Žπ—‡π–Ό=]. + 1. Let |type| be the [=table type=] {[=table type|ν—†ν—‚ν—‡=] n, [=table type|ν—†ν–Ίν—‘=] |m|} [=table type|ν–Ίν—‡ν—’ν–Ών—Žν—‡ν–Ό=]. 1. Let |store| be the current agent's [=associated store=]. 1. Let (|store|, |tableaddr|) be [=alloc_table=](|store|, |type|). 1. Set the current agent's [=associated store=] to |store|. @@ -697,14 +697,14 @@ This slot holds a [=function address=] relative to the current agent's [=associa The name of the WebAssembly function |funcaddr| is found by performing the following steps: 1. Let |store| be the current agent's [=associated store=]. - 1. Let |funcinst| be |store|.π–Ώπ—Žπ—‡π–Όπ—Œ[|funcaddr|]. - 1. If |funcinst| is of the form {𝗍𝗒𝗉𝖾 |functype|, π—π—ˆπ—Œπ—π–Όπ—ˆπ–½π–Ύ |hostfunc|}, + 1. Let |funcinst| be |store|.ν–Ών—Žν—‡ν–Όν—Œ[|funcaddr|]. + 1. If |funcinst| is of the form {헍헒헉햾 |functype|, ν—ν—ˆν—Œν—ν–Όν—ˆν–½ν–Ύ |hostfunc|}, 1. Assert: |hostfunc| is a JavaScript object and [=IsCallable=](|hostfunc|) is true. 1. Let |index| be the [=index of the host function=] |funcaddr|. 1. Otherwise, - 1. Let |moduleinst| be |funcinst|.π—†π—ˆπ–½π—Žπ—…π–Ύ. - 1. Assert: |funcaddr| is contained in |moduleinst|.π–Ώπ—Žπ—‡π–Όπ–Ίπ–½π–½π—‹π—Œ. - 1. Let |index| be the index of |moduleinst|.π–Ώπ—Žπ—‡π–Όπ–Ίπ–½π–½π—‹π—Œ where |funcaddr| is found. + 1. Let |moduleinst| be |funcinst|.ν—†ν—ˆν–½ν—Žν—…ν–Ύ. + 1. Assert: |funcaddr| is contained in |moduleinst|.ν–Ών—Žν—‡ν–Όν–Ίν–½ν–½ν—‹ν—Œ. + 1. Let |index| be the index of |moduleinst|.ν–Ών—Žν—‡ν–Όν–Ίν–½ν–½ν—‹ν—Œ where |funcaddr| is found. 1. Return ! [=ToString=](|index|).
@@ -735,7 +735,7 @@ This slot holds a [=function address=] relative to the current agent's [=associa 1. Let |store| be the current agent's [=associated store=]. 1. Let |functype| be [=type_func=](|store|, |funcaddr|). 1. Let [|parameters|] β†’ [|results|] be |functype|. - 1. If |parameters| or |results| contains an [=π—‚πŸ¨πŸ¦=], throw a {{TypeError}}. + 1. If |parameters| or |results| contains an [=ν—‚νŸ¨νŸ¦=], throw a {{TypeError}}. Note: the above error is thrown each time the \[[Call]] method is invoked. @@ -761,7 +761,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not To create a host function from the JavaScript object |func|, perform the following steps: 1. Let |hostfunc| be a [=host function=] which performs the following steps when called: - 1. If the signature contains an [=π—‚πŸ¨πŸ¦=] (as argument or result), the host function throws a {{TypeError}} when called. + 1. If the signature contains an [=ν—‚νŸ¨νŸ¦=] (as argument or result), the host function throws a {{TypeError}} when called. 1. Let |arguments| be a [=list=] of the arguments of the invocation of this function. 1. Let |jsArguments| be an empty [=list=]. 1. For each |arg| in |arguments|, @@ -779,10 +779,10 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
The algorithm ToJSValue(|w|) coerces a [=WebAssembly value=] to a JavaScript value performs the following steps: -Assert: |w| is not of the form [=π—‚πŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ—=] |i64|. -1. If |w| is of the form [=𝗂πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ—=] |i32|, return [=the Number value=] for |i32|. -1. If |w| is of the form [=𝖿πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ—=] |f32|, return [=the Number value=] for |f32|. -1. If |w| is of the form [=π–ΏπŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ—=] |f64|, return [=the Number value=] for |f64|. +Assert: |w| is not of the form [=ν—‚νŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν—=] |i64|. +1. If |w| is of the form [=ν—‚νŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν—=] |i32|, return [=the Number value=] for |i32|. +1. If |w| is of the form [=ν–ΏνŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν—=] |f32|, return [=the Number value=] for |f32|. +1. If |w| is of the form [=ν–ΏνŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν—=] |f64|, return [=the Number value=] for |f64|. @@ -793,16 +793,16 @@ Note: Implementations may optionally replace the NaN payload with any other NaN The algorithm ToWebAssemblyValue(|v|, |type|) coerce a JavaScript value to a [=WebAssembly value=] performs the following steps: -Assert: |type| is not [=π—‚πŸ¨πŸ¦=]. -1. If |type| is [=𝗂πŸ₯𝟀=], +Assert: |type| is not [=ν—‚νŸ¨νŸ¦=]. +1. If |type| is [=ν—‚νŸ₯ퟀ=], 1. Let |i32| be ? [=ToInt32=](|v|). - 1. Return [=𝗂πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ—=] |i32|. -1. If |type| is [=𝖿πŸ₯𝟀=], + 1. Return [=ν—‚νŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν—=] |i32|. +1. If |type| is [=ν–ΏνŸ₯ퟀ=], 1. Let |f32| be ? [=ToNumber=](|v|) rounded to the nearest representable value using IEEE 754-2008 round to nearest, ties to even mode. - 1. Return [=𝖿πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ—=] |f32|. -1. If |type| is [=π–ΏπŸ¨πŸ¦=], + 1. Return [=ν–ΏνŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν—=] |f32|. +1. If |type| is [=ν–ΏνŸ¨νŸ¦=], 1. Let |f64| be ? [=ToNumber=](|v|). - 1. Return [=π–ΏπŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ—=] |f64|. + 1. Return [=ν–ΏνŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν—=] |f64|.
diff --git a/interpreter/README.md b/interpreter/README.md index 36ccf27542..ae40ab502d 100644 --- a/interpreter/README.md +++ b/interpreter/README.md @@ -190,7 +190,7 @@ block_sig : ( result * )* func_sig: ( type )? * * global_sig: | ( mut ) table_sig: ? -memory_sig: ? +mem_sig: ? expr: ( ) @@ -226,8 +226,8 @@ op: set_global .load((8|16|32)_)? ? ? .store(8|16|32)? ? ? - current_memory - grow_memory + mem.size + mem.grow .const . . @@ -251,10 +251,10 @@ table: ( table ? ) ( table ? ( export )* ( elem * ) ) ;; = (table ? ( export )* ) (elem (i32.const 0) *) elem: ( elem ? (offset * ) * ) ( elem ? * ) ;; = (elem ? (offset ) *) -memory: ( memory ? ) - ( memory ? ( export ) <...> ) ;; = (export (memory ))+ (memory ? <...>) - ( memory ? ( import ) ) ;; = (import ? (memory )) - ( memory ? ( export )* ( data * ) ;; = (memory ? ( export )* ) (data (i32.const 0) *) +mem: ( mem ? ) + ( mem ? ( export ) <...> ) ;; = (export (mem ))+ (mem ? <...>) + ( mem ? ( import ) ) ;; = (import ? (mem )) + ( mem ? ( export )* ( data * ) ;; = (mem ? ( export )* ) (data (i32.const 0) *) data: ( data ? ( offset * ) * ) ( data ? * ) ;; = (data ? (offset ) *) @@ -266,16 +266,16 @@ import: ( import ) imkind: ( func ? ) ( global ? ) ( table ? ) - ( memory ? ) + ( mem ? ) export: ( export ) exkind: ( func ) ( global ) ( table ) - ( memory ) + ( mem ) -module: ( module ? * * * * ? ? * * * ? ) - * * * *
? ? * * * ? ;; = - ( module * * * *
? ? * * * ? ) +module: ( module ? * * * *
? ? * * * ? ) + * * * *
? ? * * * ? ;; = + ( module * * * *
? ? * * * ? ) ``` Here, productions marked with respective comments are abbreviation forms for equivalent expansions (see the explanation of the AST below). @@ -285,7 +285,7 @@ For raw instructions, the syntax allows omitting the parentheses around the oper Any form of naming via `` and `` (including expression labels) is merely notational convenience of this text format. The actual AST has no names, and all bindings are referred to via ordered numeric indices; consequently, names are immediately resolved in the parser and replaced by indices. Indices can also be used directly in the text format. The segment strings in the memory field are used to initialize the consecutive memory at the given offset. -The `` in the expansion of the two short-hand forms for `table` and `memory` is the minimal size that can hold the segment: the number of ``s for tables, and the accumulative length of the strings rounded up to page size for memories. +The `` in the expansion of the two short-hand forms for `table` and `mem` is the minimal size that can hold the segment: the number of ``s for tables, and the accumulative length of the strings rounded up to page size for memories. In addition to the grammar rules above, the fields of a module may appear in any order, except that all imports must occur before the first proper definition of a function, table, memory, or global. diff --git a/interpreter/binary/decode.ml b/interpreter/binary/decode.ml index a266634261..c25c1dad81 100644 --- a/interpreter/binary/decode.ml +++ b/interpreter/binary/decode.ml @@ -168,9 +168,9 @@ let table_type s = let lim = limits vu32 s in TableType (lim, t) -let memory_type s = +let mem_type s = let lim = limits vu32 s in - MemoryType lim + MemType lim let mutability s = match u8 s with @@ -289,10 +289,10 @@ let rec instr s = | 0x3f -> expect 0x00 s "zero flag expected"; - current_memory + mem_size | 0x40 -> expect 0x00 s "zero flag expected"; - grow_memory + mem_grow | 0x41 -> i32_const (at vs32 s) | 0x42 -> i64_const (at vs64 s) @@ -460,7 +460,7 @@ let id s = | 2 -> `ImportSection | 3 -> `FuncSection | 4 -> `TableSection - | 5 -> `MemorySection + | 5 -> `MemSection | 6 -> `GlobalSection | 7 -> `ExportSection | 8 -> `StartSection @@ -493,7 +493,7 @@ let import_desc s = match u8 s with | 0x00 -> FuncImport (at var s) | 0x01 -> TableImport (table_type s) - | 0x02 -> MemoryImport (memory_type s) + | 0x02 -> MemImport (mem_type s) | 0x03 -> GlobalImport (global_type s) | _ -> error s (pos s - 1) "invalid import kind" @@ -525,12 +525,12 @@ let table_section s = (* Memory section *) -let memory s = - let mtype = memory_type s in +let mem s = + let mtype = mem_type s in {mtype} -let memory_section s = - section `MemorySection (vec (at memory)) [] s +let mem_section s = + section `MemSection (vec (at mem)) [] s (* Global section *) @@ -550,7 +550,7 @@ let export_desc s = match u8 s with | 0x00 -> FuncExport (at var s) | 0x01 -> TableExport (at var s) - | 0x02 -> MemoryExport (at var s) + | 0x02 -> MemExport (at var s) | 0x03 -> GlobalExport (at var s) | _ -> error s (pos s - 1) "invalid export kind" @@ -603,11 +603,11 @@ let elem_section s = (* Data section *) -let memory_segment s = +let mem_segment s = segment string s let data_section s = - section `DataSection (vec (at memory_segment)) [] s + section `DataSection (vec (at mem_segment)) [] s (* Custom section *) @@ -640,7 +640,7 @@ let module_ s = iterate custom_section s; let tables = table_section s in iterate custom_section s; - let memories = memory_section s in + let mems = mem_section s in iterate custom_section s; let globals = global_section s in iterate custom_section s; @@ -660,7 +660,7 @@ let module_ s = let funcs = List.map2 Source.(fun t f -> {f.it with ftype = t} @@ f.at) func_types func_bodies - in {types; tables; memories; globals; funcs; imports; exports; elems; data; start} + in {types; tables; mems; globals; funcs; imports; exports; elems; data; start} let decode name bs = at module_ (stream name bs) diff --git a/interpreter/binary/encode.ml b/interpreter/binary/encode.ml index adbf418a44..9b4c5b8840 100644 --- a/interpreter/binary/encode.ml +++ b/interpreter/binary/encode.ml @@ -115,8 +115,8 @@ let encode m = let table_type = function | TableType (lim, t) -> elem_type t; limits vu32 lim - let memory_type = function - | MemoryType lim -> limits vu32 lim + let mem_type = function + | MemType lim -> limits vu32 lim let mutability = function | Immutable -> u8 0 @@ -130,7 +130,7 @@ let encode m = open Source open Ast open Values - open Memory + open Mem let op n = u8 n let end_ () = op 0x0b @@ -171,27 +171,27 @@ let encode m = | Load ({ty = I64Type; sz = None; _} as mo) -> op 0x29; memop mo | Load ({ty = F32Type; sz = None; _} as mo) -> op 0x2a; memop mo | Load ({ty = F64Type; sz = None; _} as mo) -> op 0x2b; memop mo - | Load ({ty = I32Type; sz = Some (Mem8, SX); _} as mo) -> + | Load ({ty = I32Type; sz = Some (Pack8, SX); _} as mo) -> op 0x2c; memop mo - | Load ({ty = I32Type; sz = Some (Mem8, ZX); _} as mo) -> + | Load ({ty = I32Type; sz = Some (Pack8, ZX); _} as mo) -> op 0x2d; memop mo - | Load ({ty = I32Type; sz = Some (Mem16, SX); _} as mo) -> + | Load ({ty = I32Type; sz = Some (Pack16, SX); _} as mo) -> op 0x2e; memop mo - | Load ({ty = I32Type; sz = Some (Mem16, ZX); _} as mo) -> + | Load ({ty = I32Type; sz = Some (Pack16, ZX); _} as mo) -> op 0x2f; memop mo - | Load {ty = I32Type; sz = Some (Mem32, _); _} -> + | Load {ty = I32Type; sz = Some (Pack32, _); _} -> assert false - | Load ({ty = I64Type; sz = Some (Mem8, SX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack8, SX); _} as mo) -> op 0x30; memop mo - | Load ({ty = I64Type; sz = Some (Mem8, ZX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack8, ZX); _} as mo) -> op 0x31; memop mo - | Load ({ty = I64Type; sz = Some (Mem16, SX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack16, SX); _} as mo) -> op 0x32; memop mo - | Load ({ty = I64Type; sz = Some (Mem16, ZX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack16, ZX); _} as mo) -> op 0x33; memop mo - | Load ({ty = I64Type; sz = Some (Mem32, SX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack32, SX); _} as mo) -> op 0x34; memop mo - | Load ({ty = I64Type; sz = Some (Mem32, ZX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack32, ZX); _} as mo) -> op 0x35; memop mo | Load {ty = F32Type | F64Type; sz = Some _; _} -> assert false @@ -200,16 +200,16 @@ let encode m = | Store ({ty = I64Type; sz = None; _} as mo) -> op 0x37; memop mo | Store ({ty = F32Type; sz = None; _} as mo) -> op 0x38; memop mo | Store ({ty = F64Type; sz = None; _} as mo) -> op 0x39; memop mo - | Store ({ty = I32Type; sz = Some Mem8; _} as mo) -> op 0x3a; memop mo - | Store ({ty = I32Type; sz = Some Mem16; _} as mo) -> op 0x3b; memop mo - | Store {ty = I32Type; sz = Some Mem32; _} -> assert false - | Store ({ty = I64Type; sz = Some Mem8; _} as mo) -> op 0x3c; memop mo - | Store ({ty = I64Type; sz = Some Mem16; _} as mo) -> op 0x3d; memop mo - | Store ({ty = I64Type; sz = Some Mem32; _} as mo) -> op 0x3e; memop mo + | Store ({ty = I32Type; sz = Some Pack8; _} as mo) -> op 0x3a; memop mo + | Store ({ty = I32Type; sz = Some Pack16; _} as mo) -> op 0x3b; memop mo + | Store {ty = I32Type; sz = Some Pack32; _} -> assert false + | Store ({ty = I64Type; sz = Some Pack8; _} as mo) -> op 0x3c; memop mo + | Store ({ty = I64Type; sz = Some Pack16; _} as mo) -> op 0x3d; memop mo + | Store ({ty = I64Type; sz = Some Pack32; _} as mo) -> op 0x3e; memop mo | Store {ty = F32Type | F64Type; sz = Some _; _} -> assert false - | CurrentMemory -> op 0x3f; u8 0x00 - | GrowMemory -> op 0x40; u8 0x00 + | MemSize -> op 0x3f; u8 0x00 + | MemGrow -> op 0x40; u8 0x00 | Const {it = I32 c; _} -> op 0x41; vs32 c | Const {it = I64 c; _} -> op 0x42; vs64 c @@ -388,7 +388,7 @@ let encode m = match d.it with | FuncImport x -> u8 0x00; var x | TableImport t -> u8 0x01; table_type t - | MemoryImport t -> u8 0x02; memory_type t + | MemImport t -> u8 0x02; mem_type t | GlobalImport t -> u8 0x03; global_type t let import im = @@ -413,12 +413,12 @@ let encode m = section 4 (vec table) tabs (tabs <> []) (* Memory section *) - let memory mem = + let mem mem = let {mtype} = mem.it in - memory_type mtype + mem_type mtype - let memory_section mems = - section 5 (vec memory) mems (mems <> []) + let mem_section mems = + section 5 (vec mem) mems (mems <> []) (* Global section *) let global g = @@ -433,7 +433,7 @@ let encode m = match d.it with | FuncExport x -> u8 0; var x | TableExport x -> u8 1; var x - | MemoryExport x -> u8 2; var x + | MemExport x -> u8 2; var x | GlobalExport x -> u8 3; var x let export ex = @@ -480,11 +480,11 @@ let encode m = section 9 (vec table_segment) elems (elems <> []) (* Data section *) - let memory_segment seg = + let mem_segment seg = segment string seg let data_section data = - section 11 (vec memory_segment) data (data <> []) + section 11 (vec mem_segment) data (data <> []) (* Module *) @@ -495,7 +495,7 @@ let encode m = import_section m.it.imports; func_section m.it.funcs; table_section m.it.tables; - memory_section m.it.memories; + mem_section m.it.mems; global_section m.it.globals; export_section m.it.exports; start_section m.it.start; diff --git a/interpreter/exec/eval.ml b/interpreter/exec/eval.ml index eb8f0b8daa..f9f4e80cf8 100644 --- a/interpreter/exec/eval.ml +++ b/interpreter/exec/eval.ml @@ -17,11 +17,11 @@ exception Trap = Trap.Error exception Crash = Crash.Error (* failure that cannot happen in valid code *) exception Exhaustion = Exhaustion.Error -let memory_error at = function - | Memory.Bounds -> "out of bounds memory access" - | Memory.SizeOverflow -> "memory size overflow" - | Memory.SizeLimit -> "memory size limit reached" - | Memory.Type -> Crash.error at "type mismatch at memory access" +let mem_error at = function + | Mem.Bounds -> "out of bounds memory access" + | Mem.SizeOverflow -> "memory size overflow" + | Mem.SizeLimit -> "memory size limit reached" + | Mem.Type -> Crash.error at "type mismatch at memory access" | exn -> raise exn let numeric_error at = function @@ -77,7 +77,7 @@ let lookup category list x = let type_ (inst : module_inst) x = lookup "type" inst.types x let func (inst : module_inst) x = lookup "function" inst.funcs x let table (inst : module_inst) x = lookup "table" inst.tables x -let memory (inst : module_inst) x = lookup "memory" inst.memories x +let mem (inst : module_inst) x = lookup "memory" inst.mems x let global (inst : module_inst) x = lookup "global" inst.globals x let local (frame : frame) x = lookup "local" frame.locals x @@ -193,37 +193,37 @@ let rec step (c : config) : config = | Global.Type -> Crash.error e.at "type mismatch at global write") | Load {offset; ty; sz; _}, I32 i :: vs' -> - let mem = memory frame.inst (0l @@ e.at) in + let mem = mem frame.inst (0l @@ e.at) in let addr = I64_convert.extend_u_i32 i in (try let v = match sz with - | None -> Memory.load_value mem addr offset ty - | Some (sz, ext) -> Memory.load_packed sz ext mem addr offset ty + | None -> Mem.load_value mem addr offset ty + | Some (sz, ext) -> Mem.load_packed sz ext mem addr offset ty in v :: vs', [] - with exn -> vs', [Trapped (memory_error e.at exn) @@ e.at]) + with exn -> vs', [Trapped (mem_error e.at exn) @@ e.at]) | Store {offset; sz; _}, v :: I32 i :: vs' -> - let mem = memory frame.inst (0l @@ e.at) in + let mem = mem frame.inst (0l @@ e.at) in let addr = I64_convert.extend_u_i32 i in (try (match sz with - | None -> Memory.store_value mem addr offset v - | Some sz -> Memory.store_packed sz mem addr offset v + | None -> Mem.store_value mem addr offset v + | Some sz -> Mem.store_packed sz mem addr offset v ); vs', [] - with exn -> vs', [Trapped (memory_error e.at exn) @@ e.at]); + with exn -> vs', [Trapped (mem_error e.at exn) @@ e.at]); - | CurrentMemory, vs -> - let mem = memory frame.inst (0l @@ e.at) in - I32 (Memory.size mem) :: vs, [] + | MemSize, vs -> + let mem = mem frame.inst (0l @@ e.at) in + I32 (Mem.size mem) :: vs, [] - | GrowMemory, I32 delta :: vs' -> - let mem = memory frame.inst (0l @@ e.at) in - let old_size = Memory.size mem in + | MemGrow, I32 delta :: vs' -> + let mem = mem frame.inst (0l @@ e.at) in + let old_size = Mem.size mem in let result = - try Memory.grow mem delta; old_size - with Memory.SizeOverflow | Memory.SizeLimit | Memory.OutOfMemory -> -1l + try Mem.grow mem delta; old_size + with Mem.SizeOverflow | Mem.SizeLimit | Mem.OutOfMemory -> -1l in I32 result :: vs', [] | Const v, vs -> @@ -353,9 +353,9 @@ let create_table (inst : module_inst) (tab : table) : table_inst = let {ttype} = tab.it in Table.alloc ttype -let create_memory (inst : module_inst) (mem : memory) : memory_inst = +let create_mem (inst : module_inst) (mem : mem) : mem_inst = let {mtype} = mem.it in - Memory.alloc mtype + Mem.alloc mtype let create_global (inst : module_inst) (glob : global) : global_inst = let {gtype; value} = glob.it in @@ -368,7 +368,7 @@ let create_export (inst : module_inst) (ex : export) : export_inst = match edesc.it with | FuncExport x -> ExternFunc (func inst x) | TableExport x -> ExternTable (table inst x) - | MemoryExport x -> ExternMemory (memory inst x) + | MemExport x -> ExternMem (mem inst x) | GlobalExport x -> ExternGlobal (global inst x) in name, ext @@ -389,16 +389,16 @@ let init_table (inst : module_inst) (seg : table_segment) = fun () -> Table.blit tab offset (List.map (fun x -> FuncElem (func inst x)) init) -let init_memory (inst : module_inst) (seg : memory_segment) = +let init_mem (inst : module_inst) (seg : mem_segment) = let {index; offset = const; init} = seg.it in - let mem = memory inst index in + let mem = mem inst index in let offset' = i32 (eval_const inst const) const.at in let offset = I64_convert.extend_u_i32 offset' in let end_ = Int64.(add offset (of_int (String.length init))) in - let bound = Memory.bound mem in + let bound = Mem.bound mem in if I64.lt_u bound end_ || I64.lt_u end_ offset then Link.error seg.at "data segment does not fit memory"; - fun () -> Memory.store_bytes mem offset init + fun () -> Mem.store_bytes mem offset init let add_import (m : module_) (ext : extern) (im : import) (inst : module_inst) @@ -408,12 +408,12 @@ let add_import (m : module_) (ext : extern) (im : import) (inst : module_inst) match ext with | ExternFunc func -> {inst with funcs = func :: inst.funcs} | ExternTable tab -> {inst with tables = tab :: inst.tables} - | ExternMemory mem -> {inst with memories = mem :: inst.memories} + | ExternMem mem -> {inst with mems = mem :: inst.mems} | ExternGlobal glob -> {inst with globals = glob :: inst.globals} let init (m : module_) (exts : extern list) : module_inst = let - { imports; tables; memories; globals; funcs; types; + { imports; tables; mems; globals; funcs; types; exports; elems; data; start } = m.it in @@ -428,13 +428,13 @@ let init (m : module_) (exts : extern list) : module_inst = { inst0 with funcs = inst0.funcs @ fs; tables = inst0.tables @ List.map (create_table inst0) tables; - memories = inst0.memories @ List.map (create_memory inst0) memories; + mems = inst0.mems @ List.map (create_mem inst0) mems; globals = inst0.globals @ List.map (create_global inst0) globals; } in List.iter (init_func inst) fs; let init_elems = List.map (init_table inst) elems in - let init_datas = List.map (init_memory inst) data in + let init_datas = List.map (init_mem inst) data in List.iter (fun f -> f ()) init_elems; List.iter (fun f -> f ()) init_datas; Lib.Option.app (fun x -> ignore (invoke (func inst x) [])) start; diff --git a/interpreter/host/spectest.ml b/interpreter/host/spectest.ml index e29c8c8b60..a075307aba 100644 --- a/interpreter/host/spectest.ml +++ b/interpreter/host/spectest.ml @@ -17,7 +17,7 @@ let global (GlobalType (t, _) as gt) = in Global.alloc gt v let table = Table.alloc (TableType ({min = 10l; max = Some 20l}, AnyFuncType)) -let memory = Memory.alloc (MemoryType {min = 1l; max = Some 2l}) +let mem = Mem.alloc (MemType {min = 1l; max = Some 2l}) let func f t = Func.alloc_host t (f t) let print_value v = @@ -38,5 +38,5 @@ let lookup name t = | "global", ExternGlobalType t -> ExternGlobal (global t) | "global", _ -> ExternGlobal (global (GlobalType (I32Type, Immutable))) | "table", _ -> ExternTable table - | "memory", _ -> ExternMemory memory + | "memory", _ -> ExternMem mem | _ -> raise Not_found diff --git a/interpreter/runtime/instance.ml b/interpreter/runtime/instance.ml index 6ac583742d..38af531c7e 100644 --- a/interpreter/runtime/instance.ml +++ b/interpreter/runtime/instance.ml @@ -5,21 +5,21 @@ type module_inst = types : func_type list; funcs : func_inst list; tables : table_inst list; - memories : memory_inst list; + mems : mem_inst list; globals : global_inst list; exports : export_inst list; } and func_inst = module_inst ref Func.t and table_inst = Table.t -and memory_inst = Memory.t +and mem_inst = Mem.t and global_inst = Global.t and export_inst = Ast.name * extern and extern = | ExternFunc of func_inst | ExternTable of table_inst - | ExternMemory of memory_inst + | ExternMem of mem_inst | ExternGlobal of global_inst type Table.elem += FuncElem of func_inst @@ -28,13 +28,12 @@ type Table.elem += FuncElem of func_inst (* Auxiliary functions *) let empty_module_inst = - { types = []; funcs = []; tables = []; memories = []; globals = []; - exports = [] } + { types = []; funcs = []; tables = []; mems = []; globals = []; exports = [] } let extern_type_of = function | ExternFunc func -> ExternFuncType (Func.type_of func) | ExternTable tab -> ExternTableType (Table.type_of tab) - | ExternMemory mem -> ExternMemoryType (Memory.type_of mem) + | ExternMem mem -> ExternMemType (Mem.type_of mem) | ExternGlobal glob -> ExternGlobalType (Global.type_of glob) let export inst name = diff --git a/interpreter/runtime/memory.ml b/interpreter/runtime/mem.ml similarity index 87% rename from interpreter/runtime/memory.ml rename to interpreter/runtime/mem.ml index fd9783d934..cace791a01 100644 --- a/interpreter/runtime/memory.ml +++ b/interpreter/runtime/mem.ml @@ -7,12 +7,12 @@ type size = int32 (* number of pages *) type address = int64 type offset = int32 -type mem_size = Mem8 | Mem16 | Mem32 +type packed_size = Pack8 | Pack16 | Pack32 type extension = SX | ZX -type memory' = (int, int8_unsigned_elt, c_layout) Array1.t -type memory = {mutable content : memory'; max : size option} -type t = memory +type mem' = (int, int8_unsigned_elt, c_layout) Array1.t +type mem = {mutable content : mem'; max : size option} +type t = mem exception Type exception Bounds @@ -22,10 +22,10 @@ exception OutOfMemory let page_size = 0x10000L (* 64 KiB *) -let mem_size = function - | Mem8 -> 1 - | Mem16 -> 2 - | Mem32 -> 4 +let packed_size = function + | Pack8 -> 1 + | Pack16 -> 2 + | Pack32 -> 4 let within_limits n = function | None -> true @@ -40,7 +40,7 @@ let create n = mem with Out_of_memory -> raise OutOfMemory -let alloc (MemoryType {min; max}) = +let alloc (MemType {min; max}) = assert (within_limits min max); {content = create min; max} @@ -51,7 +51,7 @@ let size mem = Int64.(to_int32 (div (bound mem) page_size)) let type_of mem = - MemoryType {min = size mem; max = mem.max} + MemType {min = size mem; max = mem.max} let grow mem delta = let old_size = size mem in @@ -126,8 +126,8 @@ let extend x n = function | SX -> let sh = 64 - 8 * n in Int64.(shift_right (shift_left x sh) sh) let load_packed sz ext mem a o t = - assert (mem_size sz <= Types.size t); - let n = mem_size sz in + assert (packed_size sz <= Types.size t); + let n = packed_size sz in let x = extend (loadn mem a o n) n ext in match t with | I32Type -> I32 (Int64.to_int32 x) @@ -135,8 +135,8 @@ let load_packed sz ext mem a o t = | _ -> raise Type let store_packed sz mem a o v = - assert (mem_size sz <= Types.size (Values.type_of v)); - let n = mem_size sz in + assert (packed_size sz <= Types.size (Values.type_of v)); + let n = packed_size sz in let x = match v with | I32 x -> Int64.of_int32 x diff --git a/interpreter/runtime/mem.mli b/interpreter/runtime/mem.mli new file mode 100644 index 0000000000..50d86963e6 --- /dev/null +++ b/interpreter/runtime/mem.mli @@ -0,0 +1,44 @@ +open Types +open Values + +type mem +type t = mem + +type size = int32 (* number of pages *) +type address = int64 +type offset = int32 + +type packed_size = Pack8 | Pack16 | Pack32 +type extension = SX | ZX + +exception Type +exception Bounds +exception SizeOverflow +exception SizeLimit +exception OutOfMemory + +val page_size : int64 +val packed_size : packed_size -> int + +val alloc : mem_type -> mem (* raises SizeOverflow, OutOfMemory *) +val type_of : mem -> mem_type +val size : mem -> size +val bound : mem -> address +val grow : mem -> size -> unit + (* raises SizeLimit, SizeOverflow, OutOfMemory *) + +val load_byte : mem -> address -> int (* raises Bounds *) +val store_byte : mem -> address -> int -> unit (* raises Bounds *) +val load_bytes : mem -> address -> int -> string (* raises Bounds *) +val store_bytes : mem -> address -> string -> unit (* raises Bounds *) + +val load_value : + mem -> address -> offset -> value_type -> value (* raises Bounds *) +val store_value : + mem -> address -> offset -> value -> unit (* raises Bounds *) +val load_packed : + packed_size -> extension -> mem -> address -> offset -> value_type -> value + (* raises Type, Bounds *) +val store_packed : + packed_size -> mem -> address -> offset -> value -> unit + (* raises Type, Bounds *) diff --git a/interpreter/runtime/memory.mli b/interpreter/runtime/memory.mli deleted file mode 100644 index c5586e7b9e..0000000000 --- a/interpreter/runtime/memory.mli +++ /dev/null @@ -1,44 +0,0 @@ -open Types -open Values - -type memory -type t = memory - -type size = int32 (* number of pages *) -type address = int64 -type offset = int32 - -type mem_size = Mem8 | Mem16 | Mem32 -type extension = SX | ZX - -exception Type -exception Bounds -exception SizeOverflow -exception SizeLimit -exception OutOfMemory - -val page_size : int64 -val mem_size : mem_size -> int - -val alloc : memory_type -> memory (* raises SizeOverflow, OutOfMemory *) -val type_of : memory -> memory_type -val size : memory -> size -val bound : memory -> address -val grow : memory -> size -> unit - (* raises SizeLimit, SizeOverflow, OutOfMemory *) - -val load_byte : memory -> address -> int (* raises Bounds *) -val store_byte : memory -> address -> int -> unit (* raises Bounds *) -val load_bytes : memory -> address -> int -> string (* raises Bounds *) -val store_bytes : memory -> address -> string -> unit (* raises Bounds *) - -val load_value : - memory -> address -> offset -> value_type -> value (* raises Bounds *) -val store_value : - memory -> address -> offset -> value -> unit (* raises Bounds *) -val load_packed : - mem_size -> extension -> memory -> address -> offset -> value_type -> value - (* raises Type, Bounds *) -val store_packed : - mem_size -> memory -> address -> offset -> value -> unit - (* raises Type, Bounds *) diff --git a/interpreter/script/run.ml b/interpreter/script/run.ml index d1ec2866b6..74dfdb4a34 100644 --- a/interpreter/script/run.ml +++ b/interpreter/script/run.ml @@ -212,7 +212,7 @@ let print_import m im = match Ast.import_type m im with | ExternFuncType t -> "func", string_of_func_type t | ExternTableType t -> "table", string_of_table_type t - | ExternMemoryType t -> "memory", string_of_memory_type t + | ExternMemType t -> "mem", string_of_mem_type t | ExternGlobalType t -> "global", string_of_global_type t in Printf.printf " import %s \"%s\" \"%s\" : %s\n" @@ -225,7 +225,7 @@ let print_export m ex = match Ast.export_type m ex with | ExternFuncType t -> "func", string_of_func_type t | ExternTableType t -> "table", string_of_table_type t - | ExternMemoryType t -> "memory", string_of_memory_type t + | ExternMemType t -> "mem", string_of_mem_type t | ExternGlobalType t -> "global", string_of_global_type t in Printf.printf " export %s \"%s\" : %s\n" diff --git a/interpreter/syntax/ast.ml b/interpreter/syntax/ast.ml index e2efa7ee89..83f8e757ae 100644 --- a/interpreter/syntax/ast.ml +++ b/interpreter/syntax/ast.ml @@ -56,9 +56,9 @@ type relop = (I32Op.relop, I64Op.relop, F32Op.relop, F64Op.relop) Values.op type cvtop = (I32Op.cvtop, I64Op.cvtop, F32Op.cvtop, F64Op.cvtop) Values.op type 'a memop = - {ty : value_type; align : int; offset : Memory.offset; sz : 'a option} -type loadop = (Memory.mem_size * Memory.extension) memop -type storeop = Memory.mem_size memop + {ty : value_type; align : int; offset : Mem.offset; sz : 'a option} +type loadop = (Mem.packed_size * Mem.extension) memop +type storeop = Mem.packed_size memop (* Expressions *) @@ -89,8 +89,8 @@ and instr' = | SetGlobal of var (* write global variable *) | Load of loadop (* read memory at address *) | Store of storeop (* write memory at address *) - | CurrentMemory (* size of linear memory *) - | GrowMemory (* grow linear memory *) + | MemSize (* size of linear memory *) + | MemGrow (* grow linear memory *) | Const of literal (* constant *) | Test of testop (* numeric test *) | Compare of relop (* numeric comparison *) @@ -127,10 +127,10 @@ and table' = ttype : table_type; } -type memory = memory' Source.phrase -and memory' = +type mem = mem' Source.phrase +and mem' = { - mtype : memory_type; + mtype : mem_type; } type 'data segment = 'data segment' Source.phrase @@ -142,7 +142,7 @@ and 'data segment' = } type table_segment = var list segment -type memory_segment = string segment +type mem_segment = string segment (* Modules *) @@ -153,7 +153,7 @@ type export_desc = export_desc' Source.phrase and export_desc' = | FuncExport of var | TableExport of var - | MemoryExport of var + | MemExport of var | GlobalExport of var type export = export' Source.phrase @@ -167,7 +167,7 @@ type import_desc = import_desc' Source.phrase and import_desc' = | FuncImport of var | TableImport of table_type - | MemoryImport of memory_type + | MemImport of mem_type | GlobalImport of global_type type import = import' Source.phrase @@ -184,7 +184,7 @@ and module_' = types : type_ list; globals : global list; tables : table list; - memories : memory list; + mems : mem list; funcs : func list; start : var option; elems : var list segment list; @@ -201,7 +201,7 @@ let empty_module = types = []; globals = []; tables = []; - memories = []; + mems = []; funcs = []; start = None; elems = []; @@ -220,7 +220,7 @@ let import_type (m : module_) (im : import) : extern_type = match idesc.it with | FuncImport x -> ExternFuncType (func_type_for m x) | TableImport t -> ExternTableType t - | MemoryImport t -> ExternMemoryType t + | MemImport t -> ExternMemType t | GlobalImport t -> ExternGlobalType t let export_type (m : module_) (ex : export) : extern_type = @@ -235,9 +235,9 @@ let export_type (m : module_) (ex : export) : extern_type = | TableExport x -> let tts = tables its @ List.map (fun t -> t.it.ttype) m.it.tables in ExternTableType (nth tts x.it) - | MemoryExport x -> - let mts = memories its @ List.map (fun m -> m.it.mtype) m.it.memories in - ExternMemoryType (nth mts x.it) + | MemExport x -> + let mts = mems its @ List.map (fun m -> m.it.mtype) m.it.mems in + ExternMemType (nth mts x.it) | GlobalExport x -> let gts = globals its @ List.map (fun g -> g.it.gtype) m.it.globals in ExternGlobalType (nth gts x.it) diff --git a/interpreter/syntax/operators.ml b/interpreter/syntax/operators.ml index b207b193db..8be4a0b4fa 100644 --- a/interpreter/syntax/operators.ml +++ b/interpreter/syntax/operators.ml @@ -1,7 +1,7 @@ open Source open Types open Values -open Memory +open Mem open Ast @@ -36,40 +36,40 @@ let i64_load align offset = Load {ty = I64Type; align; offset; sz = None} let f32_load align offset = Load {ty = F32Type; align; offset; sz = None} let f64_load align offset = Load {ty = F64Type; align; offset; sz = None} let i32_load8_s align offset = - Load {ty = I32Type; align; offset; sz = Some (Mem8, SX)} + Load {ty = I32Type; align; offset; sz = Some (Pack8, SX)} let i32_load8_u align offset = - Load {ty = I32Type; align; offset; sz = Some (Mem8, ZX)} + Load {ty = I32Type; align; offset; sz = Some (Pack8, ZX)} let i32_load16_s align offset = - Load {ty = I32Type; align; offset; sz = Some (Mem16, SX)} + Load {ty = I32Type; align; offset; sz = Some (Pack16, SX)} let i32_load16_u align offset = - Load {ty = I32Type; align; offset; sz = Some (Mem16, ZX)} + Load {ty = I32Type; align; offset; sz = Some (Pack16, ZX)} let i64_load8_s align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem8, SX)} + Load {ty = I64Type; align; offset; sz = Some (Pack8, SX)} let i64_load8_u align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem8, ZX)} + Load {ty = I64Type; align; offset; sz = Some (Pack8, ZX)} let i64_load16_s align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem16, SX)} + Load {ty = I64Type; align; offset; sz = Some (Pack16, SX)} let i64_load16_u align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem16, ZX)} + Load {ty = I64Type; align; offset; sz = Some (Pack16, ZX)} let i64_load32_s align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem32, SX)} + Load {ty = I64Type; align; offset; sz = Some (Pack32, SX)} let i64_load32_u align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem32, ZX)} + Load {ty = I64Type; align; offset; sz = Some (Pack32, ZX)} let i32_store align offset = Store {ty = I32Type; align; offset; sz = None} let i64_store align offset = Store {ty = I64Type; align; offset; sz = None} let f32_store align offset = Store {ty = F32Type; align; offset; sz = None} let f64_store align offset = Store {ty = F64Type; align; offset; sz = None} let i32_store8 align offset = - Store {ty = I32Type; align; offset; sz = Some Mem8} + Store {ty = I32Type; align; offset; sz = Some Pack8} let i32_store16 align offset = - Store {ty = I32Type; align; offset; sz = Some Mem16} + Store {ty = I32Type; align; offset; sz = Some Pack16} let i64_store8 align offset = - Store {ty = I64Type; align; offset; sz = Some Mem8} + Store {ty = I64Type; align; offset; sz = Some Pack8} let i64_store16 align offset = - Store {ty = I64Type; align; offset; sz = Some Mem16} + Store {ty = I64Type; align; offset; sz = Some Pack16} let i64_store32 align offset = - Store {ty = I64Type; align; offset; sz = Some Mem32} + Store {ty = I64Type; align; offset; sz = Some Pack32} let i32_clz = Unary (I32 I32Op.Clz) let i32_ctz = Unary (I32 I32Op.Ctz) @@ -199,6 +199,6 @@ let i64_reinterpret_f64 = Convert (I64 I64Op.ReinterpretFloat) let f32_reinterpret_i32 = Convert (F32 F32Op.ReinterpretInt) let f64_reinterpret_i64 = Convert (F64 F64Op.ReinterpretInt) -let current_memory = CurrentMemory -let grow_memory = GrowMemory +let mem_size = MemSize +let mem_grow = MemGrow diff --git a/interpreter/syntax/types.ml b/interpreter/syntax/types.ml index f708e4b890..48fc0057cf 100644 --- a/interpreter/syntax/types.ml +++ b/interpreter/syntax/types.ml @@ -8,12 +8,12 @@ type func_type = FuncType of stack_type * stack_type type 'a limits = {min : 'a; max : 'a option} type mutability = Immutable | Mutable type table_type = TableType of Int32.t limits * elem_type -type memory_type = MemoryType of Int32.t limits +type mem_type = MemType of Int32.t limits type global_type = GlobalType of value_type * mutability type extern_type = | ExternFuncType of func_type | ExternTableType of table_type - | ExternMemoryType of memory_type + | ExternMemType of mem_type | ExternGlobalType of global_type @@ -39,7 +39,7 @@ let match_func_type ft1 ft2 = let match_table_type (TableType (lim1, et1)) (TableType (lim2, et2)) = et1 = et2 && match_limits lim1 lim2 -let match_memory_type (MemoryType lim1) (MemoryType lim2) = +let match_mem_type (MemType lim1) (MemType lim2) = match_limits lim1 lim2 let match_global_type gt1 gt2 = @@ -49,7 +49,7 @@ let match_extern_type et1 et2 = match et1, et2 with | ExternFuncType ft1, ExternFuncType ft2 -> match_func_type ft1 ft2 | ExternTableType tt1, ExternTableType tt2 -> match_table_type tt1 tt2 - | ExternMemoryType mt1, ExternMemoryType mt2 -> match_memory_type mt1 mt2 + | ExternMemType mt1, ExternMemType mt2 -> match_mem_type mt1 mt2 | ExternGlobalType gt1, ExternGlobalType gt2 -> match_global_type gt1 gt2 | _, _ -> false @@ -60,8 +60,8 @@ let funcs = Lib.List.map_filter (function ExternFuncType t -> Some t | _ -> None) let tables = Lib.List.map_filter (function ExternTableType t -> Some t | _ -> None) -let memories = - Lib.List.map_filter (function ExternMemoryType t -> Some t | _ -> None) +let mems = + Lib.List.map_filter (function ExternMemType t -> Some t | _ -> None) let globals = Lib.List.map_filter (function ExternGlobalType t -> Some t | _ -> None) @@ -85,8 +85,8 @@ let string_of_limits {min; max} = I32.to_string_u min ^ (match max with None -> "" | Some n -> " " ^ I32.to_string_u n) -let string_of_memory_type = function - | MemoryType lim -> string_of_limits lim +let string_of_mem_type = function + | MemType lim -> string_of_limits lim let string_of_table_type = function | TableType (lim, t) -> string_of_limits lim ^ " " ^ string_of_elem_type t @@ -104,5 +104,5 @@ let string_of_func_type (FuncType (ins, out)) = let string_of_extern_type = function | ExternFuncType ft -> "func " ^ string_of_func_type ft | ExternTableType tt -> "table " ^ string_of_table_type tt - | ExternMemoryType mt -> "memory " ^ string_of_memory_type mt + | ExternMemType mt -> "mem " ^ string_of_mem_type mt | ExternGlobalType gt -> "global " ^ string_of_global_type gt diff --git a/interpreter/text/arrange.ml b/interpreter/text/arrange.ml index c12d268b82..812fb6467b 100644 --- a/interpreter/text/arrange.ml +++ b/interpreter/text/arrange.ml @@ -187,14 +187,14 @@ let testop = oper (IntOp.testop, FloatOp.testop) let relop = oper (IntOp.relop, FloatOp.relop) let cvtop = oper (IntOp.cvtop, FloatOp.cvtop) -let mem_size = function - | Memory.Mem8 -> "8" - | Memory.Mem16 -> "16" - | Memory.Mem32 -> "32" +let packed_size = function + | Mem.Pack8 -> "8" + | Mem.Pack16 -> "16" + | Mem.Pack32 -> "32" let extension = function - | Memory.SX -> "_s" - | Memory.ZX -> "_u" + | Mem.SX -> "_s" + | Mem.ZX -> "_u" let memop name {ty; align; offset; _} = value_type ty ^ "." ^ name ^ @@ -204,12 +204,12 @@ let memop name {ty; align; offset; _} = let loadop op = match op.sz with | None -> memop "load" op - | Some (sz, ext) -> memop ("load" ^ mem_size sz ^ extension ext) op + | Some (sz, ext) -> memop ("load" ^ packed_size sz ^ extension ext) op let storeop op = match op.sz with | None -> memop "store" op - | Some sz -> memop ("store" ^ mem_size sz) op + | Some sz -> memop ("store" ^ packed_size sz) op (* Expressions *) @@ -244,8 +244,8 @@ let rec instr e = | SetGlobal x -> "set_global " ^ var x, [] | Load op -> loadop op, [] | Store op -> storeop op, [] - | CurrentMemory -> "current_memory", [] - | GrowMemory -> "grow_memory", [] + | MemSize -> "mem.size", [] + | MemGrow -> "mem.grow", [] | Const lit -> constop lit ^ " " ^ value lit, [] | Test op -> testop op, [] | Compare op -> relop op, [] @@ -285,9 +285,9 @@ let table off i tab = [atom elem_type t] ) -let memory off i mem = - let {mtype = MemoryType lim} = mem.it in - Node ("memory $" ^ nat (off + i) ^ " " ^ limits nat32 lim, []) +let mem off i mem = + let {mtype = MemType lim} = mem.it in + Node ("mem $" ^ nat (off + i) ^ " " ^ limits nat32 lim, []) let segment head dat seg = let {index; offset; init} = seg.it in @@ -310,7 +310,7 @@ let import_desc i d = | FuncImport x -> Node ("func $" ^ nat i, [Node ("type", [atom var x])]) | TableImport t -> table 0 i ({ttype = t} @@ d.at) - | MemoryImport t -> memory 0 i ({mtype = t} @@ d.at) + | MemImport t -> mem 0 i ({mtype = t} @@ d.at) | GlobalImport t -> Node ("global $" ^ nat i, [global_type t]) let import i im = @@ -323,7 +323,7 @@ let export_desc d = match d.it with | FuncExport x -> Node ("func", [atom var x]) | TableExport x -> Node ("table", [atom var x]) - | MemoryExport x -> Node ("memory", [atom var x]) + | MemExport x -> Node ("mem", [atom var x]) | GlobalExport x -> Node ("global", [atom var x]) let export ex = @@ -345,24 +345,24 @@ let is_func_import im = match im.it.idesc.it with FuncImport _ -> true | _ -> false let is_table_import im = match im.it.idesc.it with TableImport _ -> true | _ -> false -let is_memory_import im = - match im.it.idesc.it with MemoryImport _ -> true | _ -> false +let is_mem_import im = + match im.it.idesc.it with MemImport _ -> true | _ -> false let is_global_import im = match im.it.idesc.it with GlobalImport _ -> true | _ -> false let module_with_var_opt x_opt m = let func_imports = List.filter is_func_import m.it.imports in let table_imports = List.filter is_table_import m.it.imports in - let memory_imports = List.filter is_memory_import m.it.imports in + let mem_imports = List.filter is_mem_import m.it.imports in let global_imports = List.filter is_global_import m.it.imports in Node ("module" ^ var_opt x_opt, listi typedef m.it.types @ listi import table_imports @ - listi import memory_imports @ + listi import mem_imports @ listi import global_imports @ listi import func_imports @ listi (table (List.length table_imports)) m.it.tables @ - listi (memory (List.length memory_imports)) m.it.memories @ + listi (mem (List.length mem_imports)) m.it.mems @ listi (global (List.length global_imports)) m.it.globals @ listi (func_with_index (List.length func_imports)) m.it.funcs @ list export m.it.exports @ diff --git a/interpreter/text/lexer.mll b/interpreter/text/lexer.mll index 2a41d8cfe7..4f20a88944 100644 --- a/interpreter/text/lexer.mll +++ b/interpreter/text/lexer.mll @@ -314,8 +314,8 @@ rule token = parse | "i32.reinterpret/f32" { CONVERT i32_reinterpret_f32 } | "i64.reinterpret/f64" { CONVERT i64_reinterpret_f64 } - | "current_memory" { CURRENT_MEMORY } - | "grow_memory" { GROW_MEMORY } + | "mem.size" { MEM_SIZE } + | "mem.grow" { MEM_GROW } | "type" { TYPE } | "func" { FUNC } @@ -325,7 +325,7 @@ rule token = parse | "local" { LOCAL } | "global" { GLOBAL } | "table" { TABLE } - | "memory" { MEMORY } + | "mem" { MEM } | "elem" { ELEM } | "data" { DATA } | "offset" { OFFSET } diff --git a/interpreter/text/parser.mly b/interpreter/text/parser.mly index b7c65a3d17..1d58135ecb 100644 --- a/interpreter/text/parser.mly +++ b/interpreter/text/parser.mly @@ -63,11 +63,11 @@ type types = {space : space; mutable list : type_ list} let empty_types () = {space = empty (); list = []} type context = - { types : types; tables : space; memories : space; + { types : types; tables : space; mems : space; funcs : space; locals : space; globals : space; labels : int32 VarMap.t } let empty_context () = - { types = empty_types (); tables = empty (); memories = empty (); + { types = empty_types (); tables = empty (); mems = empty (); funcs = empty (); locals = empty (); globals = empty (); labels = VarMap.empty } @@ -83,7 +83,7 @@ let func (c : context) x = lookup "function" c.funcs x let local (c : context) x = lookup "local" c.locals x let global (c : context) x = lookup "global" c.globals x let table (c : context) x = lookup "table" c.tables x -let memory (c : context) x = lookup "memory" c.memories x +let mem (c : context) x = lookup "memory" c.mems x let label (c : context) x = try VarMap.find x.it c.labels with Not_found -> error x.at ("unknown label " ^ x.it) @@ -110,7 +110,7 @@ let bind_func (c : context) x = bind "function" c.funcs x let bind_local (c : context) x = bind "local" c.locals x let bind_global (c : context) x = bind "global" c.globals x let bind_table (c : context) x = bind "table" c.tables x -let bind_memory (c : context) x = bind "memory" c.memories x +let bind_mem (c : context) x = bind "memory" c.mems x let bind_label (c : context) x = {c with labels = VarMap.add x.it 0l (VarMap.map (Int32.add 1l) c.labels)} @@ -129,7 +129,7 @@ let anon_locals (c : context) ts = ignore (anon "local" c.locals (Lib.List32.length ts)) let anon_global (c : context) = anon "global" c.globals 1l let anon_table (c : context) = anon "table" c.tables 1l -let anon_memory (c : context) = anon "memory" c.memories 1l +let anon_mem (c : context) = anon "memory" c.mems 1l let anon_label (c : context) = {c with labels = VarMap.map (Int32.add 1l) c.labels} @@ -151,9 +151,9 @@ let inline_type_explicit (c : context) x ft at = %token GET_LOCAL SET_LOCAL TEE_LOCAL GET_GLOBAL SET_GLOBAL %token LOAD STORE OFFSET_EQ_NAT ALIGN_EQ_NAT %token CONST UNARY BINARY TEST COMPARE CONVERT -%token UNREACHABLE CURRENT_MEMORY GROW_MEMORY +%token UNREACHABLE MEM_SIZE MEM_GROW %token FUNC START TYPE PARAM RESULT LOCAL GLOBAL -%token TABLE ELEM MEMORY DATA OFFSET IMPORT EXPORT TABLE +%token TABLE ELEM MEM DATA OFFSET IMPORT EXPORT TABLE %token MODULE BIN QUOTE %token SCRIPT REGISTER INVOKE GET %token ASSERT_MALFORMED ASSERT_INVALID ASSERT_SOFT_INVALID ASSERT_UNLINKABLE @@ -173,8 +173,8 @@ let inline_type_explicit (c : context) x ft at = %token TEST %token COMPARE %token CONVERT -%token Memory.offset -> Ast.instr'> LOAD -%token Memory.offset -> Ast.instr'> STORE +%token Mem.offset -> Ast.instr'> LOAD +%token Mem.offset -> Ast.instr'> STORE %token OFFSET_EQ_NAT %token ALIGN_EQ_NAT @@ -229,8 +229,8 @@ func_sig : table_sig : | limits elem_type { TableType ($1, $2) } -memory_sig : - | limits { MemoryType $1 } +mem_sig : + | limits { MemType $1 } limits : | NAT { {min = nat32 $1 (ati 1); max = None} } @@ -317,8 +317,8 @@ plain_instr : | SET_GLOBAL var { fun c -> set_global ($2 c global) } | LOAD offset_opt align_opt { fun c -> $1 $3 $2 } | STORE offset_opt align_opt { fun c -> $1 $3 $2 } - | CURRENT_MEMORY { fun c -> current_memory } - | GROW_MEMORY { fun c -> grow_memory } + | MEM_SIZE { fun c -> mem_size } + | MEM_GROW { fun c -> mem_grow } | CONST literal { fun c -> fst (literal $1 $2) } | TEST { fun c -> $1 } | COMPARE { fun c -> $1 } @@ -554,32 +554,32 @@ table_fields : data : | LPAR DATA var offset string_list RPAR { let at = at () in - fun c -> {index = $3 c memory; offset = $4 c; init = $5} @@ at } + fun c -> {index = $3 c mem; offset = $4 c; init = $5} @@ at } | LPAR DATA offset string_list RPAR /* Sugar */ { let at = at () in fun c -> {index = 0l @@ at; offset = $3 c; init = $4} @@ at } -memory : - | LPAR MEMORY bind_var_opt memory_fields RPAR +mem : + | LPAR MEM bind_var_opt mem_fields RPAR { let at = at () in - fun c -> let x = $3 c anon_memory bind_memory @@ at in + fun c -> let x = $3 c anon_mem bind_mem @@ at in fun () -> $4 c x at } -memory_fields : - | memory_sig +mem_fields : + | mem_sig { fun c x at -> [{mtype = $1} @@ at], [], [], [] } - | inline_import memory_sig + | inline_import mem_sig { fun c x at -> [], [], [{ module_name = fst $1; item_name = snd $1; - idesc = MemoryImport $2 @@ at } @@ at], [] } - | inline_export memory_fields /* Sugar */ + idesc = MemImport $2 @@ at } @@ at], [] } + | inline_export mem_fields /* Sugar */ { fun c x at -> let mems, data, ims, exs = $2 c x at in - mems, data, ims, $1 (MemoryExport x) c :: exs } + mems, data, ims, $1 (MemExport x) c :: exs } | LPAR DATA string_list RPAR /* Sugar */ { fun c x at -> let size = Int32.(div (add (of_int (String.length $3)) 65535l) 65536l) in - [{mtype = MemoryType {min = size; max = Some size}} @@ at], + [{mtype = MemType {min = size; max = Some size}} @@ at], [{index = x; offset = [i32_const (0l @@ at) @@ at] @@ at; init = $3} @@ at], [], [] } @@ -616,9 +616,9 @@ import_desc : | LPAR TABLE bind_var_opt table_sig RPAR { fun c -> ignore ($3 c anon_table bind_table); fun () -> TableImport $4 } - | LPAR MEMORY bind_var_opt memory_sig RPAR - { fun c -> ignore ($3 c anon_memory bind_memory); - fun () -> MemoryImport $4 } + | LPAR MEM bind_var_opt mem_sig RPAR + { fun c -> ignore ($3 c anon_mem bind_mem); + fun () -> MemImport $4 } | LPAR GLOBAL bind_var_opt global_type RPAR { fun c -> ignore ($3 c anon_global bind_global); fun () -> GlobalImport $4 } @@ -635,7 +635,7 @@ inline_import : export_desc : | LPAR FUNC var RPAR { fun c -> FuncExport ($3 c func) } | LPAR TABLE var RPAR { fun c -> TableExport ($3 c table) } - | LPAR MEMORY var RPAR { fun c -> MemoryExport ($3 c memory) } + | LPAR MEM var RPAR { fun c -> MemExport ($3 c mem) } | LPAR GLOBAL var RPAR { fun c -> GlobalExport ($3 c global) } export : @@ -685,12 +685,12 @@ module_fields1 : error (List.hd m.imports).at "import after table definition"; { m with tables = tabs @ m.tables; elems = elems @ m.elems; imports = ims @ m.imports; exports = exs @ m.exports } } - | memory module_fields + | mem module_fields { fun c -> let mmf = $1 c in let mf = $2 c in fun () -> let mems, data, ims, exs = mmf () in let m = mf () in if mems <> [] && m.imports <> [] then error (List.hd m.imports).at "import after memory definition"; - { m with memories = mems @ m.memories; data = data @ m.data; + { m with mems = mems @ m.mems; data = data @ m.data; imports = ims @ m.imports; exports = exs @ m.exports } } | func module_fields { fun c -> let ff = $1 c in let mf = $2 c in diff --git a/interpreter/valid/valid.ml b/interpreter/valid/valid.ml index 3bdb5e2823..19b269c042 100644 --- a/interpreter/valid/valid.ml +++ b/interpreter/valid/valid.ml @@ -19,7 +19,7 @@ type context = types : func_type list; funcs : func_type list; tables : table_type list; - memories : memory_type list; + mems : mem_type list; globals : global_type list; locals : value_type list; results : value_type list; @@ -27,7 +27,7 @@ type context = } let empty_context = - { types = []; funcs = []; tables = []; memories = []; + { types = []; funcs = []; tables = []; mems = []; globals = []; locals = []; results = []; labels = [] } let lookup category list x = @@ -37,7 +37,7 @@ let lookup category list x = let type_ (c : context) x = lookup "type" c.types x let func (c : context) x = lookup "function" c.funcs x let table (c : context) x = lookup "table" c.tables x -let memory (c : context) x = lookup "memory" c.memories x +let mem (c : context) x = lookup "memory" c.mems x let global (c : context) x = lookup "global" c.globals x let local (c : context) x = lookup "local" c.locals x let label (c : context) x = lookup "label" c.labels x @@ -138,14 +138,14 @@ let type_cvtop at = function (* Expressions *) let check_memop (c : context) (memop : 'a memop) get_sz at = - ignore (memory c (0l @@ at)); + ignore (mem c (0l @@ at)); let size = match get_sz memop.sz with | None -> size memop.ty | Some sz -> - require (memop.ty = I64Type || sz <> Memory.Mem32) at + require (memop.ty = I64Type || sz <> Mem.Pack32) at "memory size too big"; - Memory.mem_size sz + Mem.packed_size sz in require (1 lsl memop.align <= size) at "alignment must not be larger than natural" @@ -254,12 +254,12 @@ let rec check_instr (c : context) (e : instr) (s : infer_stack_type) : op_type = check_memop c memop (fun sz -> sz) e.at; [I32Type; memop.ty] --> [] - | CurrentMemory -> - ignore (memory c (0l @@ e.at)); + | MemSize -> + ignore (mem c (0l @@ e.at)); [] --> [I32Type] - | GrowMemory -> - ignore (memory c (0l @@ e.at)); + | MemGrow -> + ignore (mem c (0l @@ e.at)); [I32Type] --> [I32Type] | Const v -> @@ -327,15 +327,15 @@ let check_table_type (tt : table_type) at = let TableType (lim, _) = tt in check_limits lim at -let check_memory_size (sz : I32.t) at = +let check_mem_size (sz : I32.t) at = require (I32.le_u sz 65536l) at "memory size must be at most 65536 pages (4GiB)" -let check_memory_type (mt : memory_type) at = - let MemoryType lim = mt in +let check_mem_type (mt : mem_type) at = + let MemType lim = mt in check_limits lim at; - check_memory_size lim.min at; - Lib.Option.app (fun max -> check_memory_size max at) lim.max + check_mem_size lim.min at; + Lib.Option.app (fun max -> check_mem_size max at) lim.max let check_global_type (gt : global_type) at = let GlobalType (t, mut) = gt in @@ -384,9 +384,9 @@ let check_table (c : context) (tab : table) = let {ttype} = tab.it in check_table_type ttype tab.at -let check_memory (c : context) (mem : memory) = +let check_mem (c : context) (mem : mem) = let {mtype} = mem.it in - check_memory_type mtype mem.at + check_mem_type mtype mem.at let check_elem (c : context) (seg : table_segment) = let {index; offset; init} = seg.it in @@ -394,10 +394,10 @@ let check_elem (c : context) (seg : table_segment) = ignore (table c index); ignore (List.map (func c) init) -let check_data (c : context) (seg : memory_segment) = +let check_data (c : context) (seg : mem_segment) = let {index; offset; init} = seg.it in check_const c offset I32Type; - ignore (memory c index) + ignore (mem c index) let check_global (c : context) (glob : global) = let {gtype; value} = glob.it in @@ -421,9 +421,9 @@ let check_import (im : import) (c : context) : context = | TableImport tt -> check_table_type tt idesc.at; {c with tables = tt :: c.tables} - | MemoryImport mt -> - check_memory_type mt idesc.at; - {c with memories = mt :: c.memories} + | MemImport mt -> + check_mem_type mt idesc.at; + {c with mems = mt :: c.mems} | GlobalImport gt -> check_global_type gt idesc.at; let GlobalType (_, mut) = gt in @@ -438,7 +438,7 @@ let check_export (c : context) (set : NameSet.t) (ex : export) : NameSet.t = (match edesc.it with | FuncExport x -> ignore (func c x) | TableExport x -> ignore (table c x) - | MemoryExport x -> ignore (memory c x) + | MemExport x -> ignore (mem c x) | GlobalExport x -> let GlobalType (_, mut) = global c x in require (mut = Immutable) edesc.at @@ -449,8 +449,8 @@ let check_export (c : context) (set : NameSet.t) (ex : export) : NameSet.t = let check_module (m : module_) = let - { types; imports; tables; memories; globals; funcs; start; elems; data; - exports } = m.it + {types; imports; tables; mems; globals; funcs; start; elems; data; exports} + = m.it in let c0 = List.fold_right check_import imports @@ -460,7 +460,7 @@ let check_module (m : module_) = { c0 with funcs = c0.funcs @ List.map (fun f -> type_ c0 f.it.ftype) funcs; tables = c0.tables @ List.map (fun tab -> tab.it.ttype) tables; - memories = c0.memories @ List.map (fun mem -> mem.it.mtype) memories; + mems = c0.mems @ List.map (fun mem -> mem.it.mtype) mems; } in let c = @@ -469,7 +469,7 @@ let check_module (m : module_) = List.iter check_type types; List.iter (check_global c1) globals; List.iter (check_table c1) tables; - List.iter (check_memory c1) memories; + List.iter (check_mem c1) mems; List.iter (check_elem c1) elems; List.iter (check_data c1) data; List.iter (check_func c) funcs; @@ -477,5 +477,5 @@ let check_module (m : module_) = ignore (List.fold_left (check_export c) NameSet.empty exports); require (List.length c.tables <= 1) m.at "multiple tables are not allowed (yet)"; - require (List.length c.memories <= 1) m.at + require (List.length c.mems <= 1) m.at "multiple memories are not allowed (yet)" diff --git a/interpreter/winmake.bat b/interpreter/winmake.bat index bc915bc244..8ca7d6e84f 100644 --- a/interpreter/winmake.bat +++ b/interpreter/winmake.bat @@ -1,92 +1,92 @@ rem Auto-generated from Makefile! set NAME=wasm if '%1' neq '' set NAME=%1 -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/numeric_error.cmo exec/numeric_error.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/int.cmo exec/int.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o util/lib.cmi util/lib.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/i32.cmo exec/i32.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/float.cmo exec/float.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I syntax -I util -I binary -I valid -I runtime -I host -I script -I text -I main -I exec -o syntax/types.cmo syntax/types.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/f32.cmo exec/f32.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/f64.cmo exec/f64.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/i64.cmo exec/i64.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I syntax -I util -I binary -I valid -I runtime -I host -I script -I text -I main -I exec -o syntax/values.cmo syntax/values.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/memory.cmi runtime/memory.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o util/source.cmi util/source.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I syntax -I util -I binary -I valid -I runtime -I host -I script -I text -I main -I exec -o syntax/ast.cmo syntax/ast.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/func.cmi runtime/func.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/global.cmi runtime/global.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/table.cmi runtime/table.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/instance.cmo runtime/instance.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/eval.cmi exec/eval.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I binary -I util -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o binary/utf8.cmi binary/utf8.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I host -I util -I binary -I valid -I syntax -I runtime -I script -I text -I main -I exec -o host/env.cmo host/env.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I main -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I exec -o main/flags.cmo main/flags.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I script -I util -I binary -I valid -I syntax -I runtime -I host -I text -I main -I exec -o script/import.cmi script/import.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I script -I util -I binary -I valid -I syntax -I runtime -I host -I text -I main -I exec -o script/run.cmi script/run.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I host -I util -I binary -I valid -I syntax -I runtime -I script -I text -I main -I exec -o host/spectest.cmo host/spectest.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I main -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I exec -o main/main.cmo main/main.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I main -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I exec -o main/main.d.cmo main/main.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o util/error.cmi util/error.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I script -I util -I binary -I valid -I syntax -I runtime -I host -I text -I main -I exec -o script/script.cmo script/script.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I binary -I util -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o binary/decode.cmi binary/decode.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I binary -I util -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o binary/encode.cmi binary/encode.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I script -I util -I binary -I valid -I syntax -I runtime -I host -I text -I main -I exec -o script/js.cmi script/js.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/parse.cmi text/parse.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/print.cmi text/print.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I valid -I util -I binary -I syntax -I runtime -I host -I script -I text -I main -I exec -o valid/valid.cmi valid/valid.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I host -I util -I binary -I valid -I syntax -I runtime -I script -I text -I main -I exec -o host/env.d.cmo host/env.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I main -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I exec -o main/flags.d.cmo main/flags.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I script -I util -I binary -I valid -I syntax -I runtime -I host -I text -I main -I exec -o script/import.d.cmo script/import.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I script -I util -I binary -I valid -I syntax -I runtime -I host -I text -I main -I exec -o script/run.d.cmo script/run.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I host -I util -I binary -I valid -I syntax -I runtime -I script -I text -I main -I exec -o host/spectest.d.cmo host/spectest.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I binary -I util -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o binary/utf8.d.cmo binary/utf8.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/eval_numeric.cmi exec/eval_numeric.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/i64_convert.cmi exec/i64_convert.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/eval.d.cmo exec/eval.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/func.d.cmo runtime/func.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/instance.d.cmo runtime/instance.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o util/source.d.cmo util/source.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I syntax -I util -I binary -I valid -I runtime -I host -I script -I text -I main -I exec -o syntax/types.d.cmo syntax/types.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I syntax -I util -I binary -I valid -I runtime -I host -I script -I text -I main -I exec -o syntax/values.d.cmo syntax/values.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/f32_convert.cmi exec/f32_convert.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/f64_convert.cmi exec/f64_convert.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/i32_convert.cmi exec/i32_convert.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I syntax -I util -I binary -I valid -I runtime -I host -I script -I text -I main -I exec -o syntax/ast.d.cmo syntax/ast.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o util/error.d.cmo util/error.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/eval_numeric.d.cmo exec/eval_numeric.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/global.d.cmo runtime/global.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/i32.d.cmo exec/i32.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/i64.d.cmo exec/i64.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/i64_convert.d.cmo exec/i64_convert.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o util/lib.d.cmo util/lib.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/memory.d.cmo runtime/memory.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/numeric_error.d.cmo exec/numeric_error.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I util -I binary -I valid -I syntax -I host -I script -I text -I main -I exec -o runtime/table.d.cmo runtime/table.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/f32.d.cmo exec/f32.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/f64.d.cmo exec/f64.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/float.d.cmo exec/float.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/int.d.cmo exec/int.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/f32_convert.d.cmo exec/f32_convert.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/f64_convert.d.cmo exec/f64_convert.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -o exec/i32_convert.d.cmo exec/i32_convert.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I syntax -I util -I binary -I valid -I runtime -I host -I script -I text -I main -I exec -o syntax/operators.cmo syntax/operators.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/numeric_error.cmo exec/numeric_error.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/int.cmo exec/int.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I util -I valid -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o util/lib.cmi util/lib.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/i32.cmo exec/i32.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/float.cmo exec/float.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I syntax -I valid -I util -I text -I script -I runtime -I main -I host -I exec -I binary -o syntax/types.cmo syntax/types.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/f32.cmo exec/f32.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/f64.cmo exec/f64.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/i64.cmo exec/i64.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I syntax -I valid -I util -I text -I script -I runtime -I main -I host -I exec -I binary -o syntax/values.cmo syntax/values.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/mem.cmi runtime/mem.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I util -I valid -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o util/source.cmi util/source.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I syntax -I valid -I util -I text -I script -I runtime -I main -I host -I exec -I binary -o syntax/ast.cmo syntax/ast.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/func.cmi runtime/func.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/global.cmi runtime/global.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/table.cmi runtime/table.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/instance.cmo runtime/instance.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/eval.cmi exec/eval.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I binary -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I exec -o binary/utf8.cmi binary/utf8.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I host -I valid -I util -I text -I syntax -I script -I runtime -I main -I exec -I binary -o host/env.cmo host/env.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I main -I valid -I util -I text -I syntax -I script -I runtime -I host -I exec -I binary -o main/flags.cmo main/flags.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I script -I valid -I util -I text -I syntax -I runtime -I main -I host -I exec -I binary -o script/import.cmi script/import.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I script -I valid -I util -I text -I syntax -I runtime -I main -I host -I exec -I binary -o script/run.cmi script/run.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I host -I valid -I util -I text -I syntax -I script -I runtime -I main -I exec -I binary -o host/spectest.cmo host/spectest.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I main -I valid -I util -I text -I syntax -I script -I runtime -I host -I exec -I binary -o main/main.cmo main/main.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I main -I valid -I util -I text -I syntax -I script -I runtime -I host -I exec -I binary -o main/main.d.cmo main/main.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I util -I valid -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o util/error.cmi util/error.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I script -I valid -I util -I text -I syntax -I runtime -I main -I host -I exec -I binary -o script/script.cmo script/script.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I binary -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I exec -o binary/decode.cmi binary/decode.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I binary -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I exec -o binary/encode.cmi binary/encode.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I script -I valid -I util -I text -I syntax -I runtime -I main -I host -I exec -I binary -o script/js.cmi script/js.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/parse.cmi text/parse.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/print.cmi text/print.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o valid/valid.cmi valid/valid.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I host -I valid -I util -I text -I syntax -I script -I runtime -I main -I exec -I binary -o host/env.d.cmo host/env.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I main -I valid -I util -I text -I syntax -I script -I runtime -I host -I exec -I binary -o main/flags.d.cmo main/flags.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I script -I valid -I util -I text -I syntax -I runtime -I main -I host -I exec -I binary -o script/import.d.cmo script/import.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I script -I valid -I util -I text -I syntax -I runtime -I main -I host -I exec -I binary -o script/run.d.cmo script/run.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I host -I valid -I util -I text -I syntax -I script -I runtime -I main -I exec -I binary -o host/spectest.d.cmo host/spectest.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I binary -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I exec -o binary/utf8.d.cmo binary/utf8.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/eval_numeric.cmi exec/eval_numeric.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/i64_convert.cmi exec/i64_convert.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/eval.d.cmo exec/eval.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/func.d.cmo runtime/func.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/instance.d.cmo runtime/instance.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I util -I valid -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o util/source.d.cmo util/source.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I syntax -I valid -I util -I text -I script -I runtime -I main -I host -I exec -I binary -o syntax/types.d.cmo syntax/types.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I syntax -I valid -I util -I text -I script -I runtime -I main -I host -I exec -I binary -o syntax/values.d.cmo syntax/values.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/f32_convert.cmi exec/f32_convert.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/f64_convert.cmi exec/f64_convert.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/i32_convert.cmi exec/i32_convert.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I syntax -I valid -I util -I text -I script -I runtime -I main -I host -I exec -I binary -o syntax/ast.d.cmo syntax/ast.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I util -I valid -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o util/error.d.cmo util/error.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/eval_numeric.d.cmo exec/eval_numeric.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/global.d.cmo runtime/global.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/i32.d.cmo exec/i32.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/i64.d.cmo exec/i64.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/i64_convert.d.cmo exec/i64_convert.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I util -I valid -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o util/lib.d.cmo util/lib.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/mem.d.cmo runtime/mem.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/numeric_error.d.cmo exec/numeric_error.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I runtime -I valid -I util -I text -I syntax -I script -I main -I host -I exec -I binary -o runtime/table.d.cmo runtime/table.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/f32.d.cmo exec/f32.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/f64.d.cmo exec/f64.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/float.d.cmo exec/float.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/int.d.cmo exec/int.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/f32_convert.d.cmo exec/f32_convert.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/f64_convert.d.cmo exec/f64_convert.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I exec -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I binary -o exec/i32_convert.d.cmo exec/i32_convert.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I syntax -I valid -I util -I text -I script -I runtime -I main -I host -I exec -I binary -o syntax/operators.cmo syntax/operators.ml ocamlyacc text/parser.mly -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/parser.cmi text/parser.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/lexer.cmi text/lexer.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o util/sexpr.cmi util/sexpr.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/arrange.cmi text/arrange.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I binary -I util -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o binary/decode.d.cmo binary/decode.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I binary -I util -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o binary/encode.d.cmo binary/encode.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I script -I util -I binary -I valid -I syntax -I runtime -I host -I text -I main -I exec -o script/js.d.cmo script/js.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/parse.d.cmo text/parse.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/print.d.cmo text/print.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I script -I util -I binary -I valid -I syntax -I runtime -I host -I text -I main -I exec -o script/script.d.cmo script/script.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I valid -I util -I binary -I syntax -I runtime -I host -I script -I text -I main -I exec -o valid/valid.d.cmo valid/valid.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I syntax -I util -I binary -I valid -I runtime -I host -I script -I text -I main -I exec -o syntax/operators.d.cmo syntax/operators.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/parser.cmi text/parser.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/lexer.cmi text/lexer.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I util -I valid -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o util/sexpr.cmi util/sexpr.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/arrange.cmi text/arrange.mli +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I binary -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I exec -o binary/decode.d.cmo binary/decode.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I binary -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I exec -o binary/encode.d.cmo binary/encode.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I script -I valid -I util -I text -I syntax -I runtime -I main -I host -I exec -I binary -o script/js.d.cmo script/js.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/parse.d.cmo text/parse.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/print.d.cmo text/print.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I script -I valid -I util -I text -I syntax -I runtime -I main -I host -I exec -I binary -o script/script.d.cmo script/script.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I valid -I util -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o valid/valid.d.cmo valid/valid.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I syntax -I valid -I util -I text -I script -I runtime -I main -I host -I exec -I binary -o syntax/operators.d.cmo syntax/operators.ml ocamllex.opt -q text/lexer.mll -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/lexer.d.cmo text/lexer.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/parser.d.cmo text/parser.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I util -I binary -I valid -I syntax -I runtime -I host -I script -I main -I exec -o text/arrange.d.cmo text/arrange.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I util -I binary -I valid -I syntax -I runtime -I host -I script -I text -I main -I exec -o util/sexpr.d.cmo util/sexpr.ml -ocamlc.opt bigarray.cma -g util/lib.d.cmo binary/utf8.d.cmo exec/float.d.cmo exec/f32.d.cmo exec/f64.d.cmo exec/numeric_error.d.cmo exec/int.d.cmo exec/i32.d.cmo exec/i64.d.cmo exec/i32_convert.d.cmo exec/f32_convert.d.cmo exec/i64_convert.d.cmo exec/f64_convert.d.cmo syntax/types.d.cmo syntax/values.d.cmo runtime/memory.d.cmo util/source.d.cmo syntax/ast.d.cmo exec/eval_numeric.d.cmo runtime/func.d.cmo runtime/global.d.cmo runtime/table.d.cmo runtime/instance.d.cmo util/error.d.cmo exec/eval.d.cmo host/env.d.cmo host/spectest.d.cmo main/flags.d.cmo script/import.d.cmo binary/encode.d.cmo syntax/operators.d.cmo binary/decode.d.cmo script/script.d.cmo text/parser.d.cmo text/lexer.d.cmo text/parse.d.cmo script/js.d.cmo util/sexpr.d.cmo text/arrange.d.cmo text/print.d.cmo valid/valid.d.cmo script/run.d.cmo main/main.d.cmo -o main/main.d.byte +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/lexer.d.cmo text/lexer.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/parser.d.cmo text/parser.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I text -I valid -I util -I syntax -I script -I runtime -I main -I host -I exec -I binary -o text/arrange.d.cmo text/arrange.ml +ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -I util -I valid -I text -I syntax -I script -I runtime -I main -I host -I exec -I binary -o util/sexpr.d.cmo util/sexpr.ml +ocamlc.opt bigarray.cma -g util/lib.d.cmo binary/utf8.d.cmo exec/float.d.cmo exec/f32.d.cmo exec/f64.d.cmo exec/numeric_error.d.cmo exec/int.d.cmo exec/i32.d.cmo exec/i64.d.cmo exec/i32_convert.d.cmo exec/f32_convert.d.cmo exec/i64_convert.d.cmo exec/f64_convert.d.cmo syntax/types.d.cmo syntax/values.d.cmo runtime/mem.d.cmo util/source.d.cmo syntax/ast.d.cmo exec/eval_numeric.d.cmo runtime/func.d.cmo runtime/global.d.cmo runtime/table.d.cmo runtime/instance.d.cmo util/error.d.cmo exec/eval.d.cmo host/env.d.cmo host/spectest.d.cmo main/flags.d.cmo script/import.d.cmo binary/encode.d.cmo syntax/operators.d.cmo binary/decode.d.cmo script/script.d.cmo text/parser.d.cmo text/lexer.d.cmo text/parse.d.cmo script/js.d.cmo util/sexpr.d.cmo text/arrange.d.cmo text/print.d.cmo valid/valid.d.cmo script/run.d.cmo main/main.d.cmo -o main/main.d.byte diff --git a/test/Todo.md b/test/Todo.md index b98f989ec4..ce0adcebae 100644 --- a/test/Todo.md +++ b/test/Todo.md @@ -4,11 +4,11 @@ have a link to an open issue/PR, or be obvious. Comments/corrections/additions welcome. Linear memory semantics: - - test that newly allocated memory (program start and `grow_memory`) is zeroed - - test that `grow_memory` does a full 32-bit unsigned check for page-size divisibility + - test that newly allocated memory (program start and `mem.grow`) is zeroed + - test that `mem.grow` does a full 32-bit unsigned check for page-size divisibility - test that load/store addreses are full int32 (or int64), and not OCaml int - test that when allocating 4GiB, accessing index -1 fails - - test that too-big `grow_memory` fails appropriately + - test that too-big `mem.grow` fails appropriately - test that too-big linear memory initial allocation fails - test that one can clobber the entire contents of the linear memory without corrupting: call stack, local variables, program execution. - test that an i64 store with 4-byte alignment that's 4 bytes out of bounds traps without storing anything. diff --git a/test/core/address.wast b/test/core/address.wast index ee2a6bb391..086e23d0ed 100644 --- a/test/core/address.wast +++ b/test/core/address.wast @@ -1,5 +1,5 @@ (module - (memory 1) + (mem 1) (data (i32.const 0) "abcdefghijklmnopqrstuvwxyz") (func (export "good1") (param $i i32) (result i32) @@ -96,7 +96,7 @@ (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (drop (i32.load offset=4294967296 (i32.const 0))))" ) "i32 constant" diff --git a/test/core/align.wast b/test/core/align.wast index 133b501d7a..a24a50472f 100644 --- a/test/core/align.wast +++ b/test/core/align.wast @@ -1,33 +1,33 @@ (assert_malformed (module quote - "(module (memory 0) (func (drop (i64.load align=0 (i32.const 0)))))" + "(module (mem 0) (func (drop (i64.load align=0 (i32.const 0)))))" ) "alignment" ) (assert_malformed (module quote - "(module (memory 0) (func (drop (i64.load align=7 (i32.const 0)))))" + "(module (mem 0) (func (drop (i64.load align=7 (i32.const 0)))))" ) "alignment" ) (assert_invalid - (module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) + (module (mem 0) (func (drop (i64.load align=16 (i32.const 0))))) "alignment" ) (assert_malformed (module quote - "(module (memory 0) (func (i64.store align=0 (i32.const 0) (i64.const 0))))" + "(module (mem 0) (func (i64.store align=0 (i32.const 0) (i64.const 0))))" ) "alignment" ) (assert_malformed (module quote - "(module (memory 0) (func (i64.store align=5 (i32.const 0) (i64.const 0))))" + "(module (mem 0) (func (i64.store align=5 (i32.const 0) (i64.const 0))))" ) "alignment" ) (assert_invalid - (module (memory 0) (func (i64.store align=16 (i32.const 0) (i64.const 0)))) + (module (mem 0) (func (i64.store align=16 (i32.const 0) (i64.const 0)))) "alignment" ) diff --git a/test/core/br.wast b/test/core/br.wast index 5e99209c78..204e0d805e 100644 --- a/test/core/br.wast +++ b/test/core/br.wast @@ -182,7 +182,7 @@ (block (result i32) (set_local 0 (br 0 (i32.const 17))) (i32.const -1)) ) - (memory 1) + (mem 1) (func (export "as-load-address") (result f32) (block (result f32) (f32.load (br 0 (f32.const 1.7)))) ) @@ -238,8 +238,8 @@ (block (result i32) (i32.wrap/i64 (br 0 (i32.const 41)))) ) - (func (export "as-grow_memory-size") (result i32) - (block (result i32) (grow_memory (br 0 (i32.const 40)))) + (func (export "as-mem.grow-size") (result i32) + (block (result i32) (mem.grow (br 0 (i32.const 40)))) ) (func (export "nested-block-value") (result i32) @@ -398,7 +398,7 @@ (assert_return (invoke "as-convert-operand") (i32.const 41)) -(assert_return (invoke "as-grow_memory-size") (i32.const 40)) +(assert_return (invoke "as-mem.grow-size") (i32.const 40)) (assert_return (invoke "nested-block-value") (i32.const 9)) (assert_return (invoke "nested-br-value") (i32.const 9)) diff --git a/test/core/br_table.wast b/test/core/br_table.wast index 9860892392..a226be6e7e 100644 --- a/test/core/br_table.wast +++ b/test/core/br_table.wast @@ -1028,7 +1028,7 @@ ) ) - (memory 1) + (mem 1) (func (export "as-load-address") (result f32) (block (result f32) (f32.load (br_table 0 (f32.const 1.7) (i32.const 1)))) ) @@ -1098,8 +1098,8 @@ ) ) - (func (export "as-grow_memory-size") (result i32) - (block (result i32) (grow_memory (br_table 0 (i32.const 40) (i32.const 0)))) + (func (export "as-mem.grow-size") (result i32) + (block (result i32) (mem.grow (br_table 0 (i32.const 40) (i32.const 0)))) ) (func (export "nested-block-value") (param i32) (result i32) @@ -1363,7 +1363,7 @@ (assert_return (invoke "as-convert-operand") (i32.const 41)) -(assert_return (invoke "as-grow_memory-size") (i32.const 40)) +(assert_return (invoke "as-mem.grow-size") (i32.const 40)) (assert_return (invoke "nested-block-value" (i32.const 0)) (i32.const 19)) (assert_return (invoke "nested-block-value" (i32.const 1)) (i32.const 17)) diff --git a/test/core/endianness.wast b/test/core/endianness.wast index 8dc0c2e2eb..47fd81d980 100644 --- a/test/core/endianness.wast +++ b/test/core/endianness.wast @@ -1,5 +1,5 @@ (module - (memory 1) + (mem 1) ;; Stores an i16 value in little-endian-format (func $i16_store_little (param $address i32) (param $value i32) diff --git a/test/core/exports.wast b/test/core/exports.wast index 6841aa873e..4f401f7596 100644 --- a/test/core/exports.wast +++ b/test/core/exports.wast @@ -46,7 +46,7 @@ "duplicate export name" ) (assert_invalid - (module (func) (memory 0) (export "a" (func 0)) (export "a" (memory 0))) + (module (func) (mem 0) (export "a" (func 0)) (export "a" (mem 0))) "duplicate export name" ) @@ -95,7 +95,7 @@ "duplicate export name" ) (assert_invalid - (module (global i32 (i32.const 0)) (memory 0) (export "a" (global 0)) (export "a" (memory 0))) + (module (global i32 (i32.const 0)) (mem 0) (export "a" (global 0)) (export "a" (mem 0))) "duplicate export name" ) @@ -144,55 +144,55 @@ "duplicate export name" ) (assert_invalid - (module (table 0 anyfunc) (memory 0) (export "a" (table 0)) (export "a" (memory 0))) + (module (table 0 anyfunc) (mem 0) (export "a" (table 0)) (export "a" (mem 0))) "duplicate export name" ) ;; Memories -(module (memory 0) (export "a" (memory 0))) -(module (memory 0) (export "a" (memory 0)) (export "b" (memory 0))) +(module (mem 0) (export "a" (mem 0))) +(module (mem 0) (export "a" (mem 0)) (export "b" (mem 0))) ;; No multiple memories yet. -;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "b" (memory 1))) - -(module (memory (export "a") 0)) -(module (memory (export "a") 0 1)) -(module (memory 0) (export "a" (memory 0))) -(module (memory 0 1) (export "a" (memory 0))) -(module (memory $a (export "a") 0)) -(module (memory $a (export "a") 0 1)) -(module (memory $a 0) (export "a" (memory $a))) -(module (memory $a 0 1) (export "a" (memory $a))) -(module (export "a" (memory 0)) (memory 0)) -(module (export "a" (memory 0)) (memory 0 1)) -(module (export "a" (memory $a)) (memory $a 0)) -(module (export "a" (memory $a)) (memory $a 0 1)) +;; (module (mem 0) (mem 0) (export "a" (mem 0)) (export "b" (mem 1))) + +(module (mem (export "a") 0)) +(module (mem (export "a") 0 1)) +(module (mem 0) (export "a" (mem 0))) +(module (mem 0 1) (export "a" (mem 0))) +(module (mem $a (export "a") 0)) +(module (mem $a (export "a") 0 1)) +(module (mem $a 0) (export "a" (mem $a))) +(module (mem $a 0 1) (export "a" (mem $a))) +(module (export "a" (mem 0)) (mem 0)) +(module (export "a" (mem 0)) (mem 0 1)) +(module (export "a" (mem $a)) (mem $a 0)) +(module (export "a" (mem $a)) (mem $a 0 1)) (; TODO: access memory ;) (assert_invalid - (module (memory 0) (export "a" (memory 1))) + (module (mem 0) (export "a" (mem 1))) "unknown memory" ) (assert_invalid - (module (memory 0) (export "a" (memory 0)) (export "a" (memory 0))) + (module (mem 0) (export "a" (mem 0)) (export "a" (mem 0))) "duplicate export name" ) ;; No multiple memories yet. ;; (assert_invalid -;; (module (memory 0) (memory 0) (export "a" (memory 0)) (export "a" (memory 1))) +;; (module (mem 0) (mem 0) (export "a" (mem 0)) (export "a" (mem 1))) ;; "duplicate export name" ;; ) (assert_invalid - (module (memory 0) (func) (export "a" (memory 0)) (export "a" (func 0))) + (module (mem 0) (func) (export "a" (mem 0)) (export "a" (func 0))) "duplicate export name" ) (assert_invalid - (module (memory 0) (global i32 (i32.const 0)) (export "a" (memory 0)) (export "a" (global 0))) + (module (mem 0) (global i32 (i32.const 0)) (export "a" (mem 0)) (export "a" (global 0))) "duplicate export name" ) (assert_invalid - (module (memory 0) (table 0 anyfunc) (export "a" (memory 0)) (export "a" (table 0))) + (module (mem 0) (table 0 anyfunc) (export "a" (mem 0)) (export "a" (table 0))) "duplicate export name" ) diff --git a/test/core/float_exprs.wast b/test/core/float_exprs.wast index 5cee2d46cd..e62f2fc03e 100644 --- a/test/core/float_exprs.wast +++ b/test/core/float_exprs.wast @@ -761,7 +761,7 @@ ;; the reciprocal computation could be hoisted. (module - (memory 1 1) + (mem 1 1) (func (export "init") (param $i i32) (param $x f32) (f32.store (get_local $i) (get_local $x))) (func (export "run") (param $n i32) (param $z f32) @@ -796,7 +796,7 @@ (assert_return (invoke "check" (i32.const 12)) (f32.const 0x1.488888p+2)) (module - (memory 1 1) + (mem 1 1) (func (export "init") (param $i i32) (param $x f64) (f64.store (get_local $i) (get_local $x))) (func (export "run") (param $n i32) (param $z f64) @@ -1356,7 +1356,7 @@ ;; optimize using SIMD instructions. (module - (memory (data + (mem (data "\01\00\00\00\01\00\00\80\01\00\00\00\01\00\00\80" "\01\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00" "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" @@ -1395,7 +1395,7 @@ (assert_return (invoke "f32.load" (i32.const 44)) (f32.const -0x1p-149)) (module - (memory (data + (mem (data "\01\00\00\00\00\00\00\00\01\00\00\00\00\00\00\80\01\00\00\00\00\00\00\00\01\00\00\00\00\00\00\80" "\01\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00" @@ -1437,7 +1437,7 @@ ;; isn't optimized into plain summation. (module - (memory (data + (mem (data "\c4\c5\57\24\a5\84\c8\0b\6d\b8\4b\2e\f2\76\17\1c\ca\4a\56\1e\1b\6e\71\22" "\5d\17\1e\6e\bf\cd\14\5c\c7\21\55\51\39\9c\1f\b2\51\f0\a3\93\d7\c1\2c\ae" "\7e\a8\28\3a\01\21\f4\0a\58\93\f8\42\77\9f\83\39\6a\5f\ba\f7\0a\d8\51\6a" @@ -1531,7 +1531,7 @@ (assert_return (invoke "f32.plain_sum" (i32.const 0) (i32.const 256)) (f32.const -0x1.a0343ap+103)) (module - (memory (data "\13\05\84\42\5d\a2\2c\c6\43\db\55\a9\cd\da\55\e3\73\fc\58\d6\ba\d5\00\fd\83\35\42\88\8b\13\5d\38\4a\47\0d\72\73\a1\1a\ef\c4\45\17\57\d8\c9\46\e0\8d\6c\e1\37\70\c8\83\5b\55\5e\5a\2d\73\1e\56\c8\e1\6d\69\14\78\0a\8a\5a\64\3a\09\c7\a8\87\c5\f0\d3\5d\e6\03\fc\93\be\26\ca\d6\a9\91\60\bd\b0\ed\ae\f7\30\7e\92\3a\6f\a7\59\8e\aa\7d\bf\67\58\2a\54\f8\4e\fe\ed\35\58\a6\51\bf\42\e5\4b\66\27\24\6d\7f\42\2d\28\92\18\ec\08\ae\e7\55\da\b1\a6\65\a5\72\50\47\1b\b8\a9\54\d7\a6\06\5b\0f\42\58\83\8a\17\82\c6\10\43\a0\c0\2e\6d\bc\5a\85\53\72\7f\ad\44\bc\30\3c\55\b2\24\9a\74\3a\9e\e1\d8\0f\70\fc\a9\3a\cd\93\4b\ec\e3\7e\dd\5d\27\cd\f8\a0\9d\1c\11\c0\57\2e\fd\c8\13\32\cc\3a\1a\7d\a3\41\55\ed\c3\82\49\2a\04\1e\ef\73\b9\2e\2e\e3\5f\f4\df\e6\b2\33\0c\39\3f\6f\44\6a\03\c1\42\b9\fa\b1\c8\ed\a5\58\99\7f\ed\b4\72\9e\79\eb\fb\43\82\45\aa\bb\95\d2\ff\28\9e\f6\a1\ad\95\d6\55\95\0d\6f\60\11\c7\78\3e\49\f2\7e\48\f4\a2\71\d0\13\8e\b3\de\99\52\e3\45\74\ea\76\0e\1b\2a\c8\ee\14\01\c4\50\5b\36\3c\ef\ba\72\a2\a6\08\f8\7b\36\9d\f9\ef\0b\c7\56\2d\5c\f0\9d\5d\de\fc\b8\ad\0f\64\0e\97\15\32\26\c2\31\e6\05\1e\ef\cb\17\1b\6d\15\0b\74\5d\d3\2e\f8\6b\86\b4\ba\73\52\53\99\a9\76\20\45\c9\40\80\6b\14\ed\a1\fa\80\46\e6\26\d2\e6\98\c4\57\bf\c4\1c\a4\90\7a\36\94\14\ba\15\89\6e\e6\9c\37\8c\f4\de\12\22\5d\a1\79\50\67\0d\3d\7a\e9\d4\aa\2e\7f\2a\7a\30\3d\ea\5d\12\48\fe\e1\18\cd\a4\57\a2\87\3e\b6\9a\8b\db\da\9d\78\9c\cf\8d\b1\4f\90\b4\34\e0\9d\f6\ca\fe\4c\3b\78\6d\0a\5c\18\9f\61\b9\dd\b4\e0\0f\76\e0\1b\69\0d\5e\58\73\70\5e\0e\2d\a1\7d\ff\20\eb\91\34\92\ac\38\72\2a\1f\8e\71\2e\6a\f1\af\c7\27\70\d9\c4\57\f7\d2\3c\1d\b8\f0\f0\64\cf\dc\ae\be\a3\cc\3e\22\7d\4e\69\21\63\17\ed\03\02\54\9a\0f\50\4e\13\5a\35\a1\22\a4\df\86\c2\74\79\16\b8\69\69\a0\52\5d\11\64\bd\5b\93\fc\69\a0\f4\13\d0\81\51\dd\fa\0c\15\c3\7a\c9\62\7a\a9\1d\c9\e6\5a\b3\5b\97\02\3c\64\22\12\3c\22\90\64\2d\30\54\4c\b4\a1\22\09\57\22\5e\8e\38\2b\02\a8\ae\f6\be\0d\2b\f2\03\ad\fa\10\01\71\77\2a\30\02\95\f6\00\3e\d0\c4\8d\34\19\50\21\0a\bc\50\da\3c\30\d6\3a\31\94\8d\3a\fe\ef\14\57\9d\4b\93\00\96\24\0c\6f\fd\bc\23\76\02\6c\eb\52\72\80\11\7e\80\3a\13\12\38\1d\38\49\95\40\27\8a\44\7b\e8\dc\6d\8c\8c\8e\3c\b5\b3\18\0e\f6\08\1a\84\41\35\ff\8b\b8\93\40\ea\e1\51\1d\89\a5\8d\42\68\29\ea\2f\c1\7a\52\eb\90\5d\4d\d6\80\e3\d7\75\48\ce\ed\d3\01\1c\8d\5b\a5\94\0d\78\cf\f1\06\13\2f\98\02\a4\6d\2e\6c\f2\d5\74\29\89\4c\f9\03\f5\c7\18\ad\7a\f0\68\f8\5c\d6\59\87\6e\d6\3f\06\be\86\20\e3\41\91\22\f3\6e\8b\f0\68\1c\57\a7\fc\b0\7c\9e\99\0b\96\1a\89\5f\e6\0d\7c\08\51\a0\a2\67\9a\47\00\93\6b\f9\28\f0\68\db\62\f1\e0\65\2c\53\33\e0\a7\ca\11\42\30\f6\af\01\c1\65\3d\32\01\6f\ab\2e\be\d3\8b\be\14\c3\ff\ec\fb\f0\f9\c5\0c\05\6f\01\09\6b\e3\34\31\0c\1f\66\a6\42\bc\1a\87\49\16\16\8c\b0\90\0d\34\8c\0a\e1\09\5e\10\a4\6b\56\cc\f0\c9\bb\dc\b8\5c\ce\f6\cc\8d\75\7e\b3\07\88\04\2f\b4\5e\c9\e3\4a\23\73\19\62\6c\9a\03\76\44\86\9c\60\fc\db\72\8f\27\a0\dd\b3\c5\da\ff\f9\ec\6a\b1\7b\d3\cf\50\37\c9\7a\78\0c\e4\3a\b6\f5\e6\f4\98\6e\42\7d\35\73\8b\45\c0\56\97\cd\6d\ce\cf\ad\31\b3\c3\54\fa\ef\d5\c0\f4\6a\5f\54\e7\49\3e\33\0a\30\38\fd\d9\05\ff\a5\3f\57\46\14\b5\91\17\ca\6b\98\23\7a\65\b3\6c\02\b4\cc\79\5d\58\d8\b3\d5\94\ae\f4\6d\75\65\f7\92\bf\7e\47\4c\3c\ee\db\ac\f1\32\5d\fb\6f\41\1c\34\c8\83\4f\c2\58\01\be\05\3e\66\16\a6\04\6d\5d\4f\86\09\27\82\25\12\cd\3a\cd\ce\6b\bc\ca\ac\28\9b\ee\6a\25\86\9e\45\70\c6\d2\bd\3b\7d\42\e5\27\af\c7\1d\f4\81\c8\b3\76\8a\a8\36\a3\ae\2a\e6\18\e1\36\22\ad\f6\25\72\b0\39\8b\01\9a\22\7b\84\c3\2d\5f\72\a4\98\ac\15\70\e7\d4\18\e2\7d\d2\30\7c\33\08\cd\ca\c4\22\85\88\75\81\c6\4a\74\58\8d\e0\e8\ac\c5\ab\75\5a\f4\28\12\f0\18\45\52\f2\97\b2\93\41\6f\8d\7f\db\70\fb\a3\5d\1f\a7\8d\98\20\2b\22\9f\3a\01\b5\8b\1b\d2\cb\14\03\0e\14\14\d2\19\5a\1f\ce\5e\cd\81\79\15\01\ca\de\73\74\8c\56\20\9f\77\2d\25\16\f6\61\51\1d\a4\8e\9b\98\a5\c6\ec\a8\45\57\82\59\78\0d\90\b4\df\51\b0\c3\82\94\cc\b3\53\09\15\6d\96\6c\3a\40\47\b7\4a\7a\05\2f\a1\1e\8c\9d\a0\20\88\fb\52\b7\9f\f3\f3\bb\5f\e7\8a\61\a7\21\b1\ac\fa\09\aa\a4\6c\bc\24\80\ba\2a\e9\65\ff\70\ff\cc\fa\65\87\76\f3\c5\15\ce\cb\e8\42\31\00\0c\91\57\d9\e0\9d\35\54\24\ad\a4\d8\f9\08\67\63\c8\cf\81\dd\90\a2\d7\c4\07\4a\e6\10\6f\67\e7\27\d4\23\59\18\f2\a8\9d\5f\d8\94\30\aa\54\86\4f\87\9d\82\b5\26\ca\a6\96\bf\cf\55\f9\9d\37\01\19\48\43\c5\94\6c\f3\74\97\58\4c\3c\9d\08\e8\04\c2\58\30\76\e1\a0\f8\ea\e9\c5\ae\cf\78\9e\a9\0c\ac\b3\44\42\e0\bc\5d\1b\9c\49\58\4a\1c\19\49\c1\3a\ea\f5\eb\3b\81\a9\4b\70\0c\cc\9e\1a\d3\2f\b7\52\2f\20\3b\eb\64\51\1d\a0\2d\b2\3e\be\13\85\48\92\32\2e\db\5c\a1\e7\8c\45\91\35\01\0a\93\c2\eb\09\ce\f3\d2\22\24\d0\8c\cc\1d\9d\38\c8\4d\e3\82\cc\64\15\06\2d\e7\01\2f\ab\bb\b5\04\4c\92\1c\7a\d6\3f\e8\5f\31\15\0c\dc\e4\31\b4\c4\25\3e\2a\aa\00\9e\c8\e5\21\7a\7f\29\f1\c0\af\1d\5e\e8\63\39\ad\f8\7e\6c\c8\c5\7f\c2\a8\97\27\0a\d9\f4\21\6a\ea\03\09\fb\f7\96\3b\83\79\5f\7c\4b\30\9f\56\35\de\b4\73\d4\95\f0\14\c3\74\2f\0d\a3\1d\4e\8d\31\24\b3\1a\84\85\62\5a\7b\3c\14\39\17\e6\6d\eb\37\c2\00\58\5b\0b\e3\3c\8a\62\e1\f8\35\4b\56\e2\87\60\8b\be\a7\38\91\77\54\a9\5a\24\25\90\9f\a5\42\77\f3\5c\39\df\ff\74\07\76\a1\cd\1f\62\0b\81\81\68\af\05\c1\c0\7f\26\ee\c0\91\a3\6a\7d\29\61\45\27\e5\57\88\dc\0d\97\04\1a\33\a9\44\8a\da\02\10\45\3f\8e\55\a6\76\8c\4d\e3\f1\89\83\c8\d0\f8\9b\50\77\9f\47\df\4c\9c\66\0d\aa\18\b8\5f\4f\c4\01\ce\dc\84\ac\46\9e\69\e1\76\45\6b\61\89\e4\5d\94\bb\11\83\9f\78\d8\0a\d2\f5\7e\5d\43\ea\bc\10\f1\3a\c9\e2\64\fb\53\65\d0\c7\b4\a7\fb\d4\05\53\25\d0\cd\29\88\00\56\25\24\7d\5d\b4\f3\41\9f\e9\b5\f7\ae\64\2c\e3\c9\6d\d5\84\3a\72\12\b8\7a\d9\1b\09\e8\38\da\26\4f\04\ce\03\71\6e\8a\44\7b\5c\81\59\9c\d2\e4\c3\ba\59\a6\e5\28\a7\8f\9a\e4\d5\4e\b9\ca\7f\cb\75\b8\2b\43\3e\b3\15\46\b1\a5\bc\9d\9e\38\15\f1\bd\1b\21\aa\f1\82\00\95\fc\a7\77\47\39\a7\33\43\92\d7\52\40\4b\06\81\8a\a0\bd\f1\6b\99\84\42\5b\e2\3b\c5\5e\12\5c\28\4d\b6\0e\4e\c8\5c\e8\01\8a\c5\e7\e4\9d\42\ee\5d\9c\c4\eb\eb\68\09\27\92\95\9a\11\54\73\c4\12\80\fb\7d\fe\c5\08\60\7f\36\41\e0\10\ba\d6\2b\6c\f1\b4\17\fe\26\34\e3\4b\f8\a8\e3\91\be\4f\2a\fc\da\81\b8\e7\fe\d5\26\50\47\f3\1a\65\32\81\e0\05\b8\4f\32\31\26\00\4a\53\97\c2\c3\0e\2e\a1\26\54\ab\05\8e\56\2f\7d\af\22\84\68\a5\8b\97\f6\a4\fd\a8\cc\75\41\96\86\fd\27\3d\29\86\8d\7f\4c\d4\8e\73\41\f4\1e\e2\dd\58\27\97\ce\9c\94\cf\7a\04\2f\dc\ed" + (mem (data "\13\05\84\42\5d\a2\2c\c6\43\db\55\a9\cd\da\55\e3\73\fc\58\d6\ba\d5\00\fd\83\35\42\88\8b\13\5d\38\4a\47\0d\72\73\a1\1a\ef\c4\45\17\57\d8\c9\46\e0\8d\6c\e1\37\70\c8\83\5b\55\5e\5a\2d\73\1e\56\c8\e1\6d\69\14\78\0a\8a\5a\64\3a\09\c7\a8\87\c5\f0\d3\5d\e6\03\fc\93\be\26\ca\d6\a9\91\60\bd\b0\ed\ae\f7\30\7e\92\3a\6f\a7\59\8e\aa\7d\bf\67\58\2a\54\f8\4e\fe\ed\35\58\a6\51\bf\42\e5\4b\66\27\24\6d\7f\42\2d\28\92\18\ec\08\ae\e7\55\da\b1\a6\65\a5\72\50\47\1b\b8\a9\54\d7\a6\06\5b\0f\42\58\83\8a\17\82\c6\10\43\a0\c0\2e\6d\bc\5a\85\53\72\7f\ad\44\bc\30\3c\55\b2\24\9a\74\3a\9e\e1\d8\0f\70\fc\a9\3a\cd\93\4b\ec\e3\7e\dd\5d\27\cd\f8\a0\9d\1c\11\c0\57\2e\fd\c8\13\32\cc\3a\1a\7d\a3\41\55\ed\c3\82\49\2a\04\1e\ef\73\b9\2e\2e\e3\5f\f4\df\e6\b2\33\0c\39\3f\6f\44\6a\03\c1\42\b9\fa\b1\c8\ed\a5\58\99\7f\ed\b4\72\9e\79\eb\fb\43\82\45\aa\bb\95\d2\ff\28\9e\f6\a1\ad\95\d6\55\95\0d\6f\60\11\c7\78\3e\49\f2\7e\48\f4\a2\71\d0\13\8e\b3\de\99\52\e3\45\74\ea\76\0e\1b\2a\c8\ee\14\01\c4\50\5b\36\3c\ef\ba\72\a2\a6\08\f8\7b\36\9d\f9\ef\0b\c7\56\2d\5c\f0\9d\5d\de\fc\b8\ad\0f\64\0e\97\15\32\26\c2\31\e6\05\1e\ef\cb\17\1b\6d\15\0b\74\5d\d3\2e\f8\6b\86\b4\ba\73\52\53\99\a9\76\20\45\c9\40\80\6b\14\ed\a1\fa\80\46\e6\26\d2\e6\98\c4\57\bf\c4\1c\a4\90\7a\36\94\14\ba\15\89\6e\e6\9c\37\8c\f4\de\12\22\5d\a1\79\50\67\0d\3d\7a\e9\d4\aa\2e\7f\2a\7a\30\3d\ea\5d\12\48\fe\e1\18\cd\a4\57\a2\87\3e\b6\9a\8b\db\da\9d\78\9c\cf\8d\b1\4f\90\b4\34\e0\9d\f6\ca\fe\4c\3b\78\6d\0a\5c\18\9f\61\b9\dd\b4\e0\0f\76\e0\1b\69\0d\5e\58\73\70\5e\0e\2d\a1\7d\ff\20\eb\91\34\92\ac\38\72\2a\1f\8e\71\2e\6a\f1\af\c7\27\70\d9\c4\57\f7\d2\3c\1d\b8\f0\f0\64\cf\dc\ae\be\a3\cc\3e\22\7d\4e\69\21\63\17\ed\03\02\54\9a\0f\50\4e\13\5a\35\a1\22\a4\df\86\c2\74\79\16\b8\69\69\a0\52\5d\11\64\bd\5b\93\fc\69\a0\f4\13\d0\81\51\dd\fa\0c\15\c3\7a\c9\62\7a\a9\1d\c9\e6\5a\b3\5b\97\02\3c\64\22\12\3c\22\90\64\2d\30\54\4c\b4\a1\22\09\57\22\5e\8e\38\2b\02\a8\ae\f6\be\0d\2b\f2\03\ad\fa\10\01\71\77\2a\30\02\95\f6\00\3e\d0\c4\8d\34\19\50\21\0a\bc\50\da\3c\30\d6\3a\31\94\8d\3a\fe\ef\14\57\9d\4b\93\00\96\24\0c\6f\fd\bc\23\76\02\6c\eb\52\72\80\11\7e\80\3a\13\12\38\1d\38\49\95\40\27\8a\44\7b\e8\dc\6d\8c\8c\8e\3c\b5\b3\18\0e\f6\08\1a\84\41\35\ff\8b\b8\93\40\ea\e1\51\1d\89\a5\8d\42\68\29\ea\2f\c1\7a\52\eb\90\5d\4d\d6\80\e3\d7\75\48\ce\ed\d3\01\1c\8d\5b\a5\94\0d\78\cf\f1\06\13\2f\98\02\a4\6d\2e\6c\f2\d5\74\29\89\4c\f9\03\f5\c7\18\ad\7a\f0\68\f8\5c\d6\59\87\6e\d6\3f\06\be\86\20\e3\41\91\22\f3\6e\8b\f0\68\1c\57\a7\fc\b0\7c\9e\99\0b\96\1a\89\5f\e6\0d\7c\08\51\a0\a2\67\9a\47\00\93\6b\f9\28\f0\68\db\62\f1\e0\65\2c\53\33\e0\a7\ca\11\42\30\f6\af\01\c1\65\3d\32\01\6f\ab\2e\be\d3\8b\be\14\c3\ff\ec\fb\f0\f9\c5\0c\05\6f\01\09\6b\e3\34\31\0c\1f\66\a6\42\bc\1a\87\49\16\16\8c\b0\90\0d\34\8c\0a\e1\09\5e\10\a4\6b\56\cc\f0\c9\bb\dc\b8\5c\ce\f6\cc\8d\75\7e\b3\07\88\04\2f\b4\5e\c9\e3\4a\23\73\19\62\6c\9a\03\76\44\86\9c\60\fc\db\72\8f\27\a0\dd\b3\c5\da\ff\f9\ec\6a\b1\7b\d3\cf\50\37\c9\7a\78\0c\e4\3a\b6\f5\e6\f4\98\6e\42\7d\35\73\8b\45\c0\56\97\cd\6d\ce\cf\ad\31\b3\c3\54\fa\ef\d5\c0\f4\6a\5f\54\e7\49\3e\33\0a\30\38\fd\d9\05\ff\a5\3f\57\46\14\b5\91\17\ca\6b\98\23\7a\65\b3\6c\02\b4\cc\79\5d\58\d8\b3\d5\94\ae\f4\6d\75\65\f7\92\bf\7e\47\4c\3c\ee\db\ac\f1\32\5d\fb\6f\41\1c\34\c8\83\4f\c2\58\01\be\05\3e\66\16\a6\04\6d\5d\4f\86\09\27\82\25\12\cd\3a\cd\ce\6b\bc\ca\ac\28\9b\ee\6a\25\86\9e\45\70\c6\d2\bd\3b\7d\42\e5\27\af\c7\1d\f4\81\c8\b3\76\8a\a8\36\a3\ae\2a\e6\18\e1\36\22\ad\f6\25\72\b0\39\8b\01\9a\22\7b\84\c3\2d\5f\72\a4\98\ac\15\70\e7\d4\18\e2\7d\d2\30\7c\33\08\cd\ca\c4\22\85\88\75\81\c6\4a\74\58\8d\e0\e8\ac\c5\ab\75\5a\f4\28\12\f0\18\45\52\f2\97\b2\93\41\6f\8d\7f\db\70\fb\a3\5d\1f\a7\8d\98\20\2b\22\9f\3a\01\b5\8b\1b\d2\cb\14\03\0e\14\14\d2\19\5a\1f\ce\5e\cd\81\79\15\01\ca\de\73\74\8c\56\20\9f\77\2d\25\16\f6\61\51\1d\a4\8e\9b\98\a5\c6\ec\a8\45\57\82\59\78\0d\90\b4\df\51\b0\c3\82\94\cc\b3\53\09\15\6d\96\6c\3a\40\47\b7\4a\7a\05\2f\a1\1e\8c\9d\a0\20\88\fb\52\b7\9f\f3\f3\bb\5f\e7\8a\61\a7\21\b1\ac\fa\09\aa\a4\6c\bc\24\80\ba\2a\e9\65\ff\70\ff\cc\fa\65\87\76\f3\c5\15\ce\cb\e8\42\31\00\0c\91\57\d9\e0\9d\35\54\24\ad\a4\d8\f9\08\67\63\c8\cf\81\dd\90\a2\d7\c4\07\4a\e6\10\6f\67\e7\27\d4\23\59\18\f2\a8\9d\5f\d8\94\30\aa\54\86\4f\87\9d\82\b5\26\ca\a6\96\bf\cf\55\f9\9d\37\01\19\48\43\c5\94\6c\f3\74\97\58\4c\3c\9d\08\e8\04\c2\58\30\76\e1\a0\f8\ea\e9\c5\ae\cf\78\9e\a9\0c\ac\b3\44\42\e0\bc\5d\1b\9c\49\58\4a\1c\19\49\c1\3a\ea\f5\eb\3b\81\a9\4b\70\0c\cc\9e\1a\d3\2f\b7\52\2f\20\3b\eb\64\51\1d\a0\2d\b2\3e\be\13\85\48\92\32\2e\db\5c\a1\e7\8c\45\91\35\01\0a\93\c2\eb\09\ce\f3\d2\22\24\d0\8c\cc\1d\9d\38\c8\4d\e3\82\cc\64\15\06\2d\e7\01\2f\ab\bb\b5\04\4c\92\1c\7a\d6\3f\e8\5f\31\15\0c\dc\e4\31\b4\c4\25\3e\2a\aa\00\9e\c8\e5\21\7a\7f\29\f1\c0\af\1d\5e\e8\63\39\ad\f8\7e\6c\c8\c5\7f\c2\a8\97\27\0a\d9\f4\21\6a\ea\03\09\fb\f7\96\3b\83\79\5f\7c\4b\30\9f\56\35\de\b4\73\d4\95\f0\14\c3\74\2f\0d\a3\1d\4e\8d\31\24\b3\1a\84\85\62\5a\7b\3c\14\39\17\e6\6d\eb\37\c2\00\58\5b\0b\e3\3c\8a\62\e1\f8\35\4b\56\e2\87\60\8b\be\a7\38\91\77\54\a9\5a\24\25\90\9f\a5\42\77\f3\5c\39\df\ff\74\07\76\a1\cd\1f\62\0b\81\81\68\af\05\c1\c0\7f\26\ee\c0\91\a3\6a\7d\29\61\45\27\e5\57\88\dc\0d\97\04\1a\33\a9\44\8a\da\02\10\45\3f\8e\55\a6\76\8c\4d\e3\f1\89\83\c8\d0\f8\9b\50\77\9f\47\df\4c\9c\66\0d\aa\18\b8\5f\4f\c4\01\ce\dc\84\ac\46\9e\69\e1\76\45\6b\61\89\e4\5d\94\bb\11\83\9f\78\d8\0a\d2\f5\7e\5d\43\ea\bc\10\f1\3a\c9\e2\64\fb\53\65\d0\c7\b4\a7\fb\d4\05\53\25\d0\cd\29\88\00\56\25\24\7d\5d\b4\f3\41\9f\e9\b5\f7\ae\64\2c\e3\c9\6d\d5\84\3a\72\12\b8\7a\d9\1b\09\e8\38\da\26\4f\04\ce\03\71\6e\8a\44\7b\5c\81\59\9c\d2\e4\c3\ba\59\a6\e5\28\a7\8f\9a\e4\d5\4e\b9\ca\7f\cb\75\b8\2b\43\3e\b3\15\46\b1\a5\bc\9d\9e\38\15\f1\bd\1b\21\aa\f1\82\00\95\fc\a7\77\47\39\a7\33\43\92\d7\52\40\4b\06\81\8a\a0\bd\f1\6b\99\84\42\5b\e2\3b\c5\5e\12\5c\28\4d\b6\0e\4e\c8\5c\e8\01\8a\c5\e7\e4\9d\42\ee\5d\9c\c4\eb\eb\68\09\27\92\95\9a\11\54\73\c4\12\80\fb\7d\fe\c5\08\60\7f\36\41\e0\10\ba\d6\2b\6c\f1\b4\17\fe\26\34\e3\4b\f8\a8\e3\91\be\4f\2a\fc\da\81\b8\e7\fe\d5\26\50\47\f3\1a\65\32\81\e0\05\b8\4f\32\31\26\00\4a\53\97\c2\c3\0e\2e\a1\26\54\ab\05\8e\56\2f\7d\af\22\84\68\a5\8b\97\f6\a4\fd\a8\cc\75\41\96\86\fd\27\3d\29\86\8d\7f\4c\d4\8e\73\41\f4\1e\e2\dd\58\27\97\ce\9c\94\cf\7a\04\2f\dc\ed" )) (func (export "f64.kahan_sum") (param $p i32) (param $n i32) (result f64) diff --git a/test/core/float_memory.wast b/test/core/float_memory.wast index 3801158f92..b26c35d07e 100644 --- a/test/core/float_memory.wast +++ b/test/core/float_memory.wast @@ -3,7 +3,7 @@ ;; Test that load and store do not canonicalize NaNs as x87 does. (module - (memory (data "\00\00\a0\7f")) + (mem (data "\00\00\a0\7f")) (func (export "f32.load") (result f32) (f32.load (i32.const 0))) (func (export "i32.load") (result i32) (i32.load (i32.const 0))) @@ -28,7 +28,7 @@ (assert_return (invoke "f32.load") (f32.const nan:0x200000)) (module - (memory (data "\00\00\00\00\00\00\f4\7f")) + (mem (data "\00\00\00\00\00\00\f4\7f")) (func (export "f64.load") (result f64) (f64.load (i32.const 0))) (func (export "i64.load") (result i64) (i64.load (i32.const 0))) @@ -55,7 +55,7 @@ ;; Test that unaligned load and store do not canonicalize NaNs. (module - (memory (data "\00\00\00\a0\7f")) + (mem (data "\00\00\00\a0\7f")) (func (export "f32.load") (result f32) (f32.load (i32.const 1))) (func (export "i32.load") (result i32) (i32.load (i32.const 1))) @@ -80,7 +80,7 @@ (assert_return (invoke "f32.load") (f32.const nan:0x200000)) (module - (memory (data "\00\00\00\00\00\00\00\f4\7f")) + (mem (data "\00\00\00\00\00\00\00\f4\7f")) (func (export "f64.load") (result f64) (f64.load (i32.const 1))) (func (export "i64.load") (result i64) (i64.load (i32.const 1))) @@ -107,7 +107,7 @@ ;; Test that load and store do not canonicalize NaNs as some JS engines do. (module - (memory (data "\01\00\d0\7f")) + (mem (data "\01\00\d0\7f")) (func (export "f32.load") (result f32) (f32.load (i32.const 0))) (func (export "i32.load") (result i32) (i32.load (i32.const 0))) @@ -132,7 +132,7 @@ (assert_return (invoke "f32.load") (f32.const nan:0x500001)) (module - (memory (data "\01\00\00\00\00\00\fc\7f")) + (mem (data "\01\00\00\00\00\00\fc\7f")) (func (export "f64.load") (result f64) (f64.load (i32.const 0))) (func (export "i64.load") (result i64) (i64.load (i32.const 0))) diff --git a/test/core/imports.wast b/test/core/imports.wast index f5a557dbcc..24c099d635 100644 --- a/test/core/imports.wast +++ b/test/core/imports.wast @@ -12,8 +12,8 @@ (global (export "global-f32") f32 (f32.const 44)) (table (export "table-10-inf") 10 anyfunc) ;; (table (export "table-10-20") 10 20 anyfunc) - (memory (export "memory-2-inf") 2) - ;; (memory (export "memory-2-4") 2 4) + (mem (export "memory-2-inf") 2) + ;; (mem (export "memory-2-4") 2 4) ) (register "test") @@ -371,7 +371,7 @@ ;; Memories (module - (import "spectest" "memory" (memory 1 2)) + (import "spectest" "memory" (mem 1 2)) (data 0 (i32.const 10) "\10") (func (export "load") (param i32) (result i32) (i32.load (get_local 0))) @@ -383,7 +383,7 @@ (assert_trap (invoke "load" (i32.const 1000000)) "out of bounds memory access") (module - (memory (import "spectest" "memory") 1 2) + (mem (import "spectest" "memory") 1 2) (data 0 (i32.const 10) "\10") (func (export "load") (param i32) (result i32) (i32.load (get_local 0))) @@ -394,91 +394,91 @@ (assert_trap (invoke "load" (i32.const 1000000)) "out of bounds memory access") (assert_invalid - (module (import "" "" (memory 1)) (import "" "" (memory 1))) + (module (import "" "" (mem 1)) (import "" "" (mem 1))) "multiple memories" ) (assert_invalid - (module (import "" "" (memory 1)) (memory 0)) + (module (import "" "" (mem 1)) (mem 0)) "multiple memories" ) (assert_invalid - (module (memory 0) (memory 0)) + (module (mem 0) (mem 0)) "multiple memories" ) -(module (import "test" "memory-2-inf" (memory 2))) -(module (import "test" "memory-2-inf" (memory 1))) -(module (import "test" "memory-2-inf" (memory 0))) -(module (import "spectest" "memory" (memory 1))) -(module (import "spectest" "memory" (memory 0))) -(module (import "spectest" "memory" (memory 1 2))) -(module (import "spectest" "memory" (memory 0 2))) -(module (import "spectest" "memory" (memory 1 3))) -(module (import "spectest" "memory" (memory 0 3))) +(module (import "test" "memory-2-inf" (mem 2))) +(module (import "test" "memory-2-inf" (mem 1))) +(module (import "test" "memory-2-inf" (mem 0))) +(module (import "spectest" "memory" (mem 1))) +(module (import "spectest" "memory" (mem 0))) +(module (import "spectest" "memory" (mem 1 2))) +(module (import "spectest" "memory" (mem 0 2))) +(module (import "spectest" "memory" (mem 1 3))) +(module (import "spectest" "memory" (mem 0 3))) (assert_unlinkable - (module (import "test" "unknown" (memory 1))) + (module (import "test" "unknown" (mem 1))) "unknown import" ) (assert_unlinkable - (module (import "spectest" "unknown" (memory 1))) + (module (import "spectest" "unknown" (mem 1))) "unknown import" ) (assert_unlinkable - (module (import "test" "memory-2-inf" (memory 3))) + (module (import "test" "memory-2-inf" (mem 3))) "incompatible import type" ) (assert_unlinkable - (module (import "test" "memory-2-inf" (memory 2 3))) + (module (import "test" "memory-2-inf" (mem 2 3))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (memory 2))) + (module (import "spectest" "memory" (mem 2))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (memory 1 1))) + (module (import "spectest" "memory" (mem 1 1))) "incompatible import type" ) (assert_unlinkable - (module (import "test" "func-i32" (memory 1))) + (module (import "test" "func-i32" (mem 1))) "incompatible import type" ) (assert_unlinkable - (module (import "test" "global-i32" (memory 1))) + (module (import "test" "global-i32" (mem 1))) "incompatible import type" ) (assert_unlinkable - (module (import "test" "table-10-inf" (memory 1))) + (module (import "test" "table-10-inf" (mem 1))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "print" (memory 1))) + (module (import "spectest" "print" (mem 1))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "global" (memory 1))) + (module (import "spectest" "global" (mem 1))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "table" (memory 1))) + (module (import "spectest" "table" (mem 1))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (memory 2))) + (module (import "spectest" "memory" (mem 2))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (memory 1 1))) + (module (import "spectest" "memory" (mem 1 1))) "incompatible import type" ) (module - (import "spectest" "memory" (memory 0 3)) ;; actual has max size 2 - (func (export "grow") (param i32) (result i32) (grow_memory (get_local 0))) + (import "spectest" "memory" (mem 0 3)) ;; actual has max size 2 + (func (export "grow") (param i32) (result i32) (mem.grow (get_local 0))) ) (assert_return (invoke "grow" (i32.const 0)) (i32.const 1)) (assert_return (invoke "grow" (i32.const 1)) (i32.const 1)) @@ -502,7 +502,7 @@ "import after function" ) (assert_malformed - (module quote "(func) (import \"\" \"\" (memory 0))") + (module quote "(func) (import \"\" \"\" (mem 0))") "import after function" ) @@ -519,7 +519,7 @@ "import after global" ) (assert_malformed - (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (memory 0))") + (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (mem 0))") "import after global" ) @@ -536,23 +536,23 @@ "import after table" ) (assert_malformed - (module quote "(table 0 anyfunc) (import \"\" \"\" (memory 0))") + (module quote "(table 0 anyfunc) (import \"\" \"\" (mem 0))") "import after table" ) (assert_malformed - (module quote "(memory 0) (import \"\" \"\" (func))") + (module quote "(mem 0) (import \"\" \"\" (func))") "import after memory" ) (assert_malformed - (module quote "(memory 0) (import \"\" \"\" (global i32))") + (module quote "(mem 0) (import \"\" \"\" (global i32))") "import after memory" ) (assert_malformed - (module quote "(memory 0) (import \"\" \"\" (table 1 3 anyfunc))") + (module quote "(mem 0) (import \"\" \"\" (table 1 3 anyfunc))") "import after memory" ) (assert_malformed - (module quote "(memory 0) (import \"\" \"\" (memory 1 2))") + (module quote "(mem 0) (import \"\" \"\" (mem 1 2))") "import after memory" ) diff --git a/test/core/inline-module.wast b/test/core/inline-module.wast index dc7ead7767..a70044c7bd 100644 --- a/test/core/inline-module.wast +++ b/test/core/inline-module.wast @@ -1 +1 @@ -(func) (memory 0) (func (export "f")) +(func) (mem 0) (func (export "f")) diff --git a/test/core/left-to-right.wast b/test/core/left-to-right.wast index 65d3809ac2..2336028b48 100644 --- a/test/core/left-to-right.wast +++ b/test/core/left-to-right.wast @@ -1,5 +1,5 @@ (module - (memory 1) + (mem 1) (type $i32_T (func (param i32 i32) (result i32))) (type $i64_T (func (param i64 i64) (result i32))) diff --git a/test/core/linking.wast b/test/core/linking.wast index 73fbb93ba1..86a5fea444 100644 --- a/test/core/linking.wast +++ b/test/core/linking.wast @@ -182,7 +182,7 @@ (assert_unlinkable (module (table (import "Mt" "tab") 10 anyfunc) - (memory (import "Mt" "mem") 1) ;; does not exist + (mem (import "Mt" "mem") 1) ;; does not exist (func $f (result i32) (i32.const 0)) (elem (i32.const 7) $f) (elem (i32.const 9) $f) @@ -207,7 +207,7 @@ (table (import "Mt" "tab") 10 anyfunc) (func $f (result i32) (i32.const 0)) (elem (i32.const 7) $f) - (memory 1) + (mem 1) (data (i32.const 0x10000) "d") ;; out of bounds ) "data segment does not fit" @@ -218,7 +218,7 @@ ;; Memories (module $Mm - (memory (export "mem") 1 5) + (mem (export "mem") 1 5) (data (i32.const 10) "\00\01\02\03\04\05\06\07\08\09") (func (export "load") (param $a i32) (result i32) @@ -230,7 +230,7 @@ (module $Nm (func $loadM (import "Mm" "load") (param i32) (result i32)) - (memory 1) + (mem 1) (data (i32.const 10) "\f0\f1\f2\f3\f4\f5") (export "Mm.load" (func $loadM)) @@ -244,7 +244,7 @@ (assert_return (invoke $Nm "load" (i32.const 12)) (i32.const 0xf2)) (module $Om - (memory (import "Mm" "mem") 1) + (mem (import "Mm" "mem") 1) (data (i32.const 5) "\a0\a1\a2\a3\a4\a5\a6\a7") (func (export "load") (param $a i32) (result i32) @@ -258,23 +258,23 @@ (assert_return (invoke $Om "load" (i32.const 12)) (i32.const 0xa7)) (module - (memory (import "Mm" "mem") 0) + (mem (import "Mm" "mem") 0) (data (i32.const 0xffff) "a") ) (assert_unlinkable (module - (memory (import "Mm" "mem") 0) + (mem (import "Mm" "mem") 0) (data (i32.const 0x10000) "a") ) "data segment does not fit" ) (module $Pm - (memory (import "Mm" "mem") 1 8) + (mem (import "Mm" "mem") 1 8) (func (export "grow") (param $a i32) (result i32) - (grow_memory (get_local 0)) + (mem.grow (get_local 0)) ) ) @@ -290,7 +290,7 @@ (assert_unlinkable (module (func $host (import "spectest" "print")) - (memory (import "Mm" "mem") 1) + (mem (import "Mm" "mem") 1) (table (import "Mm" "tab") 0 anyfunc) ;; does not exist (data (i32.const 0) "abc") ) @@ -300,7 +300,7 @@ (assert_unlinkable (module - (memory (import "Mm" "mem") 1) + (mem (import "Mm" "mem") 1) (data (i32.const 0) "abc") (data (i32.const 0x50000) "d") ;; out of bounds ) @@ -310,7 +310,7 @@ (assert_unlinkable (module - (memory (import "Mm" "mem") 1) + (mem (import "Mm" "mem") 1) (data (i32.const 0) "abc") (table 0 anyfunc) (func) diff --git a/test/core/memory.wast b/test/core/memory.wast index b49ac4b2be..7f6c79401c 100644 --- a/test/core/memory.wast +++ b/test/core/memory.wast @@ -1,29 +1,29 @@ ;; Test memory section structure -(module (memory 0 0)) -(module (memory 0 1)) -(module (memory 1 256)) -(module (memory 0 65536)) -(module (memory 0 0) (data (i32.const 0))) -(module (memory 0 0) (data (i32.const 0) "")) -(module (memory 1 1) (data (i32.const 0) "a")) -(module (memory 1 2) (data (i32.const 0) "a") (data (i32.const 65535) "b")) -(module (memory 1 2) +(module (mem 0 0)) +(module (mem 0 1)) +(module (mem 1 256)) +(module (mem 0 65536)) +(module (mem 0 0) (data (i32.const 0))) +(module (mem 0 0) (data (i32.const 0) "")) +(module (mem 1 1) (data (i32.const 0) "a")) +(module (mem 1 2) (data (i32.const 0) "a") (data (i32.const 65535) "b")) +(module (mem 1 2) (data (i32.const 0) "a") (data (i32.const 1) "b") (data (i32.const 2) "c") ) -(module (global (import "spectest" "global") i32) (memory 1) (data (get_global 0) "a")) -(module (global $g (import "spectest" "global") i32) (memory 1) (data (get_global $g) "a")) +(module (global (import "spectest" "global") i32) (mem 1) (data (get_global 0) "a")) +(module (global $g (import "spectest" "global") i32) (mem 1) (data (get_global $g) "a")) ;; Use of internal globals in constant expressions is not allowed in MVP. -;; (module (memory 1) (data (get_global 0) "a") (global i32 (i32.const 0))) -;; (module (memory 1) (data (get_global $g) "a") (global $g i32 (i32.const 0))) +;; (module (mem 1) (data (get_global 0) "a") (global i32 (i32.const 0))) +;; (module (mem 1) (data (get_global $g) "a") (global $g i32 (i32.const 0))) -(assert_invalid (module (memory 0) (memory 0)) "multiple memories") -(assert_invalid (module (memory (import "spectest" "memory") 0) (memory 0)) "multiple memories") +(assert_invalid (module (mem 0) (mem 0)) "multiple memories") +(assert_invalid (module (mem (import "spectest" "memory") 0) (mem 0)) "multiple memories") -(module (memory (data)) (func (export "memsize") (result i32) (current_memory))) +(module (mem (data)) (func (export "memsize") (result i32) (mem.size))) (assert_return (invoke "memsize") (i32.const 0)) -(module (memory (data "")) (func (export "memsize") (result i32) (current_memory))) +(module (mem (data "")) (func (export "memsize") (result i32) (mem.size))) (assert_return (invoke "memsize") (i32.const 0)) -(module (memory (data "x")) (func (export "memsize") (result i32) (current_memory))) +(module (mem (data "x")) (func (export "memsize") (result i32) (mem.size))) (assert_return (invoke "memsize") (i32.const 1)) (assert_invalid (module (data (i32.const 0))) "unknown memory") @@ -47,160 +47,160 @@ "unknown memory" ) (assert_invalid - (module (func (drop (current_memory)))) + (module (func (drop (mem.size)))) "unknown memory" ) (assert_invalid - (module (func (drop (grow_memory (i32.const 0))))) + (module (func (drop (mem.grow (i32.const 0))))) "unknown memory" ) (assert_invalid - (module (memory 1) (data (i64.const 0))) + (module (mem 1) (data (i64.const 0))) "type mismatch" ) (assert_invalid - (module (memory 1) (data (i32.ctz (i32.const 0)))) + (module (mem 1) (data (i32.ctz (i32.const 0)))) "constant expression required" ) (assert_invalid - (module (memory 1) (data (nop))) + (module (mem 1) (data (nop))) "constant expression required" ) ;; Use of internal globals in constant expressions is not allowed in MVP. ;; (assert_invalid -;; (module (memory 1) (data (get_global $g)) (global $g (mut i32) (i32.const 0))) +;; (module (mem 1) (data (get_global $g)) (global $g (mut i32) (i32.const 0))) ;; "constant expression required" ;; ) (assert_unlinkable - (module (memory 0 0) (data (i32.const 0) "a")) + (module (mem 0 0) (data (i32.const 0) "a")) "data segment does not fit" ) (assert_unlinkable - (module (memory 0 1) (data (i32.const 0) "a")) + (module (mem 0 1) (data (i32.const 0) "a")) "data segment does not fit" ) (assert_unlinkable - (module (memory 1 2) (data (i32.const -1) "a")) + (module (mem 1 2) (data (i32.const -1) "a")) "data segment does not fit" ) (assert_unlinkable - (module (memory 1 2) (data (i32.const -1000) "a")) + (module (mem 1 2) (data (i32.const -1000) "a")) "data segment does not fit" ) (assert_unlinkable - (module (memory 1 2) (data (i32.const 0) "a") (data (i32.const 98304) "b")) + (module (mem 1 2) (data (i32.const 0) "a") (data (i32.const 98304) "b")) "data segment does not fit" ) (assert_unlinkable - (module (memory 0 0) (data (i32.const 1) "")) + (module (mem 0 0) (data (i32.const 1) "")) "data segment does not fit" ) (assert_unlinkable - (module (memory 1) (data (i32.const 0x12000) "")) + (module (mem 1) (data (i32.const 0x12000) "")) "data segment does not fit" ) (assert_unlinkable - (module (memory 1 2) (data (i32.const -1) "")) + (module (mem 1 2) (data (i32.const -1) "")) "data segment does not fit" ) ;; This seems to cause a time-out on Travis. (;assert_unlinkable - (module (memory 0x10000) (data (i32.const 0xffffffff) "ab")) + (module (mem 0x10000) (data (i32.const 0xffffffff) "ab")) "" ;; either out of memory or segment does not fit ;) (assert_unlinkable (module (global (import "spectest" "global") i32) - (memory 0) (data (get_global 0) "a") + (mem 0) (data (get_global 0) "a") ) "data segment does not fit" ) -(module (memory 0 0) (data (i32.const 0) "")) -(module (memory 1 1) (data (i32.const 0x10000) "")) -(module (memory 1 2) (data (i32.const 0) "abc") (data (i32.const 0) "def")) -(module (memory 1 2) (data (i32.const 3) "ab") (data (i32.const 0) "de")) +(module (mem 0 0) (data (i32.const 0) "")) +(module (mem 1 1) (data (i32.const 0x10000) "")) +(module (mem 1 2) (data (i32.const 0) "abc") (data (i32.const 0) "def")) +(module (mem 1 2) (data (i32.const 3) "ab") (data (i32.const 0) "de")) (module - (memory 1 2) + (mem 1 2) (data (i32.const 0) "a") (data (i32.const 2) "b") (data (i32.const 1) "c") ) (assert_invalid - (module (memory 1 0)) + (module (mem 1 0)) "size minimum must not be greater than maximum" ) (assert_invalid - (module (memory 65537)) + (module (mem 65537)) "memory size must be at most 65536 pages (4GiB)" ) (assert_invalid - (module (memory 2147483648)) + (module (mem 2147483648)) "memory size must be at most 65536 pages (4GiB)" ) (assert_invalid - (module (memory 4294967295)) + (module (mem 4294967295)) "memory size must be at most 65536 pages (4GiB)" ) (assert_invalid - (module (memory 0 65537)) + (module (mem 0 65537)) "memory size must be at most 65536 pages (4GiB)" ) (assert_invalid - (module (memory 0 2147483648)) + (module (mem 0 2147483648)) "memory size must be at most 65536 pages (4GiB)" ) (assert_invalid - (module (memory 0 4294967295)) + (module (mem 0 4294967295)) "memory size must be at most 65536 pages (4GiB)" ) ;; Test alignment annotation rules -(module (memory 0) (func (drop (i32.load8_u align=1 (i32.const 0))))) -(module (memory 0) (func (drop (i32.load16_u align=2 (i32.const 0))))) -(module (memory 0) (func (drop (i32.load align=4 (i32.const 0))))) -(module (memory 0) (func (drop (f32.load align=4 (i32.const 0))))) +(module (mem 0) (func (drop (i32.load8_u align=1 (i32.const 0))))) +(module (mem 0) (func (drop (i32.load16_u align=2 (i32.const 0))))) +(module (mem 0) (func (drop (i32.load align=4 (i32.const 0))))) +(module (mem 0) (func (drop (f32.load align=4 (i32.const 0))))) (assert_invalid - (module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) + (module (mem 0) (func (drop (i64.load align=16 (i32.const 0))))) "alignment must not be larger than natural" ) (assert_invalid - (module (memory 0) (func (drop (i64.load align=32 (i32.const 0))))) + (module (mem 0) (func (drop (i64.load align=32 (i32.const 0))))) "alignment must not be larger than natural" ) (assert_invalid - (module (memory 0) (func (drop (i32.load align=8 (i32.const 0))))) + (module (mem 0) (func (drop (i32.load align=8 (i32.const 0))))) "alignment must not be larger than natural" ) (assert_invalid - (module (memory 0) (func (drop (i32.load16_u align=4 (i32.const 0))))) + (module (mem 0) (func (drop (i32.load16_u align=4 (i32.const 0))))) "alignment must not be larger than natural" ) (assert_invalid - (module (memory 0) (func (drop (i32.load8_u align=2 (i32.const 0))))) + (module (mem 0) (func (drop (i32.load8_u align=2 (i32.const 0))))) "alignment must not be larger than natural" ) (assert_invalid - (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) + (module (mem 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) "alignment must not be larger than natural" ) (assert_invalid - (module (memory 0) (func (i32.load16_u align=4 (i32.const 0)))) + (module (mem 0) (func (i32.load16_u align=4 (i32.const 0)))) "alignment must not be larger than natural" ) (assert_invalid - (module (memory 0) (func (i32.load8_u align=2 (i32.const 0)))) + (module (mem 0) (func (i32.load8_u align=2 (i32.const 0)))) "alignment must not be larger than natural" ) (assert_invalid - (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) + (module (mem 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) "alignment must not be larger than natural" ) (module - (memory 1) + (mem 1) (data (i32.const 0) "ABC\a7D") (data (i32.const 20) "WASM") ;; Data section @@ -388,56 +388,56 @@ (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i32) (i32.load32 (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i32) (i32.load32_u (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i32) (i32.load32_s (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i32) (i32.load64 (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i32) (i32.load64_u (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i32) (i32.load64_s (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (i32.store32 (get_local 0) (i32.const 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (i32.store64 (get_local 0) (i64.const 0)))" ) "unknown operator" @@ -445,28 +445,28 @@ (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i64) (i64.load64 (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i64) (i64.load64_u (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result i64) (i64.load64_s (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (i64.store64 (get_local 0) (i64.const 0)))" ) "unknown operator" @@ -474,28 +474,28 @@ (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result f32) (f32.load32 (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result f32) (f32.load64 (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (f32.store32 (get_local 0) (f32.const 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (f32.store64 (get_local 0) (f64.const 0)))" ) "unknown operator" @@ -503,28 +503,28 @@ (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result f64) (f64.load32 (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (result f64) (f64.load64 (get_local 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (f64.store32 (get_local 0) (f32.const 0)))" ) "unknown operator" ) (assert_malformed (module quote - "(memory 1)" + "(mem 1)" "(func (param i32) (f64.store64 (get_local 0) (f64.const 0)))" ) "unknown operator" diff --git a/test/core/memory_redundancy.wast b/test/core/memory_redundancy.wast index f16adc41b7..f057c35477 100644 --- a/test/core/memory_redundancy.wast +++ b/test/core/memory_redundancy.wast @@ -3,7 +3,7 @@ ;; and to non-identical addresses. (module - (memory 1 1) + (mem 1 1) (func (export "zero_everything") (i32.store (i32.const 0) (i32.const 0)) diff --git a/test/core/memory_trap.wast b/test/core/memory_trap.wast index 5fd193de23..7aa9b390cf 100644 --- a/test/core/memory_trap.wast +++ b/test/core/memory_trap.wast @@ -1,8 +1,8 @@ (module - (memory 1) + (mem 1) (func $addr_limit (result i32) - (i32.mul (current_memory) (i32.const 0x10000)) + (i32.mul (mem.size) (i32.const 0x10000)) ) (func (export "store") (param $i i32) (param $v i32) @@ -13,8 +13,8 @@ (i32.load (i32.add (call $addr_limit) (get_local $i))) ) - (func (export "grow_memory") (param i32) (result i32) - (grow_memory (get_local 0)) + (func (export "grow") (param i32) (result i32) + (mem.grow (get_local 0)) ) ) @@ -30,10 +30,10 @@ (assert_trap (invoke "load" (i32.const 0)) "out of bounds memory access") (assert_trap (invoke "store" (i32.const 0x80000000) (i32.const 13)) "out of bounds memory access") (assert_trap (invoke "load" (i32.const 0x80000000)) "out of bounds memory access") -(assert_return (invoke "grow_memory" (i32.const 0x10001)) (i32.const -1)) +(assert_return (invoke "grow" (i32.const 0x10001)) (i32.const -1)) (module - (memory 1) + (mem 1) (data (i32.const 0) "abcdefgh") (data (i32.const 0xfff8) "abcdefgh") diff --git a/test/core/nop.wast b/test/core/nop.wast index 2862315587..425676e444 100644 --- a/test/core/nop.wast +++ b/test/core/nop.wast @@ -6,7 +6,7 @@ (func $3-ary (param i32 i32 i32) (result i32) get_local 0 get_local 1 get_local 2 i32.sub i32.add ) - (memory 1) + (mem 1) (func (export "as-func-first") (result i32) (nop) (i32.const 1) @@ -172,11 +172,11 @@ (nop) (get_local 0) (nop) (nop) (get_local 0) (nop) (nop) (i32.le_s) ) - (func (export "as-grow_memory-last") (param i32) (result i32) - (get_local 0) (nop) (grow_memory) + (func (export "as-mem.grow-last") (param i32) (result i32) + (get_local 0) (nop) (mem.grow) ) - (func (export "as-grow_memory-everywhere") (param i32) (result i32) - (nop) (nop) (get_local 0) (nop) (nop) (grow_memory) + (func (export "as-mem.grow-everywhere") (param i32) (result i32) + (nop) (nop) (get_local 0) (nop) (nop) (mem.grow) ) ) @@ -243,8 +243,8 @@ (assert_return (invoke "as-compare-last" (i32.const 3)) (i32.const 0)) (assert_return (invoke "as-compare-everywhere" (i32.const 3)) (i32.const 1)) -(assert_return (invoke "as-grow_memory-last" (i32.const 2)) (i32.const 1)) -(assert_return (invoke "as-grow_memory-everywhere" (i32.const 12)) (i32.const 3)) +(assert_return (invoke "as-mem.grow-last" (i32.const 2)) (i32.const 1)) +(assert_return (invoke "as-mem.grow-everywhere" (i32.const 12)) (i32.const 3)) (assert_invalid (module (func $type-i32 (result i32) (nop))) diff --git a/test/core/resizing.wast b/test/core/resizing.wast index 80d20b56a2..f730609f0d 100644 --- a/test/core/resizing.wast +++ b/test/core/resizing.wast @@ -1,5 +1,5 @@ (module - (memory 0) + (mem 0) (func (export "load_at_zero") (result i32) (i32.load (i32.const 0))) (func (export "store_at_zero") (i32.store (i32.const 0) (i32.const 2))) @@ -7,8 +7,8 @@ (func (export "load_at_page_size") (result i32) (i32.load (i32.const 0x10000))) (func (export "store_at_page_size") (i32.store (i32.const 0x10000) (i32.const 3))) - (func (export "grow") (param $sz i32) (result i32) (grow_memory (get_local $sz))) - (func (export "size") (result i32) (current_memory)) + (func (export "grow") (param $sz i32) (result i32) (mem.grow (get_local $sz))) + (func (export "size") (result i32) (mem.size)) ) (assert_return (invoke "size") (i32.const 0)) @@ -34,8 +34,8 @@ (module - (memory 0) - (func (export "grow") (param i32) (result i32) (grow_memory (get_local 0))) + (mem 0) + (func (export "grow") (param i32) (result i32) (mem.grow (get_local 0))) ) (assert_return (invoke "grow" (i32.const 0)) (i32.const 0)) @@ -46,8 +46,8 @@ (assert_return (invoke "grow" (i32.const 0x10000)) (i32.const -1)) (module - (memory 0 10) - (func (export "grow") (param i32) (result i32) (grow_memory (get_local 0))) + (mem 0 10) + (func (export "grow") (param i32) (result i32) (mem.grow (get_local 0))) ) (assert_return (invoke "grow" (i32.const 0)) (i32.const 0)) diff --git a/test/core/return.wast b/test/core/return.wast index d483b5e511..b755c73dd0 100644 --- a/test/core/return.wast +++ b/test/core/return.wast @@ -148,7 +148,7 @@ (set_local 0 (return (i32.const 17))) (i32.const -1) ) - (memory 1) + (mem 1) (func (export "as-load-address") (result f32) (f32.load (return (f32.const 1.7))) ) @@ -196,8 +196,8 @@ (i32.wrap/i64 (return (i32.const 41))) ) - (func (export "as-grow_memory-size") (result i32) - (grow_memory (return (i32.const 40))) + (func (export "as-mem.grow-size") (result i32) + (mem.grow (return (i32.const 40))) ) ) @@ -278,7 +278,7 @@ (assert_return (invoke "as-convert-operand") (i32.const 41)) -(assert_return (invoke "as-grow_memory-size") (i32.const 40)) +(assert_return (invoke "as-mem.grow-size") (i32.const 40)) (assert_invalid (module (func $type-value-empty-vs-num (result f64) (return))) diff --git a/test/core/skip-stack-guard-page.wast b/test/core/skip-stack-guard-page.wast index f2449dc85d..6696ed8201 100644 --- a/test/core/skip-stack-guard-page.wast +++ b/test/core/skip-stack-guard-page.wast @@ -1,6 +1,6 @@ ;; This tests that the stack overflow guard page can't be skipped by a function with more than a page of locals. (module - (memory 1) + (mem 1) (export "test-guard-page-skip" (func $test-guard-page-skip)) (func $test-guard-page-skip diff --git a/test/core/start.wast b/test/core/start.wast index a94dfa16be..b931763656 100644 --- a/test/core/start.wast +++ b/test/core/start.wast @@ -19,7 +19,7 @@ ) (module - (memory (data "A")) + (mem (data "A")) (func $inc (i32.store8 (i32.const 0) @@ -49,7 +49,7 @@ (assert_return (invoke "get") (i32.const 70)) (module - (memory (data "A")) + (mem (data "A")) (func $inc (i32.store8 (i32.const 0) diff --git a/test/core/store_retval.wast b/test/core/store_retval.wast index a4d03582f6..e6787c51ac 100644 --- a/test/core/store_retval.wast +++ b/test/core/store_retval.wast @@ -16,40 +16,40 @@ ) (assert_invalid - (module (memory 1) (func (param i32) (result i32) (i32.store (i32.const 0) (i32.const 1)))) + (module (mem 1) (func (param i32) (result i32) (i32.store (i32.const 0) (i32.const 1)))) "type mismatch" ) (assert_invalid - (module (memory 1) (func (param i64) (result i64) (i64.store (i32.const 0) (i64.const 1)))) + (module (mem 1) (func (param i64) (result i64) (i64.store (i32.const 0) (i64.const 1)))) "type mismatch" ) (assert_invalid - (module (memory 1) (func (param f32) (result f32) (f32.store (i32.const 0) (f32.const 1)))) + (module (mem 1) (func (param f32) (result f32) (f32.store (i32.const 0) (f32.const 1)))) "type mismatch" ) (assert_invalid - (module (memory 1) (func (param f64) (result f64) (f64.store (i32.const 0) (f64.const 1)))) + (module (mem 1) (func (param f64) (result f64) (f64.store (i32.const 0) (f64.const 1)))) "type mismatch" ) (assert_invalid - (module (memory 1) (func (param i32) (result i32) (i32.store8 (i32.const 0) (i32.const 1)))) + (module (mem 1) (func (param i32) (result i32) (i32.store8 (i32.const 0) (i32.const 1)))) "type mismatch" ) (assert_invalid - (module (memory 1) (func (param i32) (result i32) (i32.store16 (i32.const 0) (i32.const 1)))) + (module (mem 1) (func (param i32) (result i32) (i32.store16 (i32.const 0) (i32.const 1)))) "type mismatch" ) (assert_invalid - (module (memory 1) (func (param i64) (result i64) (i64.store8 (i32.const 0) (i64.const 1)))) + (module (mem 1) (func (param i64) (result i64) (i64.store8 (i32.const 0) (i64.const 1)))) "type mismatch" ) (assert_invalid - (module (memory 1) (func (param i64) (result i64) (i64.store16 (i32.const 0) (i64.const 1)))) + (module (mem 1) (func (param i64) (result i64) (i64.store16 (i32.const 0) (i64.const 1)))) "type mismatch" ) (assert_invalid - (module (memory 1) (func (param i64) (result i64) (i64.store32 (i32.const 0) (i64.const 1)))) + (module (mem 1) (func (param i64) (result i64) (i64.store32 (i32.const 0) (i64.const 1)))) "type mismatch" ) diff --git a/test/core/traps.wast b/test/core/traps.wast index a9401408e3..20685a3e91 100644 --- a/test/core/traps.wast +++ b/test/core/traps.wast @@ -57,7 +57,7 @@ (assert_trap (invoke "no_dce.i64.trunc_u_f64" (f64.const nan)) "invalid conversion to integer") (module - (memory 1) + (mem 1) (func (export "no_dce.i32.load") (param $i i32) (drop (i32.load (get_local $i)))) (func (export "no_dce.i32.load16_s") (param $i i32) (drop (i32.load16_s (get_local $i)))) diff --git a/test/core/typecheck.wast b/test/core/typecheck.wast index b322b526fd..461fe0825d 100644 --- a/test/core/typecheck.wast +++ b/test/core/typecheck.wast @@ -253,42 +253,42 @@ (assert_invalid (module (func (local i32) (set_local 0 (f32.const 0)))) "type mismatch") ;; load index -(assert_invalid (module (memory 1) (func (i32.load (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.load8_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.load8_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.load16_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.load16_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load8_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load8_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load16_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load16_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load32_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load32_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f32.load (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f64.load (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.load (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.load8_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.load8_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.load16_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.load16_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.load (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.load8_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.load8_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.load16_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.load16_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.load32_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.load32_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (f32.load (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (f64.load (f32.const 0)))) "type mismatch") ;; store index -(assert_invalid (module (memory 1) (func (i32.store (f32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.store8 (f32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.store16 (f32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store (f32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store8 (f32.const 0) (i64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store16 (f32.const 0) (i64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store32 (f32.const 0) (i64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f32.store (f32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f64.store (f32.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.store (f32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.store8 (f32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.store16 (f32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.store (f32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.store8 (f32.const 0) (i64.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.store16 (f32.const 0) (i64.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.store32 (f32.const 0) (i64.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (f32.store (f32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (f64.store (f32.const 0) (f64.const 0)))) "type mismatch") ;; store value -(assert_invalid (module (memory 1) (func (i32.store (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.store8 (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.store16 (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store8 (i32.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store16 (i32.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store32 (i32.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f32.store (i32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f64.store (i32.const 0) (i64.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.store (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.store8 (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i32.store16 (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.store (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.store8 (i32.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.store16 (i32.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (i64.store32 (i32.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (f32.store (i32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (mem 1) (func (f64.store (i32.const 0) (i64.const 0)))) "type mismatch") ;; binary (assert_invalid (module (func (i32.add (i64.const 0) (f32.const 0)))) "type mismatch") @@ -421,5 +421,5 @@ (assert_invalid (module (func (f64.promote/f32 (i32.const 0)))) "type mismatch") (assert_invalid (module (func (f64.reinterpret/i64 (i32.const 0)))) "type mismatch") -;; grow_memory -(assert_invalid (module (memory 1) (func (grow_memory (f32.const 0)))) "type mismatch") +;; mem.grow +(assert_invalid (module (mem 1) (func (mem.grow (f32.const 0)))) "type mismatch") diff --git a/test/core/unreachable.wast b/test/core/unreachable.wast index f7fe4030f4..9221eee2f8 100644 --- a/test/core/unreachable.wast +++ b/test/core/unreachable.wast @@ -155,7 +155,7 @@ (set_local 0 (unreachable)) ) - (memory 1) + (mem 1) (func (export "as-load-address") (result f32) (f32.load (unreachable)) ) @@ -203,8 +203,8 @@ (i32.wrap/i64 (unreachable)) ) - (func (export "as-grow_memory-size") (result i32) - (grow_memory (unreachable)) + (func (export "as-mem.grow-size") (result i32) + (mem.grow (unreachable)) ) ) @@ -286,5 +286,5 @@ (assert_trap (invoke "as-convert-operand") "unreachable") -(assert_trap (invoke "as-grow_memory-size") "unreachable") +(assert_trap (invoke "as-mem.grow-size") "unreachable") From 194ff433fa55723a620f904979cfbebb85eb9c24 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 18 Jan 2018 20:47:25 +0100 Subject: [PATCH 2/2] Rename spectest.memory --- document/js-api/index.bs | 122 +++++++++++++++++------------------ interpreter/host/spectest.ml | 2 +- test/core/imports.wast | 30 ++++----- test/core/memory.wast | 2 +- 4 files changed, 78 insertions(+), 78 deletions(-) diff --git a/document/js-api/index.bs b/document/js-api/index.bs index 08b27924f0..c4c41140e8 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -93,10 +93,10 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df text: trap; url: exec/runtime.html#syntax-trap url: exec/runtime.html#values text: WebAssembly value - text: ν—‚νŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν— - text: ν—‚νŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν— - text: ν–ΏνŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν— - text: ν–ΏνŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν— + text: π—‚πŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ— + text: 𝗂πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ— + text: 𝖿πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ— + text: π–ΏπŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ— text: function index; url: syntax/modules.html#syntax-funcidx text: function instance; url: exec/runtime.html#function-instances text: init_store; url: appendix/embedding.html#embed-init-store @@ -130,10 +130,10 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df text: function address; url: exec/runtime.html#syntax-funcaddr text: memory address; url: exec/runtime.html#syntax-memaddr url: syntax/types.html#syntax-valtype - text: ν—‚νŸ₯ퟀ - text: ν—‚νŸ¨νŸ¦ - text: ν–ΏνŸ₯ퟀ - text: ν–ΏνŸ¨νŸ¦ + text: 𝗂πŸ₯𝟀 + text: π—‚πŸ¨πŸ¦ + text: 𝖿πŸ₯𝟀 + text: π–ΏπŸ¨πŸ¦ text: function element; url: exec/runtime.html#syntax-funcelem text: import component; url: syntax/modules.html#imports text: external value; url: exec/runtime.html#syntax-externval @@ -142,13 +142,13 @@ urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: df text: size_table; url: appendix/embedding.html#embed-size-table text: size_mem; url: appendix/embedding.html#embed-size-mem text: module; url: syntax/modules.html#syntax-module - text: ν—‚ν—†ν—‰ν—ˆν—‹ν—ν—Œ; url: syntax/modules.html#syntax-module + text: π—‚π—†π—‰π—ˆπ—‹π—π—Œ; url: syntax/modules.html#syntax-module url: syntax/types.html#external-types text: external type - text: ν–Ών—Žν—‡ν–Ό - text: 헍햺햻헅햾 - text: ν—†ν–Ύν—† - text: ν—€ν—…ν—ˆν–»ν–Ίν—… + text: π–Ώπ—Žπ—‡π–Ό + text: 𝗍𝖺𝖻𝗅𝖾 + text: 𝗆𝖾𝗆 + text: π—€π—…π—ˆπ–»π–Ίπ—… text: global type; url: syntax/types.html#syntax-globaltype text: address; url: exec/runtime.html#addresses @@ -309,13 +309,13 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
To instantiate a WebAssembly module from a {{Module}} |moduleObject| and imports |importObject|, perform the following steps: 1. Let |module| be |moduleObject|.\[[Module]]. - 1. If |module|.[=ν—‚ν—†ν—‰ν—ˆν—‹ν—ν—Œ=] is not an empty list, and |importObject| is undefined, throw a {{TypeError}} exception. + 1. If |module|.[=π—‚π—†π—‰π—ˆπ—‹π—π—Œ=] is not an empty list, and |importObject| is undefined, throw a {{TypeError}} exception. 1. Let |imports| be an empty [=list=] of [=external value=]s. 1. For each (|moduleName|, |componentName|, |externtype|) in [=module_imports=](|module|), do 1. Let |o| be ? [=Get=](|importObject|, |moduleName|). 1. If [=Type=](|o|) is not [=Object=], throw a {{TypeError}} exception. 1. Let |v| be ? [=Get=](|o|, |componentName|) - 1. If |externtype| is of the form [=ν–Ών—Žν—‡ν–Ό=] |functype|, + 1. If |externtype| is of the form [=π–Ώπ—Žπ—‡π–Ό=] |functype|, 1. If [=IsCallable=](|v|) is false, throw a {{LinkError}} exception. 1. If |v| has a \[[FunctionAddress]] internal slot, and therefore is an [=Exported Function=], 1. Let |funcaddr| be the value of |v|'s \[[FunctionAddress]] internal slot. @@ -324,31 +324,31 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje 1. Otherwise, 1. [=Create a host function=] from |v| and let |funcaddr| be the result. 1. Let |index| be the number of external functions in |imports|. This value |index| is known as the index of the host function |funcaddr|. - 1. Let |externfunc| be the [=external value=] [=external value|ν–Ών—Žν—‡ν–Ό=] |funcaddr|. + 1. Let |externfunc| be the [=external value=] [=external value|π–Ώπ—Žπ—‡π–Ό=] |funcaddr|. 1. [=Append=] |externfunc| to |imports|. - 1. If |externtype| is of the form [=ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaltype|, - 1. If |globaltype| is [=ν—‚νŸ¨νŸ¦=] or [=Type=](|v|) is not [=Number=], throw a {{LinkError}} exception. + 1. If |externtype| is of the form [=π—€π—…π—ˆπ–»π–Ίπ—…=] |globaltype|, + 1. If |globaltype| is [=π—‚πŸ¨πŸ¦=] or [=Type=](|v|) is not [=Number=], throw a {{LinkError}} exception. 1. Let |value| be [=ToWebAssemblyValue=](|v|, |globaltype|.[=global type|valtype=]) - 1. Assert: |globaltype|.[=global type|mut=] is [=global type|ν–Όν—ˆν—‡ν—Œν—=], as verified by WebAssembly validation. + 1. Assert: |globaltype|.[=global type|mut=] is [=global type|π–Όπ—ˆπ—‡π—Œπ—=], as verified by WebAssembly validation. 1. Let |store| be the current agent's [=associated store=]. 1. Let (|store|, |globaladdr|) be [=alloc_global=](|store|, |globaltype|, |value|). 1. Set the current agent's [=associated store=] to |store|. - 1. Let |externglobal| be [=external value|ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaladdr|. + 1. Let |externglobal| be [=external value|π—€π—…π—ˆπ–»π–Ίπ—…=] |globaladdr|. 1. [=Append=] |externglobal| to |imports|. - 1. If |externtype| is of the form [=ν—†ν–Ύν—†=] |memtype|, + 1. If |externtype| is of the form [=𝗆𝖾𝗆=] |memtype|, 1. If |v| is not a {{Memory}} object, throw a {{LinkError}} exception. Note: [=instantiate_module=] invoked below will check the imported {{Memory}}'s size against the importing module's requirements. - 2. Let |externmem| be the [=external value=] [=external value|ν—†ν–Ύν—†=] |v|.\[[Memory]]. + 2. Let |externmem| be the [=external value=] [=external value|𝗆𝖾𝗆=] |v|.\[[Memory]]. 1. [=Append=] |externmem| to |imports|. - 1. Otherwise, |externtype| is of the form [=헍햺햻헅햾=] |tabletype|, + 1. Otherwise, |externtype| is of the form [=𝗍𝖺𝖻𝗅𝖾=] |tabletype|, 1. If |v| is not a {{Table}} instance, throw a {{LinkError}} exception. Note: The table's length, etc. is checked by [=instantiate_module=] invoked below. 2. Let |tableaddr| be |v|.\[[Table]] - 1. Let |externtable| be the [=external value=] [=external value|헍햺햻헅햾=] |tableaddr|. + 1. Let |externtable| be the [=external value=] [=external value|𝗍𝖺𝖻𝗅𝖾=] |tableaddr|. 1. [=Append=] |externtable| to |imports|. 1. Let (|store|, |instance|) be [=instantiate_module=](|store|, |module|, |imports|). 1. If |instance| is [=error=], throw an appropriate exception type: @@ -359,25 +359,25 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje 1. For each pair (|name|, |externtype|) in [=module_exports=](|module|), 1. Let |externval| be [=get_export=](|instance|, |name|). 1. Assert: |externval| is not [=error=]. - 1. If |externtype| is of the form [=ν–Ών—Žν—‡ν–Ό=] |functype|, - 1. Assert: |externval| is of the form [=external value|ν–Ών—Žν—‡ν–Ό=] |funcaddr|. - 1. Let [=external value|ν–Ών—Žν—‡ν–Ό=] |funcaddr| be |externval|. + 1. If |externtype| is of the form [=π–Ώπ—Žπ—‡π–Ό=] |functype|, + 1. Assert: |externval| is of the form [=external value|π–Ώπ—Žπ—‡π–Ό=] |funcaddr|. + 1. Let [=external value|π–Ώπ—Žπ—‡π–Ό=] |funcaddr| be |externval|. 1. Let |func| be the result of creating [=a new Exported Function=] from |funcaddr|. 1. Let |value| be |func|. - 1. If |externtype| is of the form [=ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaltype|, - 1. If |globaltype|.[=global type|valtype=]) is [=ν—‚νŸ¨νŸ¦=], throw a {{LinkError}} exception. - 1. Assert: |globaltype|.[=global type|mut=] is [=global type|ν–Όν—ˆν—‡ν—Œν—=], as verified by WebAssembly validation. - 1. Assert: |externval| is of the form [=external value|ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaladdr|. - 1. Let [=external value|ν—€ν—…ν—ˆν–»ν–Ίν—…=] |globaladdr| be |externval|. + 1. If |externtype| is of the form [=π—€π—…π—ˆπ–»π–Ίπ—…=] |globaltype|, + 1. If |globaltype|.[=global type|valtype=]) is [=π—‚πŸ¨πŸ¦=], throw a {{LinkError}} exception. + 1. Assert: |globaltype|.[=global type|mut=] is [=global type|π–Όπ—ˆπ—‡π—Œπ—=], as verified by WebAssembly validation. + 1. Assert: |externval| is of the form [=external value|π—€π—…π—ˆπ–»π–Ίπ—…=] |globaladdr|. + 1. Let [=external value|π—€π—…π—ˆπ–»π–Ίπ—…=] |globaladdr| be |externval|. 1. Let |value| be [=ToJSValue=]([=read_global=](|store|, |globaladdr|)). - 1. If |externtype| is of the form [=ν—†ν–Ύν—†=] |memtype|, - 1. Assert: |externval| is of the form [=external value|ν—†ν–Ύν—†=] |memaddr|. - 1. Let [=external value|ν—†ν–Ύν—†=] |memaddr| be |externval|. + 1. If |externtype| is of the form [=𝗆𝖾𝗆=] |memtype|, + 1. Assert: |externval| is of the form [=external value|𝗆𝖾𝗆=] |memaddr|. + 1. Let [=external value|𝗆𝖾𝗆=] |memaddr| be |externval|. 1. Let |memory| be [=create a memory object|a new Memory object=] created from |memaddr|. 1. Let |value| be |memory|. - 1. Otherwise, |externtype| is of the form [=헍햺햻헅햾=] |tabletype|, - 1. Assert: |externval| is of the form [=external value|헍햺햻헅햾=] |tableaddr|. - 1. Let [=external value|헍햺햻헅햾=] |tableaddr| be |externval|. + 1. Otherwise, |externtype| is of the form [=𝗍𝖺𝖻𝗅𝖾=] |tabletype|, + 1. Assert: |externval| is of the form [=external value|𝗍𝖺𝖻𝗅𝖾=] |tableaddr|. + 1. Let [=external value|𝗍𝖺𝖻𝗅𝖾=] |tableaddr| be |externval|. 1. Let |table| be [=create a Table object|a new Table object=] created from |tableaddr|. 1. Let |value| be |table|. 1. Let |status| be ! [=CreateDataProperty=](|exportsObject|, |name|, |value|). @@ -455,10 +455,10 @@ interface Module {
The string value of the extern type |type| is - * "function" if |type| is of the form [=ν–Ών—Žν—‡ν–Ό=] functype - * "table" if |type| is of the form [=헍햺햻헅햾=] tabletype - * "memory" if |type| is of the form [=ν—†ν–Ύν—†=] memtype - * "global" if |type| is of the form [=ν—€ν—…ν—ˆν–»ν–Ίν—…=] globaltype + * "function" if |type| is of the form [=π–Ώπ—Žπ—‡π–Ό=] functype + * "table" if |type| is of the form [=𝗍𝖺𝖻𝗅𝖾=] tabletype + * "memory" if |type| is of the form [=𝗆𝖾𝗆=] memtype + * "global" if |type| is of the form [=π—€π—…π—ˆπ–»π–Ίπ—…=] globaltype
@@ -637,7 +637,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. If |descriptor|["initial"] is [=present=], let |n| be |descriptor|["initial"]; otherwise, let |n| be 0. 1. If |descriptor|["maximum"] is [=present=], let |m| be |descriptor|["maximum"]; otherwise, let |m| be empty. 1. If |m| is not empty and |m| < |n|, throw a {{RangeError}} exception. - 1. Let |type| be the [=table type=] {[=table type|ν—†ν—‚ν—‡=] n, [=table type|ν—†ν–Ίν—‘=] |m|} [=table type|ν–Ίν—‡ν—’ν–Ών—Žν—‡ν–Ό=]. + 1. Let |type| be the [=table type=] {[=table type|𝗆𝗂𝗇=] n, [=table type|𝗆𝖺𝗑=] |m|} [=table type|π–Ίπ—‡π—’π–Ώπ—Žπ—‡π–Ό=]. 1. Let |store| be the current agent's [=associated store=]. 1. Let (|store|, |tableaddr|) be [=alloc_table=](|store|, |type|). 1. Set the current agent's [=associated store=] to |store|. @@ -697,14 +697,14 @@ This slot holds a [=function address=] relative to the current agent's [=associa The name of the WebAssembly function |funcaddr| is found by performing the following steps: 1. Let |store| be the current agent's [=associated store=]. - 1. Let |funcinst| be |store|.ν–Ών—Žν—‡ν–Όν—Œ[|funcaddr|]. - 1. If |funcinst| is of the form {헍헒헉햾 |functype|, ν—ν—ˆν—Œν—ν–Όν—ˆν–½ν–Ύ |hostfunc|}, + 1. Let |funcinst| be |store|.π–Ώπ—Žπ—‡π–Όπ—Œ[|funcaddr|]. + 1. If |funcinst| is of the form {𝗍𝗒𝗉𝖾 |functype|, π—π—ˆπ—Œπ—π–Όπ—ˆπ–½π–Ύ |hostfunc|}, 1. Assert: |hostfunc| is a JavaScript object and [=IsCallable=](|hostfunc|) is true. 1. Let |index| be the [=index of the host function=] |funcaddr|. 1. Otherwise, - 1. Let |moduleinst| be |funcinst|.ν—†ν—ˆν–½ν—Žν—…ν–Ύ. - 1. Assert: |funcaddr| is contained in |moduleinst|.ν–Ών—Žν—‡ν–Όν–Ίν–½ν–½ν—‹ν—Œ. - 1. Let |index| be the index of |moduleinst|.ν–Ών—Žν—‡ν–Όν–Ίν–½ν–½ν—‹ν—Œ where |funcaddr| is found. + 1. Let |moduleinst| be |funcinst|.π—†π—ˆπ–½π—Žπ—…π–Ύ. + 1. Assert: |funcaddr| is contained in |moduleinst|.π–Ώπ—Žπ—‡π–Όπ–Ίπ–½π–½π—‹π—Œ. + 1. Let |index| be the index of |moduleinst|.π–Ώπ—Žπ—‡π–Όπ–Ίπ–½π–½π—‹π—Œ where |funcaddr| is found. 1. Return ! [=ToString=](|index|).
@@ -735,7 +735,7 @@ This slot holds a [=function address=] relative to the current agent's [=associa 1. Let |store| be the current agent's [=associated store=]. 1. Let |functype| be [=type_func=](|store|, |funcaddr|). 1. Let [|parameters|] β†’ [|results|] be |functype|. - 1. If |parameters| or |results| contains an [=ν—‚νŸ¨νŸ¦=], throw a {{TypeError}}. + 1. If |parameters| or |results| contains an [=π—‚πŸ¨πŸ¦=], throw a {{TypeError}}. Note: the above error is thrown each time the \[[Call]] method is invoked. @@ -761,7 +761,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not To create a host function from the JavaScript object |func|, perform the following steps: 1. Let |hostfunc| be a [=host function=] which performs the following steps when called: - 1. If the signature contains an [=ν—‚νŸ¨νŸ¦=] (as argument or result), the host function throws a {{TypeError}} when called. + 1. If the signature contains an [=π—‚πŸ¨πŸ¦=] (as argument or result), the host function throws a {{TypeError}} when called. 1. Let |arguments| be a [=list=] of the arguments of the invocation of this function. 1. Let |jsArguments| be an empty [=list=]. 1. For each |arg| in |arguments|, @@ -779,10 +779,10 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
The algorithm ToJSValue(|w|) coerces a [=WebAssembly value=] to a JavaScript value performs the following steps: -Assert: |w| is not of the form [=ν—‚νŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν—=] |i64|. -1. If |w| is of the form [=ν—‚νŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν—=] |i32|, return [=the Number value=] for |i32|. -1. If |w| is of the form [=ν–ΏνŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν—=] |f32|, return [=the Number value=] for |f32|. -1. If |w| is of the form [=ν–ΏνŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν—=] |f64|, return [=the Number value=] for |f64|. +Assert: |w| is not of the form [=π—‚πŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ—=] |i64|. +1. If |w| is of the form [=𝗂πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ—=] |i32|, return [=the Number value=] for |i32|. +1. If |w| is of the form [=𝖿πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ—=] |f32|, return [=the Number value=] for |f32|. +1. If |w| is of the form [=π–ΏπŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ—=] |f64|, return [=the Number value=] for |f64|. @@ -793,16 +793,16 @@ Note: Implementations may optionally replace the NaN payload with any other NaN The algorithm ToWebAssemblyValue(|v|, |type|) coerce a JavaScript value to a [=WebAssembly value=] performs the following steps: -Assert: |type| is not [=ν—‚νŸ¨νŸ¦=]. -1. If |type| is [=ν—‚νŸ₯ퟀ=], +Assert: |type| is not [=π—‚πŸ¨πŸ¦=]. +1. If |type| is [=𝗂πŸ₯𝟀=], 1. Let |i32| be ? [=ToInt32=](|v|). - 1. Return [=ν—‚νŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν—=] |i32|. -1. If |type| is [=ν–ΏνŸ₯ퟀ=], + 1. Return [=𝗂πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ—=] |i32|. +1. If |type| is [=𝖿πŸ₯𝟀=], 1. Let |f32| be ? [=ToNumber=](|v|) rounded to the nearest representable value using IEEE 754-2008 round to nearest, ties to even mode. - 1. Return [=ν–ΏνŸ₯ퟀ.ν–Όν—ˆν—‡ν—Œν—=] |f32|. -1. If |type| is [=ν–ΏνŸ¨νŸ¦=], + 1. Return [=𝖿πŸ₯𝟀.π–Όπ—ˆπ—‡π—Œπ—=] |f32|. +1. If |type| is [=π–ΏπŸ¨πŸ¦=], 1. Let |f64| be ? [=ToNumber=](|v|). - 1. Return [=ν–ΏνŸ¨νŸ¦.ν–Όν—ˆν—‡ν—Œν—=] |f64|. + 1. Return [=π–ΏπŸ¨πŸ¦.π–Όπ—ˆπ—‡π—Œπ—=] |f64|.
diff --git a/interpreter/host/spectest.ml b/interpreter/host/spectest.ml index a075307aba..c22ce0fa3f 100644 --- a/interpreter/host/spectest.ml +++ b/interpreter/host/spectest.ml @@ -38,5 +38,5 @@ let lookup name t = | "global", ExternGlobalType t -> ExternGlobal (global t) | "global", _ -> ExternGlobal (global (GlobalType (I32Type, Immutable))) | "table", _ -> ExternTable table - | "memory", _ -> ExternMem mem + | "mem", _ -> ExternMem mem | _ -> raise Not_found diff --git a/test/core/imports.wast b/test/core/imports.wast index 24c099d635..9c1e9cf6b7 100644 --- a/test/core/imports.wast +++ b/test/core/imports.wast @@ -190,7 +190,7 @@ "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (func))) + (module (import "spectest" "mem" (func))) "incompatible import type" ) @@ -253,7 +253,7 @@ "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (global i32))) + (module (import "spectest" "mem" (global i32))) "incompatible import type" ) @@ -371,7 +371,7 @@ ;; Memories (module - (import "spectest" "memory" (mem 1 2)) + (import "spectest" "mem" (mem 1 2)) (data 0 (i32.const 10) "\10") (func (export "load") (param i32) (result i32) (i32.load (get_local 0))) @@ -383,7 +383,7 @@ (assert_trap (invoke "load" (i32.const 1000000)) "out of bounds memory access") (module - (mem (import "spectest" "memory") 1 2) + (mem (import "spectest" "mem") 1 2) (data 0 (i32.const 10) "\10") (func (export "load") (param i32) (result i32) (i32.load (get_local 0))) @@ -409,12 +409,12 @@ (module (import "test" "memory-2-inf" (mem 2))) (module (import "test" "memory-2-inf" (mem 1))) (module (import "test" "memory-2-inf" (mem 0))) -(module (import "spectest" "memory" (mem 1))) -(module (import "spectest" "memory" (mem 0))) -(module (import "spectest" "memory" (mem 1 2))) -(module (import "spectest" "memory" (mem 0 2))) -(module (import "spectest" "memory" (mem 1 3))) -(module (import "spectest" "memory" (mem 0 3))) +(module (import "spectest" "mem" (mem 1))) +(module (import "spectest" "mem" (mem 0))) +(module (import "spectest" "mem" (mem 1 2))) +(module (import "spectest" "mem" (mem 0 2))) +(module (import "spectest" "mem" (mem 1 3))) +(module (import "spectest" "mem" (mem 0 3))) (assert_unlinkable (module (import "test" "unknown" (mem 1))) @@ -434,11 +434,11 @@ "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (mem 2))) + (module (import "spectest" "mem" (mem 2))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (mem 1 1))) + (module (import "spectest" "mem" (mem 1 1))) "incompatible import type" ) @@ -468,16 +468,16 @@ ) (assert_unlinkable - (module (import "spectest" "memory" (mem 2))) + (module (import "spectest" "mem" (mem 2))) "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "memory" (mem 1 1))) + (module (import "spectest" "mem" (mem 1 1))) "incompatible import type" ) (module - (import "spectest" "memory" (mem 0 3)) ;; actual has max size 2 + (import "spectest" "mem" (mem 0 3)) ;; actual has max size 2 (func (export "grow") (param i32) (result i32) (mem.grow (get_local 0))) ) (assert_return (invoke "grow" (i32.const 0)) (i32.const 1)) diff --git a/test/core/memory.wast b/test/core/memory.wast index 7f6c79401c..5850043b27 100644 --- a/test/core/memory.wast +++ b/test/core/memory.wast @@ -17,7 +17,7 @@ ;; (module (mem 1) (data (get_global $g) "a") (global $g i32 (i32.const 0))) (assert_invalid (module (mem 0) (mem 0)) "multiple memories") -(assert_invalid (module (mem (import "spectest" "memory") 0) (mem 0)) "multiple memories") +(assert_invalid (module (mem (import "spectest" "mem") 0) (mem 0)) "multiple memories") (module (mem (data)) (func (export "memsize") (result i32) (mem.size))) (assert_return (invoke "memsize") (i32.const 0))