Runtime Structure

Store, stack, and other runtime structure forming the WebAssembly abstract machine, such as values or module instances, are made precise in terms of additional auxiliary syntax.

Values

WebAssembly computations manipulate values of either the four basic number types, i.e., integers and floating-point data of 32 or 64 bit width each, or vectors of 128 bit width, or of reference type.

In most places of the semantics, values of different types can occur. In order to avoid ambiguities, values are therefore represented with an abstract syntax that makes their type explicit. It is convenient to reuse the same notation as for the \(\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}\) instructions and \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref.null}}\) producing them.

References other than null are represented with additional administrative instructions. They either are scalar references, containing a 31-bit integer, structure references, pointing to a specific structure address, array references, pointing to a specific array address, function references, pointing to a specific function address, or host references pointing to an uninterpreted form of host address defined by the embedder. Any of the aformentioned references can furthermore be wrapped up as an external reference.

\[\begin{split}\begin{array}{llcl} \def\mathdef2452#1{{}}\mathdef2452{number} & \href{../exec/runtime.html#syntax-num}{\mathit{num}} &::=& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~\href{../syntax/values.html#syntax-int}{\mathit{i32}} \\&&|& \href{../syntax/types.html#syntax-valtype}{\mathsf{i64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~\href{../syntax/values.html#syntax-int}{\mathit{i64}} \\&&|& \href{../syntax/types.html#syntax-valtype}{\mathsf{f32}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~\href{../syntax/values.html#syntax-float}{\mathit{f32}} \\&&|& \href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~\href{../syntax/values.html#syntax-float}{\mathit{f64}} \\ \def\mathdef2452#1{{}}\mathdef2452{vector} & \href{../exec/runtime.html#syntax-vecc}{\mathit{vec}} &::=& \href{../syntax/types.html#syntax-valtype}{\mathsf{v128}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~\href{../syntax/values.html#syntax-int}{\mathit{i128}} \\ \def\mathdef2452#1{{}}\mathdef2452{reference} & \href{../exec/runtime.html#syntax-ref}{\mathit{ref}} &::=& \href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref.null}}~(\href{../syntax/types.html#syntax-absheaptype}{\mathit{absheaptype}}~|~\href{../valid/conventions.html#syntax-deftype}{\mathit{deftype}}) \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}i31}}~\href{../syntax/values.html#syntax-int}{\mathit{u31}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}struct}}~\href{../exec/runtime.html#syntax-structaddr}{\mathit{structaddr}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~\href{../exec/runtime.html#syntax-arrayaddr}{\mathit{arrayaddr}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~\href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}host}}~\href{../exec/runtime.html#syntax-hostaddr}{\mathit{hostaddr}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}extern}}~\href{../exec/runtime.html#syntax-ref}{\mathit{ref}} \\ \def\mathdef2452#1{{}}\mathdef2452{value} & \href{../exec/runtime.html#syntax-val}{\mathit{val}} &::=& \href{../exec/runtime.html#syntax-num}{\mathit{num}} ~|~ \href{../exec/runtime.html#syntax-vecc}{\mathit{vec}} ~|~ \href{../exec/runtime.html#syntax-ref}{\mathit{ref}} \\ \end{array}\end{split}\]

Note

Future versions of WebAssembly may add additional forms of reference.

Value types can have an associated default value; it is the respective value \(0\) for number types, \(0\) for vector types, and null for nullable reference types. For other references, no default value is defined, \(\href{../exec/runtime.html#default-val}{\mathrm{default}}_t\) hence is an optional value \(\href{../exec/runtime.html#syntax-val}{\mathit{val}}^?\).

\[\begin{split}\begin{array}{lcl@{\qquad}l} \href{../exec/runtime.html#default-val}{\mathrm{default}}_t &=& t{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~0 & (\mathrel{\mbox{if}} t = \href{../syntax/types.html#syntax-numtype}{\mathit{numtype}}) \\ \href{../exec/runtime.html#default-val}{\mathrm{default}}_t &=& t{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~0 & (\mathrel{\mbox{if}} t = \href{../syntax/types.html#syntax-vectype}{\mathit{vectype}}) \\ \href{../exec/runtime.html#default-val}{\mathrm{default}}_t &=& \href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref.null}}~t & (\mathrel{\mbox{if}} t = (\href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\href{../syntax/types.html#syntax-reftype}{\mathsf{null}}~\href{../syntax/types.html#syntax-heaptype}{\mathit{heaptype}})) \\ \href{../exec/runtime.html#default-val}{\mathrm{default}}_t &=& \epsilon & (\mathrel{\mbox{if}} t = (\href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\href{../syntax/types.html#syntax-heaptype}{\mathit{heaptype}})) \\ \end{array}\end{split}\]

Convention

  • The meta variable \(r\) ranges over reference values where clear from context.

Results

A result is the outcome of a computation. It is either a sequence of values or a trap.

\[\begin{split}\begin{array}{llcl} \def\mathdef2452#1{{}}\mathdef2452{result} & \href{../exec/runtime.html#syntax-result}{\mathit{result}} &::=& \href{../exec/runtime.html#syntax-val}{\mathit{val}}^\ast \\&&|& \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \end{array}\end{split}\]

Store

The store represents all global state that can be manipulated by WebAssembly programs. It consists of the runtime representation of all instances of functions, tables, memories, and globals, element segments, data segments, and structures or arrays that have been allocated during the life time of the abstract machine. [1]

It is an invariant of the semantics that no element or data instance is addressed from anywhere else but the owning module instances.

Syntactically, the store is defined as a record listing the existing instances of each category:

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{store} & \href{../exec/runtime.html#syntax-store}{\mathit{store}} &::=& \{~ \begin{array}[t]{l@{~}ll} \href{../exec/runtime.html#syntax-store}{\mathsf{funcs}} & \href{../exec/runtime.html#syntax-funcinst}{\mathit{funcinst}}^\ast, \\ \href{../exec/runtime.html#syntax-store}{\mathsf{tables}} & \href{../exec/runtime.html#syntax-tableinst}{\mathit{tableinst}}^\ast, \\ \href{../exec/runtime.html#syntax-store}{\mathsf{mems}} & \href{../exec/runtime.html#syntax-meminst}{\mathit{meminst}}^\ast, \\ \href{../exec/runtime.html#syntax-store}{\mathsf{globals}} & \href{../exec/runtime.html#syntax-globalinst}{\mathit{globalinst}}^\ast, \\ \href{../exec/runtime.html#syntax-store}{\mathsf{elems}} & \href{../exec/runtime.html#syntax-eleminst}{\mathit{eleminst}}^\ast, \\ \href{../exec/runtime.html#syntax-store}{\mathsf{datas}} & \href{../exec/runtime.html#syntax-datainst}{\mathit{datainst}}^\ast, \\ \href{../exec/runtime.html#syntax-store}{\mathsf{structs}} & \href{../exec/runtime.html#syntax-structinst}{\mathit{structinst}}^\ast, \\ \href{../exec/runtime.html#syntax-store}{\mathsf{arrays}} & \href{../exec/runtime.html#syntax-arrayinst}{\mathit{arrayinst}}^\ast ~\} \end{array} \end{array}\end{split}\]

Convention

  • The meta variable \(S\) ranges over stores where clear from context.

Addresses

Function instances, table instances, memory instances, and global instances, element instances, data instances and structure or array instances in the store are referenced with abstract addresses. These are simply indices into the respective store component. In addition, an embedder may supply an uninterpreted set of host addresses.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{address} & \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} &::=& 0 ~|~ 1 ~|~ 2 ~|~ \dots \\ \def\mathdef2452#1{{}}\mathdef2452{function address} & \href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \def\mathdef2452#1{{}}\mathdef2452{table address} & \href{../exec/runtime.html#syntax-tableaddr}{\mathit{tableaddr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \def\mathdef2452#1{{}}\mathdef2452{memory address} & \href{../exec/runtime.html#syntax-memaddr}{\mathit{memaddr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \def\mathdef2452#1{{}}\mathdef2452{global address} & \href{../exec/runtime.html#syntax-globaladdr}{\mathit{globaladdr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \def\mathdef2452#1{{}}\mathdef2452{element address} & \href{../exec/runtime.html#syntax-elemaddr}{\mathit{elemaddr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \def\mathdef2452#1{{}}\mathdef2452{data address} & \href{../exec/runtime.html#syntax-dataaddr}{\mathit{dataaddr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \def\mathdef2452#1{{}}\mathdef2452{structure address} & \href{../exec/runtime.html#syntax-structaddr}{\mathit{structaddr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \def\mathdef2452#1{{}}\mathdef2452{array address} & \href{../exec/runtime.html#syntax-arrayaddr}{\mathit{arrayaddr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \def\mathdef2452#1{{}}\mathdef2452{host address} & \href{../exec/runtime.html#syntax-hostaddr}{\mathit{hostaddr}} &::=& \href{../exec/runtime.html#syntax-addr}{\mathit{addr}} \\ \end{array}\end{split}\]

An embedder may assign identity to exported store objects corresponding to their addresses, even where this identity is not observable from within WebAssembly code itself (such as for function instances or immutable globals).

Note

Addresses are dynamic, globally unique references to runtime objects, in contrast to indices, which are static, module-local references to their original definitions. A memory address \(\href{../exec/runtime.html#syntax-memaddr}{\mathit{memaddr}}\) denotes the abstract address of a memory instance in the store, not an offset inside a memory instance.

There is no specific limit on the number of allocations of store objects, hence logical addresses can be arbitrarily large natural numbers.

Conventions

  • The notation \(\mathrm{addr}(A)\) denotes the set of addresses from address space \(\mathit{addr}\) occurring free in \(A\). We sometimes reinterpret this set as the vector of its elements.

Module Instances

A module instance is the runtime representation of a module. It is created by instantiating a module, and collects runtime representations of all entities that are imported, defined, or exported by the module.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{module instance} & \href{../exec/runtime.html#syntax-moduleinst}{\mathit{moduleinst}} &::=& \{ \begin{array}[t]{l@{~}ll} \href{../exec/runtime.html#syntax-moduleinst}{\mathsf{types}} & \href{../valid/conventions.html#syntax-deftype}{\mathit{deftype}}^\ast, \\ \href{../exec/runtime.html#syntax-moduleinst}{\mathsf{funcaddrs}} & \href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}}^\ast, \\ \href{../exec/runtime.html#syntax-moduleinst}{\mathsf{tableaddrs}} & \href{../exec/runtime.html#syntax-tableaddr}{\mathit{tableaddr}}^\ast, \\ \href{../exec/runtime.html#syntax-moduleinst}{\mathsf{memaddrs}} & \href{../exec/runtime.html#syntax-memaddr}{\mathit{memaddr}}^\ast, \\ \href{../exec/runtime.html#syntax-moduleinst}{\mathsf{globaladdrs}} & \href{../exec/runtime.html#syntax-globaladdr}{\mathit{globaladdr}}^\ast, \\ \href{../exec/runtime.html#syntax-moduleinst}{\mathsf{elemaddrs}} & \href{../exec/runtime.html#syntax-elemaddr}{\mathit{elemaddr}}^\ast, \\ \href{../exec/runtime.html#syntax-moduleinst}{\mathsf{dataaddrs}} & \href{../exec/runtime.html#syntax-dataaddr}{\mathit{dataaddr}}^\ast, \\ \href{../exec/runtime.html#syntax-moduleinst}{\mathsf{exports}} & \href{../exec/runtime.html#syntax-exportinst}{\mathit{exportinst}}^\ast ~\} \\ \end{array} \end{array}\end{split}\]

Each component references runtime instances corresponding to respective declarations from the original module – whether imported or defined – in the order of their static indices. Function instances, table instances, memory instances, and global instances are referenced with an indirection through their respective addresses in the store.

It is an invariant of the semantics that all export instances in a given module instance have different names.

Function Instances

A function instance is the runtime representation of a function. It effectively is a closure of the original function over the runtime module instance of its originating module. The module instance is used to resolve references to other definitions during execution of the function.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{function instance} & \href{../exec/runtime.html#syntax-funcinst}{\mathit{funcinst}} &::=& \{ \href{../exec/runtime.html#syntax-funcinst}{\mathsf{type}}~\href{../valid/conventions.html#syntax-deftype}{\mathit{deftype}}, \href{../exec/runtime.html#syntax-funcinst}{\mathsf{module}}~\href{../exec/runtime.html#syntax-moduleinst}{\mathit{moduleinst}}, \href{../exec/runtime.html#syntax-funcinst}{\mathsf{code}}~\href{../syntax/modules.html#syntax-func}{\mathit{func}} \} \\ &&|& \{ \href{../exec/runtime.html#syntax-funcinst}{\mathsf{type}}~\href{../valid/conventions.html#syntax-deftype}{\mathit{deftype}}, \href{../exec/runtime.html#syntax-funcinst}{\mathsf{hostcode}}~\href{../exec/runtime.html#syntax-hostfunc}{\mathit{hostfunc}} \} \\ \def\mathdef2452#1{{}}\mathdef2452{host function} & \href{../exec/runtime.html#syntax-hostfunc}{\mathit{hostfunc}} &::=& \dots \\ \end{array}\end{split}\]

A host function is a function expressed outside WebAssembly but passed to a module as an import. The definition and behavior of host functions are outside the scope of this specification. For the purpose of this specification, it is assumed that when invoked, a host function behaves non-deterministically, but within certain constraints that ensure the integrity of the runtime.

Note

Function instances are immutable, and their identity is not observable by WebAssembly code. However, the embedder might provide implicit or explicit means for distinguishing their addresses.

Table Instances

A table instance is the runtime representation of a table. It records its type and holds a vector of reference values.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{table instance} & \href{../exec/runtime.html#syntax-tableinst}{\mathit{tableinst}} &::=& \{ \href{../exec/runtime.html#syntax-tableinst}{\mathsf{type}}~\href{../syntax/types.html#syntax-tabletype}{\mathit{tabletype}}, \href{../exec/runtime.html#syntax-tableinst}{\mathsf{elem}}~\href{../syntax/conventions.html#syntax-vec}{\mathit{vec}}(\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}) \} \\ \end{array}\end{split}\]

Table elements can be mutated through table instructions, the execution of an active element segment, or by external means provided by the embedder.

It is an invariant of the semantics that all table elements have a type matching the element type of \(\href{../syntax/types.html#syntax-tabletype}{\mathit{tabletype}}\). It also is an invariant that the length of the element vector never exceeds the maximum size of \(\href{../syntax/types.html#syntax-tabletype}{\mathit{tabletype}}\), if present.

Memory Instances

A memory instance is the runtime representation of a linear memory. It records its type and holds a vector of bytes.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{memory instance} & \href{../exec/runtime.html#syntax-meminst}{\mathit{meminst}} &::=& \{ \href{../exec/runtime.html#syntax-meminst}{\mathsf{type}}~\href{../syntax/types.html#syntax-memtype}{\mathit{memtype}}, \href{../exec/runtime.html#syntax-meminst}{\mathsf{data}}~\href{../syntax/conventions.html#syntax-vec}{\mathit{vec}}(\href{../syntax/values.html#syntax-byte}{\mathit{byte}}) \} \\ \end{array}\end{split}\]

The length of the vector always is a multiple of the WebAssembly page size, which is defined to be the constant \(65536\) – abbreviated \(64\,\mathrm{Ki}\).

The bytes can be mutated through memory instructions, the execution of an active data segment, or by external means provided by the embedder.

It is an invariant of the semantics that the length of the byte vector, divided by page size, never exceeds the maximum size of \(\href{../syntax/types.html#syntax-memtype}{\mathit{memtype}}\), if present.

Global Instances

A global instance is the runtime representation of a global variable. It records its type and holds an individual value.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{global instance} & \href{../exec/runtime.html#syntax-globalinst}{\mathit{globalinst}} &::=& \{ \href{../exec/runtime.html#syntax-globalinst}{\mathsf{type}}~\href{../syntax/types.html#syntax-globaltype}{\mathit{globaltype}}, \href{../exec/runtime.html#syntax-globalinst}{\mathsf{value}}~\href{../exec/runtime.html#syntax-val}{\mathit{val}} \} \\ \end{array}\end{split}\]

The value of mutable globals can be mutated through variable instructions or by external means provided by the embedder.

It is an invariant of the semantics that the value has a type matching the value type of \(\href{../syntax/types.html#syntax-globaltype}{\mathit{globaltype}}\).

Element Instances

An element instance is the runtime representation of an element segment. It holds a vector of references and their common type.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{element instance} & \href{../exec/runtime.html#syntax-eleminst}{\mathit{eleminst}} &::=& \{ \href{../exec/runtime.html#syntax-eleminst}{\mathsf{type}}~\href{../syntax/types.html#syntax-reftype}{\mathit{reftype}}, \href{../exec/runtime.html#syntax-eleminst}{\mathsf{elem}}~\href{../syntax/conventions.html#syntax-vec}{\mathit{vec}}(\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}) \} \\ \end{array}\end{split}\]

Data Instances

An data instance is the runtime representation of a data segment. It holds a vector of bytes.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{data instance} & \href{../exec/runtime.html#syntax-datainst}{\mathit{datainst}} &::=& \{ \href{../exec/runtime.html#syntax-datainst}{\mathsf{data}}~\href{../syntax/conventions.html#syntax-vec}{\mathit{vec}}(\href{../syntax/values.html#syntax-byte}{\mathit{byte}}) \} \\ \end{array}\end{split}\]

Export Instances

An export instance is the runtime representation of an export. It defines the export’s name and the associated external value.

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{export instance} & \href{../exec/runtime.html#syntax-exportinst}{\mathit{exportinst}} &::=& \{ \href{../exec/runtime.html#syntax-exportinst}{\mathsf{name}}~\href{../syntax/values.html#syntax-name}{\mathit{name}}, \href{../exec/runtime.html#syntax-exportinst}{\mathsf{value}}~\href{../exec/runtime.html#syntax-externval}{\mathit{externval}} \} \\ \end{array}\end{split}\]

External Values

An external value is the runtime representation of an entity that can be imported or exported. It is an address denoting either a function instance, table instance, memory instance, or global instances in the shared store.

\[\begin{split}\begin{array}{llcl} \def\mathdef2452#1{{}}\mathdef2452{external value} & \href{../exec/runtime.html#syntax-externval}{\mathit{externval}} &::=& \href{../exec/runtime.html#syntax-externval}{\mathsf{func}}~\href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}} \\&&|& \href{../exec/runtime.html#syntax-externval}{\mathsf{table}}~\href{../exec/runtime.html#syntax-tableaddr}{\mathit{tableaddr}} \\&&|& \href{../exec/runtime.html#syntax-externval}{\mathsf{mem}}~\href{../exec/runtime.html#syntax-memaddr}{\mathit{memaddr}} \\&&|& \href{../exec/runtime.html#syntax-externval}{\mathsf{global}}~\href{../exec/runtime.html#syntax-globaladdr}{\mathit{globaladdr}} \\ \end{array}\end{split}\]

Conventions

The following auxiliary notation is defined for sequences of external values. It filters out entries of a specific kind in an order-preserving fashion:

  • \(\href{../exec/runtime.html#syntax-externval}{\mathrm{funcs}}(\href{../exec/runtime.html#syntax-externval}{\mathit{externval}}^\ast) = [\href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}} ~|~ (\href{../exec/runtime.html#syntax-externval}{\mathsf{func}}~\href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}}) \in \href{../exec/runtime.html#syntax-externval}{\mathit{externval}}^\ast]\)

  • \(\href{../exec/runtime.html#syntax-externval}{\mathrm{tables}}(\href{../exec/runtime.html#syntax-externval}{\mathit{externval}}^\ast) = [\href{../exec/runtime.html#syntax-tableaddr}{\mathit{tableaddr}} ~|~ (\href{../exec/runtime.html#syntax-externval}{\mathsf{table}}~\href{../exec/runtime.html#syntax-tableaddr}{\mathit{tableaddr}}) \in \href{../exec/runtime.html#syntax-externval}{\mathit{externval}}^\ast]\)

  • \(\href{../exec/runtime.html#syntax-externval}{\mathrm{mems}}(\href{../exec/runtime.html#syntax-externval}{\mathit{externval}}^\ast) = [\href{../exec/runtime.html#syntax-memaddr}{\mathit{memaddr}} ~|~ (\href{../exec/runtime.html#syntax-externval}{\mathsf{mem}}~\href{../exec/runtime.html#syntax-memaddr}{\mathit{memaddr}}) \in \href{../exec/runtime.html#syntax-externval}{\mathit{externval}}^\ast]\)

  • \(\href{../exec/runtime.html#syntax-externval}{\mathrm{globals}}(\href{../exec/runtime.html#syntax-externval}{\mathit{externval}}^\ast) = [\href{../exec/runtime.html#syntax-globaladdr}{\mathit{globaladdr}} ~|~ (\href{../exec/runtime.html#syntax-externval}{\mathsf{global}}~\href{../exec/runtime.html#syntax-globaladdr}{\mathit{globaladdr}}) \in \href{../exec/runtime.html#syntax-externval}{\mathit{externval}}^\ast]\)

Aggregate Instances

A structure instance is the runtime representation of a heap object allocated from a structure type. Likewise, an array instance is the runtime representation of a heap object allocated from an array type. Both record their respective defined type and hold a vector of the values of their fields.

\[\begin{split}\begin{array}{llcl} \def\mathdef2452#1{{}}\mathdef2452{structure instance} & \href{../exec/runtime.html#syntax-structinst}{\mathit{structinst}} &::=& \{ \href{../exec/runtime.html#syntax-structinst}{\mathsf{type}}~\href{../valid/conventions.html#syntax-deftype}{\mathit{deftype}}, \href{../exec/runtime.html#syntax-structinst}{\mathsf{fields}}~\href{../syntax/conventions.html#syntax-vec}{\mathit{vec}}(\href{../exec/runtime.html#syntax-fieldval}{\mathit{fieldval}}) \} \\ \def\mathdef2452#1{{}}\mathdef2452{array instance} & \href{../exec/runtime.html#syntax-arrayinst}{\mathit{arrayinst}} &::=& \{ \href{../exec/runtime.html#syntax-arrayinst}{\mathsf{type}}~\href{../valid/conventions.html#syntax-deftype}{\mathit{deftype}}, \href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}~\href{../syntax/conventions.html#syntax-vec}{\mathit{vec}}(\href{../exec/runtime.html#syntax-fieldval}{\mathit{fieldval}}) \} \\ \def\mathdef2452#1{{}}\mathdef2452{field value} & \href{../exec/runtime.html#syntax-fieldval}{\mathit{fieldval}} &::=& \href{../exec/runtime.html#syntax-val}{\mathit{val}} ~|~ \href{../exec/runtime.html#syntax-packedval}{\mathit{packedval}} \\ \def\mathdef2452#1{{}}\mathdef2452{packed value} & \href{../exec/runtime.html#syntax-packedval}{\mathit{packedval}} &::=& \href{../exec/runtime.html#syntax-packedval}{\mathsf{i8.pack}}~\href{../syntax/values.html#syntax-int}{\mathit{u8}} ~|~ \href{../exec/runtime.html#syntax-packedval}{\mathsf{i16.pack}}~\href{../syntax/values.html#syntax-int}{\mathit{u16}} \\ \end{array}\end{split}\]

Conventions

  • Conversion of a regular value to a field value is defined as follows:

    \[\begin{split}\begin{array}{@{}lcl} \href{../exec/runtime.html#aux-packval}{\mathrm{pack}}_{\href{../syntax/types.html#syntax-valtype}{\mathit{valtype}}}(\href{../exec/runtime.html#syntax-val}{\mathit{val}}) &=& \href{../exec/runtime.html#syntax-val}{\mathit{val}} \\ \href{../exec/runtime.html#aux-packval}{\mathrm{pack}}_{\href{../syntax/types.html#syntax-packedtype}{\mathit{packedtype}}}(\href{../syntax/types.html#syntax-valtype}{\mathsf{i32}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i) &=& \href{../syntax/types.html#syntax-packedtype}{\mathit{packedtype}}.\href{../exec/runtime.html#syntax-packedval}{\mathsf{pack}}~(\href{../exec/numerics.html#op-wrap}{\mathrm{wrap}}_{32,|\href{../syntax/types.html#syntax-packedtype}{\mathit{packedtype}}|}(i)) \end{array}\end{split}\]
  • The inverse conversion of a field value to a regular value is defined as follows:

    \[\begin{split}\begin{array}{@{}lcl} \href{../exec/runtime.html#aux-unpackval}{\mathrm{unpack}}_{\href{../syntax/types.html#syntax-valtype}{\mathit{valtype}}}(\href{../exec/runtime.html#syntax-val}{\mathit{val}}) &=& \href{../exec/runtime.html#syntax-val}{\mathit{val}} \\ \href{../exec/runtime.html#aux-unpackval}{\mathrm{unpack}}^{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}_{\href{../syntax/types.html#syntax-packedtype}{\mathit{packedtype}}}(\href{../syntax/types.html#syntax-packedtype}{\mathit{packedtype}}.\href{../exec/runtime.html#syntax-packedval}{\mathsf{pack}}~i) &=& \href{../syntax/types.html#syntax-valtype}{\mathsf{i32}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~(\href{../exec/numerics.html#op-extend-u}{\mathrm{extend}}^{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}_{|\href{../syntax/types.html#syntax-packedtype}{\mathit{packedtype}}|,32}(i)) \end{array}\end{split}\]

Stack

Besides the store, most instructions interact with an implicit stack. The stack contains three kinds of entries:

These entries can occur on the stack in any order during the execution of a program. Stack entries are described by abstract syntax as follows.

Note

It is possible to model the WebAssembly semantics using separate stacks for operands, control constructs, and calls. However, because the stacks are interdependent, additional book keeping about associated stack heights would be required. For the purpose of this specification, an interleaved representation is simpler.

Values

Values are represented by themselves.

Labels

Labels carry an argument arity \(n\) and their associated branch target, which is expressed syntactically as an instruction sequence:

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{label} & \href{../exec/runtime.html#syntax-label}{\mathit{label}} &::=& \href{../exec/runtime.html#syntax-label}{\mathsf{label}}_n\{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\} \\ \end{array}\end{split}\]

Intuitively, \(\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\) is the continuation to execute when the branch is taken, in place of the original control construct.

Note

For example, a loop label has the form

\[\href{../exec/runtime.html#syntax-label}{\mathsf{label}}_n\{\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{loop}}~\dots~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}}\}\]

When performing a branch to this label, this executes the loop, effectively restarting it from the beginning. Conversely, a simple block label has the form

\[\href{../exec/runtime.html#syntax-label}{\mathsf{label}}_n\{\epsilon\}\]

When branching, the empty continuation ends the targeted block, such that execution can proceed with consecutive instructions.

Activation Frames

Activation frames carry the return arity \(n\) of the respective function, hold the values of its locals (including arguments) in the order corresponding to their static local indices, and a reference to the function’s own module instance:

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{frame} & \href{../exec/runtime.html#syntax-frame}{\mathit{frame}} &::=& \href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}_n\{ \href{../exec/runtime.html#syntax-framestate}{\mathit{framestate}} \} \\ \def\mathdef2452#1{{}}\mathdef2452{frame state} & \href{../exec/runtime.html#syntax-framestate}{\mathit{framestate}} &::=& \{ \href{../exec/runtime.html#syntax-frame}{\mathsf{locals}}~(\href{../exec/runtime.html#syntax-val}{\mathit{val}}^?)^\ast, \href{../exec/runtime.html#syntax-frame}{\mathsf{module}}~\href{../exec/runtime.html#syntax-moduleinst}{\mathit{moduleinst}} \} \\ \end{array}\end{split}\]

Locals may be uninitialized, in which case they are empty. Locals are mutated by respective variable instructions.

Conventions

  • The meta variable \(L\) ranges over labels where clear from context.

  • The meta variable \(F\) ranges over frame states where clear from context.

  • The following auxiliary definition takes a block type and looks up the instruction type that it denotes in the current frame:

\[\begin{split}\begin{array}{llll} \href{../exec/runtime.html#aux-fblocktype}{\mathrm{instrtype}}_{S;F}(\href{../syntax/modules.html#syntax-typeidx}{\mathit{typeidx}}) &=& \href{../syntax/types.html#syntax-functype}{\mathit{functype}} & (\mathrel{\mbox{if}} \href{../valid/conventions.html#aux-expand-deftype}{\mathrm{expand}}(F.\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}.\href{../exec/runtime.html#syntax-moduleinst}{\mathsf{types}}[\href{../syntax/modules.html#syntax-typeidx}{\mathit{typeidx}}]) = \href{../syntax/types.html#syntax-comptype}{\mathsf{func}}~\href{../syntax/types.html#syntax-functype}{\mathit{functype}}) \\ \href{../exec/runtime.html#aux-fblocktype}{\mathrm{instrtype}}_{S;F}([\href{../syntax/types.html#syntax-valtype}{\mathit{valtype}}^?]) &=& [] \mathrel{\href{../valid/conventions.html#syntax-instrtype}{\rightarrow}} [\href{../syntax/types.html#syntax-valtype}{\mathit{valtype}}^?] \\ \end{array}\end{split}\]

Administrative Instructions

Note

This section is only relevant for the formal notation.

In order to express the reduction of traps, calls, and control instructions, the syntax of instructions is extended to include the following administrative instructions:

\[\begin{split}\begin{array}{llcl} \def\mathdef2452#1{{}}\mathdef2452{administrative instruction} & \href{../syntax/instructions.html#syntax-instr}{\mathit{instr}} &::=& \dots \\ &&|& \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\ &&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}i31}}~\href{../syntax/values.html#syntax-int}{\mathit{u31}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}struct}}~\href{../exec/runtime.html#syntax-structaddr}{\mathit{structaddr}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~\href{../exec/runtime.html#syntax-arrayaddr}{\mathit{arrayaddr}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~\href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}host}}~\href{../exec/runtime.html#syntax-hostaddr}{\mathit{hostaddr}} \\&&|& \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}extern}}~\href{../exec/runtime.html#syntax-ref}{\mathit{ref}} \\&&|& \href{../exec/runtime.html#syntax-invoke}{\mathsf{invoke}}~\href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}} \\ &&|& \href{../exec/runtime.html#syntax-return-invoke}{\mathsf{return\_invoke}}~\href{../exec/runtime.html#syntax-funcaddr}{\mathit{funcaddr}} \\ &&|& \href{../exec/runtime.html#syntax-label}{\mathsf{label}}_n\{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\}~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} \\ &&|& \href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}_n\{\href{../exec/runtime.html#syntax-framestate}{\mathit{framestate}}\}~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} \\ \end{array}\end{split}\]

The \(\href{../exec/runtime.html#syntax-trap}{\mathsf{trap}}\) instruction represents the occurrence of a trap. Traps are bubbled up through nested instruction sequences, ultimately reducing the entire program to a single \(\href{../exec/runtime.html#syntax-trap}{\mathsf{trap}}\) instruction, signalling abrupt termination.

The \(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}i31}}\) instruction represents unboxed scalar reference values, \(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}struct}}\) and \(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}\) represent structure and array reference values, respectively, and \(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}\) instruction represents function reference values. Similarly, \(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}host}}\) represents host references and \(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}extern}}\) represents any externalized reference.

The \(\href{../exec/runtime.html#syntax-invoke}{\mathsf{invoke}}\) instruction represents the imminent invocation of a function instance, identified by its address. It unifies the handling of different forms of calls. Analogously, \(\href{../exec/runtime.html#syntax-return-invoke}{\mathsf{return\_invoke}}\) represents the imminent tail invocation of a function instance.

The \(\href{../exec/runtime.html#syntax-label}{\mathsf{label}}\) and \(\href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}\) instructions model labels and frames “on the stack”. Moreover, the administrative syntax maintains the nesting structure of the original structured control instruction or function body and their instruction sequences with an \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}}\) marker. That way, the end of the inner instruction sequence is known when part of an outer sequence.

Note

For example, the reduction rule for \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{block}}\) is:

\[\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{block}}~[t^n]~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} \quad\href{../exec/conventions.html#exec-notation}{\hookrightarrow}\quad \href{../exec/runtime.html#syntax-label}{\mathsf{label}}_n\{\epsilon\}~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}}\]

This replaces the block with a label instruction, which can be interpreted as “pushing” the label on the stack. When \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}}\) is reached, i.e., the inner instruction sequence has been reduced to the empty sequence – or rather, a sequence of \(n\) \(\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}\) instructions representing the resulting values – then the \(\href{../exec/runtime.html#syntax-label}{\mathsf{label}}\) instruction is eliminated courtesy of its own reduction rule:

\[\href{../exec/runtime.html#syntax-label}{\mathsf{label}}_m\{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\}~\href{../exec/runtime.html#syntax-val}{\mathit{val}}^n~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} \quad\href{../exec/conventions.html#exec-notation}{\hookrightarrow}\quad \href{../exec/runtime.html#syntax-val}{\mathit{val}}^n\]

This can be interpreted as removing the label from the stack and only leaving the locally accumulated operand values.

Block Contexts

In order to specify the reduction of branches, the following syntax of block contexts is defined, indexed by the count \(k\) of labels surrounding a hole \([\_]\) that marks the place where the next step of computation is taking place:

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{block contexts} & \href{../exec/runtime.html#syntax-ctxt-block}{B}^0 &::=& \href{../exec/runtime.html#syntax-val}{\mathit{val}}^\ast~[\_]~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast \\ \def\mathdef2452#1{{}}\mathdef2452{block contexts} & \href{../exec/runtime.html#syntax-ctxt-block}{B}^{k+1} &::=& \href{../exec/runtime.html#syntax-val}{\mathit{val}}^\ast~\href{../exec/runtime.html#syntax-label}{\mathsf{label}}_n\{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\}~\href{../exec/runtime.html#syntax-ctxt-block}{B}^k~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}}~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast \\ \end{array}\end{split}\]

This definition allows to index active labels surrounding a branch or return instruction.

Note

For example, the reduction of a simple branch can be defined as follows:

\[\href{../exec/runtime.html#syntax-label}{\mathsf{label}}_0\{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\}~\href{../exec/runtime.html#syntax-ctxt-block}{B}^l[\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l]~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} \quad\href{../exec/conventions.html#exec-notation}{\hookrightarrow}\quad \href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\]

Here, the hole \([\_]\) of the context is instantiated with a branch instruction. When a branch occurs, this rule replaces the targeted label and associated instruction sequence with the label’s continuation. The selected label is identified through the label index \(l\), which corresponds to the number of surrounding \(\href{../exec/runtime.html#syntax-label}{\mathsf{label}}\) instructions that must be hopped over – which is exactly the count encoded in the index of a block context.

Configurations

A configuration consists of the current store and an executing thread.

A thread is a computation over instructions that operates relative to the state of a current frame referring to the module instance in which the computation runs, i.e., where the current function originates from.

\[\begin{split}\begin{array}{llcl} \def\mathdef2452#1{{}}\mathdef2452{configuration} & \href{../exec/runtime.html#syntax-config}{\mathit{config}} &::=& \href{../exec/runtime.html#syntax-store}{\mathit{store}}; \href{../exec/runtime.html#syntax-thread}{\mathit{thread}} \\ \def\mathdef2452#1{{}}\mathdef2452{thread} & \href{../exec/runtime.html#syntax-thread}{\mathit{thread}} &::=& \href{../exec/runtime.html#syntax-framestate}{\mathit{framestate}}; \href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast \\ \end{array}\end{split}\]

Note

The current version of WebAssembly is single-threaded, but configurations with multiple threads may be supported in the future.

Evaluation Contexts

Finally, the following definition of evaluation context and associated structural rules enable reduction inside instruction sequences and administrative forms as well as the propagation of traps:

\[\begin{split}\begin{array}{llll} \def\mathdef2452#1{{}}\mathdef2452{evaluation contexts} & E &::=& [\_] ~|~ \href{../exec/runtime.html#syntax-val}{\mathit{val}}^\ast~E~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast ~|~ \href{../exec/runtime.html#syntax-label}{\mathsf{label}}_n\{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\}~E~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} \\ \end{array}\end{split}\]
\[\begin{split}\begin{array}{rcl} S; F; E[\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast] &\href{../exec/conventions.html#exec-notation}{\hookrightarrow}& S'; F'; E[{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast] \\ && (\mathrel{\mbox{if}} S; F; \href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast \href{../exec/conventions.html#exec-notation}{\hookrightarrow} S'; F'; {\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast) \\ S; F; \href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} &\href{../exec/conventions.html#exec-notation}{\hookrightarrow}& S'; F; \href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}_n\{F''\}~\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'^\ast~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} \\ && (\mathrel{\mbox{if}} S; F'; \href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast \href{../exec/conventions.html#exec-notation}{\hookrightarrow} S'; F''; {\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast) \\[1ex] S; F; E[\href{../exec/runtime.html#syntax-trap}{\mathsf{trap}}] &\href{../exec/conventions.html#exec-notation}{\hookrightarrow}& S; F; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \qquad (\mathrel{\mbox{if}} E \neq [\_]) \\ S; F; \href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}_n\{F'\}~\href{../exec/runtime.html#syntax-trap}{\mathsf{trap}}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{end}} &\href{../exec/conventions.html#exec-notation}{\hookrightarrow}& S; F; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\ \end{array}\end{split}\]

Reduction terminates when a thread’s instruction sequence has been reduced to a result, that is, either a sequence of values or to a \(\href{../exec/runtime.html#syntax-trap}{\mathsf{trap}}\).

Note

The restriction on evaluation contexts rules out contexts like \([\_]\) and \(\epsilon~[\_]~\epsilon\) for which \(E[\href{../exec/runtime.html#syntax-trap}{\mathsf{trap}}] = \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}}\).

For an example of reduction under evaluation contexts, consider the following instruction sequence.

\[(\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~x_1)~(\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~x_2)~\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{neg}}~(\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~x_3)~\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{add}}~\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{mul}}\]

This can be decomposed into \(E[(\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~x_2)~\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{neg}}]\) where

\[E = (\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~x_1)~[\_]~(\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~x_3)~\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{add}}~\href{../syntax/types.html#syntax-valtype}{\mathsf{f64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{mul}}\]

Moreover, this is the only possible choice of evaluation context where the contents of the hole matches the left-hand side of a reduction rule.