GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing webassembly.github.io — Instructions — WebAssembly 3.0 (2026-11-04) Instructions¶WebAssembly computation is performed by executing individual instructions. Parametric Instructions¶\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{nop}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& \href{../syntax/instructions.html#syntax-instr-control}{\mathsf{nop}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{unreachable}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& \href{../syntax/instructions.html#syntax-instr-control}{\mathsf{unreachable}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-parametric}{\mathsf{drop}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~\href{../syntax/instructions.html#syntax-instr-parametric}{\mathsf{drop}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-parametric}{\mathsf{select}}~{({t^\ast})^?}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}_1~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}_2~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~(\href{../syntax/instructions.html#syntax-instr-parametric}{\mathsf{select}}~{({t^\ast})^?}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}_1 & \quad \mbox{if}~ c \neq 0 \\
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}_1~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}_2~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~(\href{../syntax/instructions.html#syntax-instr-parametric}{\mathsf{select}}~{({t^\ast})^?}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}_2 & \quad \mbox{if}~ c = 0 \\
\end{array}\end{split}\]
Note In future versions of WebAssembly, \(\mathsf{select}\) may allow more than one value per choice. Control Instructions¶\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{block}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{m}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{block}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ \epsilon \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{m}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \quad \mbox{if}~ {{\href{../exec/runtime.html#aux-blocktype}{\mathrm{instrtype}}}}_{z}({\mathit{bt}}) = {t_1^{m}} \rightarrow {t_2^{n}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{loop}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{m}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{loop}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{m}}{\{ \href{../syntax/instructions.html#syntax-instr-control}{\mathsf{loop}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{m}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \quad \mbox{if}~ {{\href{../exec/runtime.html#aux-blocktype}{\mathrm{instrtype}}}}_{z}({\mathit{bt}}) = {t_1^{m}} \rightarrow {t_2^{n}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{if}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_1^\ast}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{else}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_2^\ast}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{if}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_1^\ast}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{else}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_2^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{block}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_1^\ast}) & \quad \mbox{if}~ c \neq 0 \\
& (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{if}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_1^\ast}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{else}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_2^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{block}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_2^\ast}) & \quad \mbox{if}~ c = 0 \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}'}^\ast}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l)~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} & \quad \mbox{if}~ l = 0 \\
& ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l)~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l - 1) & \quad \mbox{if}~ l > 0 \\
& ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l)~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_if}}~l\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_if}}~l) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) & \quad \mbox{if}~ c \neq 0 \\
& (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_if}}~l) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{if}~ c = 0 \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_table}}~{l^\ast}~{l'}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_table}}~{l^\ast}~{l'}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~{l^\ast}{}[i]) & \quad \mbox{if}~ i < {|{l^\ast}|} \\
& (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_table}}~{l^\ast}~{l'}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~{l'}) & \quad \mbox{if}~ i \geq {|{l^\ast}|} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_null}}~l\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_null}}~l) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) & \quad \mbox{if}~ {\href{../exec/runtime.html#syntax-val}{\mathit{val}}} = \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \\
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_null}}~l) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-val}{\mathit{val}}} & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_non\_null}}~l\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_non\_null}}~l) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{if}~ {\href{../exec/runtime.html#syntax-val}{\mathit{val}}} = \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \\
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_non\_null}}~l) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_cast}}~l~{\mathit{rt}}_1~{\mathit{rt}}_2\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& s ; f ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_cast}}~l~{\mathit{rt}}_1~{\mathit{rt}}_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) & \quad \mbox{if}~ s \href{../exec/values.html#valid-ref}{\vdash} {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} : {{\href{../exec/types.html#type-inst}{\mathrm{clos}}}}_{f{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}}({\mathit{rt}}_2) \\
& s ; f ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_cast}}~l~{\mathit{rt}}_1~{\mathit{rt}}_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_cast\_fail}}~l~{\mathit{rt}}_1~{\mathit{rt}}_2\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& s ; f ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_cast\_fail}}~l~{\mathit{rt}}_1~{\mathit{rt}}_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} & \quad \mbox{if}~ s \href{../exec/values.html#valid-ref}{\vdash} {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} : {{\href{../exec/types.html#type-inst}{\mathrm{clos}}}}_{f{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}}({\mathit{rt}}_2) \\
& s ; f ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_cast\_fail}}~l~{\mathit{rt}}_1~{\mathit{rt}}_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({{\href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}}_{n}}{\{ f \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}'}^\ast}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}} \\
& ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return}} \\
& ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{funcs}}{}[a]{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{type}}) & \quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}{.}\href{../exec/runtime.html#syntax-moduleinst}{\mathsf{funcs}}{}[x] = a \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~x\)¶Todo (*) Prose not spliced, for the prose merges the two cases of null and non-null references.
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
\end{array}\end{split}\]
Note The formal rule for calling a non-null function reference is described below. \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_indirect}}~x~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_indirect}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}get}}~x)~(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}cast}}~(\href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\href{../syntax/types.html#syntax-reftype}{\mathsf{null}}~y))~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~y) \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{funcs}}{}[a]{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{type}}) & \quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}{.}\href{../exec/runtime.html#syntax-moduleinst}{\mathsf{funcs}}{}[x] = a \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{k}}{\{ {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~y)~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~y) \\
& z ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{k}}{\{ {{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~y)~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~y) \\
& z ; ({{\href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}}_{k}}{\{ f \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~y)~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; ({{\href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}}_{k}}{\{ f \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}'}^\ast}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~y)~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~y) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{funcs}}{}[a]{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{type}} \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{func}}~{t_1^{n}} \href{../syntax/types.html#syntax-comptype}{\rightarrow} {t_2^{m}}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_indirect}}~x~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_indirect}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}get}}~x)~(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}cast}}~(\href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\href{../syntax/types.html#syntax-reftype}{\mathsf{null}}~y))~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return\_call\_ref}}~y) \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{exns}} \mathrel{{=}{\oplus}} {\mathit{exn}}] ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}} & \quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tags}}{}[x]{.}\href{../exec/runtime.html#syntax-taginst}{\mathsf{type}} \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{func}}~{t^{n}} \href{../syntax/types.html#syntax-comptype}{\rightarrow} \epsilon \\
{\land}~ a = {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{exns}}|} \\
{\land}~ {\mathit{exn}} = \{ \href{../exec/runtime.html#syntax-exninst}{\mathsf{tag}}~z{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}{.}\href{../exec/runtime.html#syntax-moduleinst}{\mathsf{tags}}{}[x],\;\allowbreak \href{../exec/runtime.html#syntax-exninst}{\mathsf{fields}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}} \} \\
\end{array} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\[0.8ex]
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast} \neq \epsilon \lor {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast} \neq \epsilon
} \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}} \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}}_{n}}{\{ f \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}} \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ \epsilon \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}} \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{catch}}~x~l)~{{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}'}^\ast} \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{exns}}{}[a]{.}\href{../exec/runtime.html#syntax-exninst}{\mathsf{tag}} = z{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}{.}\href{../exec/runtime.html#syntax-moduleinst}{\mathsf{tags}}{}[x] \\
{\land}~ {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast} = z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{exns}}{}[a]{.}\href{../exec/runtime.html#syntax-exninst}{\mathsf{fields}} \\
\end{array}
} \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{catch\_ref}}~x~l)~{{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}'}^\ast} \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{exns}}{}[a]{.}\href{../exec/runtime.html#syntax-exninst}{\mathsf{tag}} = z{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}{.}\href{../exec/runtime.html#syntax-moduleinst}{\mathsf{tags}}{}[x] \\
{\land}~ {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast} = z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{exns}}{}[a]{.}\href{../exec/runtime.html#syntax-exninst}{\mathsf{fields}} \\
\end{array}
} \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{catch\_all}}~l)~{{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}'}^\ast} \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ (\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{catch\_all\_ref}}~l)~{{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}'}^\ast} \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br}}~l) \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ {\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}~{{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}'}^\ast} \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}'}^\ast} \}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}exn}}~a)~\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{otherwise}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{try\_table}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{m}}~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{try\_table}}~{\mathit{bt}}~{{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast} \}}~({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ \epsilon \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{m}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast})) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {{\href{../exec/runtime.html#aux-blocktype}{\mathrm{instrtype}}}}_{z}({\mathit{bt}}) = {t_1^{m}} \rightarrow {t_2^{n}}
} \\
\end{array}\end{split}\]
Blocks¶The following auxiliary rules define the semantics of executing an instruction sequence that forms a block. Entering \(\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\) with label \(L\) and values \(\href{../exec/runtime.html#syntax-val}{\mathit{val}}^\ast\)¶
Note No formal reduction rule is needed for entering an instruction sequence, because the label \(L\) is embedded in the administrative instruction that structured control instructions reduce to directly. Exiting \(\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\) with label \(L\)¶When the end of a block is reached without a jump, exception, or trap aborting it, then the following steps are performed.
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast} \\
\end{array}\end{split}\]
Note This semantics also applies to the instruction sequence contained in a \(\mathsf{loop}\) instruction. Therefore, execution of a loop falls off the end, unless a backwards branch is performed explicitly. Exception Handling¶The following auxiliary rules define the semantics of entering and exiting \(\mathsf{try\_table}\) blocks. Entering \(\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}^\ast\) with label \(L\) and exception handler \(H\)¶
Note No formal reduction rule is needed for entering an exception handler because it is an administrative instruction that the \(\mathsf{try\_table}\) instruction reduces to directly. Exiting an exception handler¶When the end of a \(\mathsf{try\_table}\) block is reached without a jump, exception, or trap, then the following steps are performed.
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast} \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast} \\
\end{array}\end{split}\]
Function Calls¶The following auxiliary rules define the semantics of invoking a function instance through one of the call instructions and returning from it. Invocation of function reference \((\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; ({{\href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}}_{m}}{\{ f \}}~({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{m}}{\{ \epsilon \}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast})) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{funcs}}{}[a] = {\mathit{fi}} \\
{\land}~ {\mathit{fi}}{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{type}} \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{func}}~{t_1^{n}} \href{../syntax/types.html#syntax-comptype}{\rightarrow} {t_2^{m}} \\
{\land}~ {\mathit{fi}}{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{code}} = \href{../syntax/modules.html#syntax-func}{\mathsf{func}}~x~{(\href{../syntax/modules.html#syntax-local}{\mathsf{local}}~t)^\ast}~({{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) \\
{\land}~ f = \{ \href{../exec/runtime.html#syntax-frame}{\mathsf{locals}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~{({{\href{../exec/runtime.html#aux-default}{\mathrm{default}}}}_{t})^\ast},\;\allowbreak \href{../exec/runtime.html#syntax-frame}{\mathsf{module}}~{\mathit{fi}}{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{module}} \} \\
\end{array}
} \\
\end{array}\end{split}\]
Note For non-defaultable types, the respective local is left uninitialized by these rules. Returning from a function¶When the end of a function is reached without a jump (including through \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{return}}\)), or an exception or trap aborting it, then the following steps are performed.
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({{\href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}}_{n}}{\{ f \}}~{{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}} \\
\end{array}\end{split}\]
Host Functions¶Invoking a host function has non-deterministic behavior. It may either terminate with a trap, an exception, or return regularly. However, in the latter case, it must consume and produce the right number and types of WebAssembly values on the stack, according to its function type. A host function may also modify the store. However, all store modifications must result in an extension of the original store, i.e., they must only modify mutable contents and must not have instances removed. Furthermore, the resulting store must be valid, i.e., all data and code in it is well-typed.
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& s ; f ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {s'} ; f ; {\href{../exec/runtime.html#syntax-result}{\mathit{result}}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ s{.}\href{../exec/runtime.html#syntax-store}{\mathsf{funcs}}{}[a] = {\mathit{fi}} \\
{\land}~ {\mathit{fi}}{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{type}} \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{func}}~{t_1^{n}} \href{../syntax/types.html#syntax-comptype}{\rightarrow} {t_2^{m}} \\
{\land}~ {\mathit{fi}}{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{code}} = {\mathit{hf}} \\
{\land}~ ({s'}, {\href{../exec/runtime.html#syntax-result}{\mathit{result}}}) \in {{\mathit{hf}}}{(s, {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}})} \\
\end{array}
} \\
& s ; f ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & s ; f ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~a)~(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}~y) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ s{.}\href{../exec/runtime.html#syntax-store}{\mathsf{funcs}}{}[a] = {\mathit{fi}} \\
{\land}~ {\mathit{fi}}{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{type}} \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{func}}~{t_1^{n}} \href{../syntax/types.html#syntax-comptype}{\rightarrow} {t_2^{m}} \\
{\land}~ {\mathit{fi}}{.}\href{../exec/runtime.html#syntax-funcinst}{\mathsf{code}} = {\mathit{hf}} \\
{\land}~ \bot \in {{\mathit{hf}}}{(s, {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}})} \\
\end{array}
} \\
\end{array}\end{split}\]
Here, \({{\mathit{hf}}}{(s, {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}})}\) denotes the implementation-defined execution of host function \({\mathit{hf}}\) in current store \(s\) with arguments \({{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}\). It yields a set of possible outcomes, where each element is either a pair of a modified store \({s'}\) and a result or the special value \(\bot\) indicating divergence. A host function is non-deterministic if there is at least one argument for which the set of outcomes is not singular. For a WebAssembly implementation to be sound in the presence of host functions, every host function instance must be valid, which means that it adheres to suitable pre- and post-conditions: under a valid store \(s\), and given arguments \({{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}\) matching the ascribed parameter types \({t_1^{n}}\), executing the host function must yield a non-empty set of possible outcomes each of which is either divergence or consists of a valid store \({s'}\) that is an extension of \(s\) and a result matching the ascribed return types \({t_2^{m}}\). All these notions are made precise in the Appendix. Variable Instructions¶\(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{local{.}get}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{local{.}get}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-val}{\mathit{val}}} & \quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{locals}}{}[x] = {\href{../exec/runtime.html#syntax-val}{\mathit{val}}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{local{.}set}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{local{.}set}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{locals}}{}[x] = {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}] ; \epsilon \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{local{.}tee}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{local{.}tee}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{local{.}set}}~x) \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{global{.}get}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{global{.}get}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-val}{\mathit{val}}} & \quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{globals}}{}[x]{.}\href{../exec/runtime.html#syntax-globalinst}{\mathsf{value}} = {\href{../exec/runtime.html#syntax-val}{\mathit{val}}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{global{.}set}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{global{.}set}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{globals}}{}[x]{.}\href{../exec/runtime.html#syntax-globalinst}{\mathsf{value}} = {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}] ; \epsilon \\
\end{array}\end{split}\]
Table Instructions¶\(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}get}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}get}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i \geq {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}get}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}{}[i] & \quad \mbox{if}~ i < {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}set}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}set}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i \geq {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}set}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}{}[i] = {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}] ; \epsilon & \quad \mbox{if}~ i < {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}size}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}size}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n) & \quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|} = n \\
{\land}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{type}} = {\mathit{at}}~{\mathit{lim}}~{\mathit{rt}} \\
\end{array} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}grow}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}grow}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x] = {\mathit{ti}}] ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|}) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {\mathit{ti}} = {\href{../exec/modules.html#grow-table}{\mathrm{growtable}}}(z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x], n, {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}})
} \\
& z ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}grow}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{{{{\href{../exec/numerics.html#aux-signed}{\mathrm{signed}}}}_{{|{\mathit{at}}|}}^{{-1}}}}{({-1})}) \\
\end{array}\end{split}\]
Note The \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}grow}}\) instruction is non-deterministic. It may either succeed, returning the old table size \(\mathit{sz}\), or fail, returning \({-1}\). Failure must occur if the referenced table instance has a maximum size defined that would be exceeded. However, failure can occur in other cases as well. In practice, the choice depends on the resources available to the embedder. \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}fill}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{otherwise, if}~ n = 0 \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}set}}~x) \\
({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i + 1)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}fill}}~x) \end{array} & \quad \mbox{otherwise} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}copy}}~x_1~x_2\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ i_1 + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x_1]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|} \lor i_2 + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x_2]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|}
} \\
& z ; ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}copy}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{otherwise, if}~ n = 0 \\
& z ; ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}copy}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}get}}~y)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}set}}~x) \\
({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1 + 1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2 + 1)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}copy}}~x~y) \end{array} & \quad \mbox{otherwise, if}~ i_1 \leq i_2 \\
\end{array}
} \\
& z ; ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}copy}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1 + n - 1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2 + n - 1)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}get}}~y)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}set}}~x) \\
({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}copy}}~x~y) \end{array} & \quad \mbox{otherwise} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}init}}~x~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}init}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ i + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{tables}}{}[x]{.}\href{../exec/runtime.html#syntax-tableinst}{\mathsf{refs}}|} \lor j + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{elems}}{}[y]{.}\href{../exec/runtime.html#syntax-eleminst}{\mathsf{refs}}|}
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}init}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{otherwise, if}~ n = 0 \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}init}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{elems}}{}[y]{.}\href{../exec/runtime.html#syntax-eleminst}{\mathsf{refs}}{}[j]~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}set}}~x) \\
({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i + 1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j + 1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table{.}init}}~x~y) \end{array} & \quad \mbox{otherwise} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{elem{.}drop}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{elem{.}drop}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{elems}}{}[x]{.}\href{../exec/runtime.html#syntax-eleminst}{\mathsf{refs}} = \epsilon] ; \epsilon \\
\end{array}\end{split}\]
Memory Instructions¶Note The alignment \(\href{../syntax/instructions.html#syntax-memarg}{\mathit{memarg}}.\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{align}}\) in load and store instructions does not affect the semantics. It is a hint that the offset \(\mathit{ea}\) at which the memory is accessed is intended to satisfy the property \(\mathit{ea} \mathbin{\mathrm{mod}} 2^{\href{../syntax/instructions.html#syntax-memarg}{\mathit{memarg}}.\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{align}}} = 0\). A WebAssembly implementation can use this hint to optimize for the intended use. Unaligned access violating that property is still allowed and must succeed regardless of the annotation. However, it may be substantially slower on some hardware. \({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}~x~{\mathit{ao}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + {|{\mathit{nt}}|} / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|}
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\mathit{nt}}}(c) = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : {|{\mathit{nt}}|} / 8]
} \\
\end{array}\end{split}\]
\({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{n}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}~x~{\mathit{ao}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{n}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + n / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|}
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{n}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{{{{\href{../exec/numerics.html#op-extend}{\mathrm{extend}}}}_{n, {|{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}|}}^{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}}{(c)}) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{n}}(c) = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : n / 8]
} \\
\end{array}\end{split}\]
\(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}~x~{\mathit{ao}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + {|\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}|} / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}}(c) = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : {|\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}|} / 8] \\
\end{array}\end{split}\]
\({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{K}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}~x~{\mathit{ao}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{K}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + K \cdot M / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{K}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ ({{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{K}}(j) = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + k \cdot K / 8 : K / 8])^{k<M} \\
{\land}~ c = {{{{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}^{{-1}}}}{({{{{{\href{../exec/numerics.html#op-extend}{\mathrm{extend}}}}_{K, N}^{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}}{(j)}^{M}})} \land N = K \cdot 2 \\
\end{array}
} \\
\end{array}\end{split}\]
\({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{splat}}}}~x~{\mathit{ao}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{splat}}}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + N / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{splat}}}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{N}}(j) = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : N / 8] \\
{\land}~ N = {|{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}|} \\
{\land}~ M = 128 / N \\
{\land}~ c = {{{{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}^{{-1}}}}{({j^{M}})} \\
\end{array}
} \\
\end{array}\end{split}\]
\({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{zero}}}}~x~{\mathit{ao}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{zero}}}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + N / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{zero}}}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{N}}(j) = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : N / 8] \\
{\land}~ c = {{{{\href{../exec/numerics.html#op-extend}{\mathrm{extend}}}}_{N, 128}^{\href{../syntax/instructions.html#syntax-sx}{\mathsf{u}}}}}{(j)} \\
\end{array}
} \\
\end{array}\end{split}\]
\({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{lane}}}~x~{\mathit{ao}}~j\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{lane}}}~x~{\mathit{ao}}~j) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + N / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{lane}}}~x~{\mathit{ao}}~j) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{N}}(k) = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : N / 8] \\
{\land}~ N = {|{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}|} \\
{\land}~ M = {|\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}|} / N \\
{\land}~ c = {{{{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}^{{-1}}}}{({{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}(c_1){}[{}[j] = k])} \\
\end{array}
} \\
\end{array}\end{split}\]
\({{\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{{{\href{../syntax/instructions.html#syntax-storeop}{\mathit{storeop}}}^?}}~x~{\mathit{ao}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + {|{\mathit{nt}}|} / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|}
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : {|{\mathit{nt}}|} / 8] = {b^\ast}] ; \epsilon & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {b^\ast} = {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\mathit{nt}}}(c)
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{n}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + n / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|}
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{n}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : n / 8] = {b^\ast}] ; \epsilon & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {b^\ast} = {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{n}}({{\href{../exec/numerics.html#op-wrap}{\mathrm{wrap}}}}_{{|{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}|}, n}(c))
} \\
\end{array}\end{split}\]
\(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}~x~{\mathit{ao}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + {|\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}|} / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|}
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}~x~{\mathit{ao}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : {|\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}|} / 8] = {b^\ast}] ; \epsilon & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {b^\ast} = {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}}(c)
} \\
\end{array}\end{split}\]
\({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{lane}}}~x~{\mathit{ao}}~j\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{lane}}}~x~{\mathit{ao}}~j) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} + N / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|}
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c)~({\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{N}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{lane}}}~x~{\mathit{ao}}~j) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}{}[i + {\mathit{ao}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{offset}} : N / 8] = {b^\ast}] ; \epsilon & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ N = {|{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}|} \\
{\land}~ M = 128 / N \\
{\land}~ {b^\ast} = {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{N}}({{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}(c){}[j]) \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}size}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}size}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n) & \quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ n \cdot 64 \, {\mathrm{Ki}} = {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \\
{\land}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{type}} = {\mathit{at}}~{\mathit{lim}}~\href{../syntax/types.html#syntax-memtype}{\mathsf{page}} \\
\end{array} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}grow}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}grow}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x] = {\mathit{mi}}] ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} / 64 \, {\mathrm{Ki}}) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {\mathit{mi}} = {\href{../exec/modules.html#grow-mem}{\mathrm{growmem}}}(z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x], n)
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}grow}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{{{{\href{../exec/numerics.html#aux-signed}{\mathrm{signed}}}}_{{|{\mathit{at}}|}}^{{-1}}}}{({-1})}) \\
\end{array}\end{split}\]
Note The \(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}grow}}\) instruction is non-deterministic. It may either succeed, returning the old memory size \(\mathit{sz}\), or fail, returning \({-1}\). Failure must occur if the referenced memory instance has a maximum size defined that would be exceeded. However, failure can occur in other cases as well. In practice, the choice depends on the resources available to the embedder. \(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}fill}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{otherwise, if}~ n = 0 \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{\mathsf{{\scriptstyle 8}}}~x) \\
({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i + 1)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}fill}}~x) \end{array} & \quad \mbox{otherwise} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}copy}}~x_1~x_2\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ i_1 + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x_1]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \lor i_2 + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x_2]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|}
} \\
& z ; ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{otherwise, if}~ n = 0 \\
& z ; ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{\mathsf{{\scriptstyle 8}}}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-sx}{\mathsf{u}}}}~x_2)~({\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{\mathsf{{\scriptstyle 8}}}~x_1) \\
({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1 + 1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2 + 1)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}copy}}~x_1~x_2) \end{array} & \quad \mbox{otherwise, if}~ i_1 \leq i_2 \\
\end{array}
} \\
& z ; ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} ({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1 + n - 1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2 + n - 1)~({\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}}{{\mathsf{{\scriptstyle 8}}}{\mathsf{\_}}{\href{../syntax/instructions.html#syntax-sx}{\mathsf{u}}}}~x_2)~({\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{\mathsf{{\scriptstyle 8}}}~x_1) \\
({\mathit{at}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~({\mathit{at}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~({\mathit{at}'}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}copy}}~x_1~x_2) \end{array} & \quad \mbox{otherwise} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}init}}~x~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}init}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ i + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{mems}}{}[x]{.}\href{../exec/runtime.html#syntax-meminst}{\mathsf{bytes}}|} \lor j + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{datas}}{}[y]{.}\href{../exec/runtime.html#syntax-datainst}{\mathsf{bytes}}|}
} \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}init}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{otherwise, if}~ n = 0 \\
& z ; ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}init}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} ({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{datas}}{}[y]{.}\href{../exec/runtime.html#syntax-datainst}{\mathsf{bytes}}{}[j])~({\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}}{\mathsf{{\scriptstyle 8}}}~x) \\
({\mathit{at}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i + 1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j + 1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory{.}init}}~x~y) \end{array} & \quad \mbox{otherwise} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{data{.}drop}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{data{.}drop}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{datas}}{}[x]{.}\href{../exec/runtime.html#syntax-datainst}{\mathsf{bytes}} = \epsilon] ; \epsilon \\
\end{array}\end{split}\]
Reference Instructions¶\(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}null}}~{\mathit{ht}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}null}}~{\mathit{ht}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}func}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}func}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}func}}~z{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}{.}\href{../exec/runtime.html#syntax-moduleinst}{\mathsf{funcs}}{}[x]) \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}is\_null}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}is\_null}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~1) & \quad \mbox{if}~ {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} = \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \\
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}is\_null}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~0) & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}as\_non\_null}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}as\_non\_null}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} = \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \\
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}as\_non\_null}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}eq}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_1~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_2~\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}eq}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~1) & \quad \mbox{if}~ {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_1 = \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \land {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_2 = \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \\
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_1~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_2~\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}eq}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~1) & \quad \mbox{otherwise, if}~ {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_1 = {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_2 \\
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_1~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}_2~\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}eq}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~0) & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}test}}~{\mathit{rt}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& s ; f ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}test}}~{\mathit{rt}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~1) & \quad \mbox{if}~ s \href{../exec/values.html#valid-ref}{\vdash} {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} : {{\href{../exec/types.html#type-inst}{\mathrm{clos}}}}_{f{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}}({\mathit{rt}}) \\
& s ; f ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}test}}~{\mathit{rt}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~0) & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}cast}}~{\mathit{rt}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& s ; f ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}cast}}~{\mathit{rt}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} & \quad \mbox{if}~ s \href{../exec/values.html#valid-ref}{\vdash} {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} : {{\href{../exec/types.html#type-inst}{\mathrm{clos}}}}_{f{.}\href{../exec/runtime.html#syntax-frame}{\mathsf{module}}}({\mathit{rt}}) \\
& s ; f ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}cast}}~{\mathit{rt}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-i31}{\mathsf{ref{.}i\scriptstyle31}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~\href{../syntax/instructions.html#syntax-instr-i31}{\mathsf{ref{.}i\scriptstyle31}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}i\scriptstyle31}}~{{\href{../exec/numerics.html#op-wrap}{\mathrm{wrap}}}}_{32, 31}(i)) \\
\end{array}\end{split}\]
\({\href{../syntax/instructions.html#syntax-instr-i31}{\mathsf{i{\scriptstyle31}{.}get}}}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~({\href{../syntax/instructions.html#syntax-instr-i31}{\mathsf{i{\scriptstyle31}{.}get}}}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}i\scriptstyle31}}~i)~({\href{../syntax/instructions.html#syntax-instr-i31}{\mathsf{i{\scriptstyle31}{.}get}}}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{{{{\href{../exec/numerics.html#op-extend}{\mathrm{extend}}}}_{31, 32}^{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}}{(i)}) \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}new}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}new}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{structs}} \mathrel{{=}{\oplus}} {\mathit{si}}] ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}struct}}~a) & \quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{struct}}~{({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}})^{n}} \\
{\land}~ a = {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{structs}}|} \\
{\land}~ {\mathit{si}} = \{ \href{../exec/runtime.html#syntax-structinst}{\mathsf{type}}~z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x],\;\allowbreak \href{../exec/runtime.html#syntax-structinst}{\mathsf{fields}}~{({{\href{../exec/runtime.html#aux-packfield}{\mathrm{pack}}}}_{{\mathit{zt}}}({\href{../exec/runtime.html#syntax-val}{\mathit{val}}}))^{n}} \} \\
\end{array} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}new\_default}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}new\_default}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}new}}~x) & \quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{struct}}~{({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}})^\ast} \\
{\land}~ ({{\href{../exec/runtime.html#aux-default}{\mathrm{default}}}}_{{\href{../syntax/types.html#aux-unpack}{\mathrm{unpack}}}({\mathit{zt}})} = {\href{../exec/runtime.html#syntax-val}{\mathit{val}}})^\ast \\
\end{array} \\
\end{array}\end{split}\]
\({\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x~i\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~({\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x~i) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}struct}}~a)~({\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x~i) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{{{\href{../exec/runtime.html#aux-unpackfield}{\mathrm{unpack}}}}_{{{\mathit{zt}}^\ast}{}[i]}^{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}}}{(z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{structs}}{}[a]{.}\href{../exec/runtime.html#syntax-structinst}{\mathsf{fields}}{}[i])} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{struct}}~{({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}})^\ast}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}set}}~x~i\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}set}}~x~i) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}struct}}~a)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct{.}set}}~x~i) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{structs}}{}[a]{.}\href{../exec/runtime.html#syntax-structinst}{\mathsf{fields}}{}[i] = {{\href{../exec/runtime.html#aux-packfield}{\mathrm{pack}}}}_{{{\mathit{zt}}^\ast}{}[i]}({\href{../exec/runtime.html#syntax-val}{\mathit{val}}})] ; \epsilon & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{struct}}~{({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}})^\ast}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_fixed}}~x~n) \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_default}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_default}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_fixed}}~x~n) & \quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}}) \\
{\land}~ {{\href{../exec/runtime.html#aux-default}{\mathrm{default}}}}_{{\href{../syntax/types.html#aux-unpack}{\mathrm{unpack}}}({\mathit{zt}})} = {\href{../exec/runtime.html#syntax-val}{\mathit{val}}} \\
\end{array} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_fixed}}~x~n\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^{n}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_fixed}}~x~n) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{arrays}} \mathrel{{=}{\oplus}} {\mathit{ai}}] ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}}) \\
{\land}~ a = {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}|} \land {\mathit{ai}} = \{ \href{../exec/runtime.html#syntax-arrayinst}{\mathsf{type}}~z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x],\;\allowbreak \href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}~{({{\href{../exec/runtime.html#aux-packfield}{\mathrm{pack}}}}_{{\mathit{zt}}}({\href{../exec/runtime.html#syntax-val}{\mathit{val}}}))^{n}} \} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_data}}~x~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_data}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}}) \\
{\land}~ i + n \cdot {|{\mathit{zt}}|} / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{datas}}{}[y]{.}\href{../exec/runtime.html#syntax-datainst}{\mathsf{bytes}}|} \\
\end{array}
} \\
& z ; (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_data}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {({\href{../syntax/types.html#aux-unpack}{\mathrm{unpack}}}({\mathit{zt}}){.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{{\href{../exec/numerics.html#aux-unpacknum}{\mathrm{unpack}}}}_{{\mathit{zt}}}(c))^{n}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_fixed}}~x~n) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}}) \\
{\land}~ {\href{../syntax/conventions.html#notation-concat}{\bigoplus}}\, {{{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\mathit{zt}}}(c)^{n}} = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{datas}}{}[y]{.}\href{../exec/runtime.html#syntax-datainst}{\mathsf{bytes}}{}[i : n \cdot {|{\mathit{zt}}|} / 8] \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_elem}}~x~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_elem}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{elems}}{}[y]{.}\href{../exec/runtime.html#syntax-eleminst}{\mathsf{refs}}|} \\
& z ; (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_elem}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}^{n}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}new\_fixed}}~x~n) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}^{n}} = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{elems}}{}[y]{.}\href{../exec/runtime.html#syntax-eleminst}{\mathsf{refs}}{}[i : n]
} \\
\end{array}\end{split}\]
\({\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i \geq {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}|} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {{{{\href{../exec/runtime.html#aux-unpackfield}{\mathrm{unpack}}}}_{{\mathit{zt}}}^{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}}}{(z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}{}[i])} & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}})
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z ; \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i \geq {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}|} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & z{}[{.}\href{../exec/runtime.html#syntax-state}{\mathsf{arrays}}{}[a]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}{}[i] = {{\href{../exec/runtime.html#aux-packfield}{\mathrm{pack}}}}_{{\mathit{zt}}}({\href{../exec/runtime.html#syntax-val}{\mathit{val}}})] ; \epsilon & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}})
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}len}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}len}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}len}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}|}) \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}fill}}~x\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ i + n > {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}|} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \quad \mbox{otherwise, if}~ n = 0 \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}fill}}~x) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x) \\
(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i + 1)~{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}fill}}~x) \end{array} & \quad \mbox{otherwise} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ i_1 + n > {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a_1]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}|}
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ i_2 + n > {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a_2]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}|}
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{otherwise, if}~ n = 0
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1) \\
(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2) \\
({\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x_2)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x_1) \\
(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1 + 1)~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2 + 1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) \end{array} & & \\
\multicolumn{3}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}}
\quad
\begin{array}[t]{@{}l@{}}
\mbox{otherwise, if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x_2] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}}_2) \\
{\land}~ i_1 \leq i_2 \land {{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?} = {\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}({\mathit{zt}}_2) \\
\end{array} \\
\end{array}
} \\
\end{array}
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1 + n - 1) \\
(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2 + n - 1) \\
({\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}get}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?}}~x_2)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x_1) \\
(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_1)~(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i_2)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}copy}}~x_1~x_2) \end{array} & & \\
\multicolumn{3}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}}
\quad
\begin{array}[t]{@{}l@{}}
\mbox{otherwise, if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x_2] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}}_2) \\
{\land}~ {{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}^?} = {\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}({\mathit{zt}}_2) \\
\end{array} \\
\end{array}
} \\
\end{array}
} \\
\end{array}\end{split}\]
Where:
\[\begin{split}\begin{array}[t]{@{}lcl@{}l@{}}
{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}({\href{../syntax/types.html#syntax-valtype}{\mathit{valtype}}}) & = & \epsilon \\
{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}({\href{../syntax/types.html#syntax-packtype}{\mathit{packtype}}}) & = & \href{../syntax/instructions.html#syntax-sx}{\mathsf{s}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_data}}~x~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_data}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_data}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ i + n > {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}|}
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_data}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}}) \\
{\land}~ j + n \cdot {|{\mathit{zt}}|} / 8 > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{datas}}{}[y]{.}\href{../exec/runtime.html#syntax-datainst}{\mathsf{bytes}}|} \\
\end{array}
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_data}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{otherwise, if}~ n = 0
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_data}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\href{../syntax/types.html#aux-unpack}{\mathrm{unpack}}}({\mathit{zt}}){.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~{{\href{../exec/numerics.html#aux-unpacknum}{\mathrm{unpack}}}}_{{\mathit{zt}}}(c))~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x) \\
(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i + 1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j + {|{\mathit{zt}}|} / 8)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_data}}~x~y) \end{array} & & \\
\multicolumn{3}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}}
\quad
\begin{array}[t]{@{}l@{}}
\mbox{otherwise, if}~ z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{types}}{}[x] \mathrel{\href{../valid/conventions.html#aux-expand-deftype}{\approx}} \href{../syntax/types.html#syntax-comptype}{\mathsf{array}}~({\href{../syntax/types.html#syntax-mut}{\mathsf{mut}}^?}~{\mathit{zt}}) \\
{\land}~ {{\href{../exec/numerics.html#aux-bytes}{\mathrm{bytes}}}}_{{\mathit{zt}}}(c) = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{datas}}{}[y]{.}\href{../exec/runtime.html#syntax-datainst}{\mathsf{bytes}}{}[j : {|{\mathit{zt}}|} / 8] \\
\end{array} \\
\end{array}
} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_elem}}~x~y\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_elem}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_elem}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ i + n > {|z{.}\href{../exec/runtime.html#syntax-store}{\mathsf{arrays}}{}[a]{.}\href{../exec/runtime.html#syntax-arrayinst}{\mathsf{fields}}|}
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_elem}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ j + n > {|z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{elems}}{}[y]{.}\href{../exec/runtime.html#syntax-eleminst}{\mathsf{refs}}|}
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_elem}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \epsilon & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{otherwise, if}~ n = 0
} \\
& z ; (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_elem}}~x~y) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & & \\
& \multicolumn{4}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}l@{}l@{}}
\begin{array}[t]{@{}l@{}} (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}set}}~x) \\
(\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}array}}~a)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i + 1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~j + 1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~n - 1)~(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array{.}init\_elem}}~x~y) \end{array} & & \\
\multicolumn{3}{@{}l@{}}{\quad
\begin{array}[t]{@{}l@{}}
\quad \mbox{otherwise, if}~ {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} = z{.}\href{../exec/runtime.html#syntax-state}{\mathsf{elems}}{}[y]{.}\href{../exec/runtime.html#syntax-eleminst}{\mathsf{refs}}{}[j] \\
\end{array}
} \\
\end{array}
} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{any{.}convert\_extern}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}})~\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{any{.}convert\_extern}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \\
& (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}extern}}~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}})~\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{any{.}convert\_extern}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} \\
\end{array}\end{split}\]
\(\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{extern{.}convert\_any}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{extern{.}convert\_any}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} & \quad \mbox{if}~ {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}} = \href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}null}} \\
& {\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}~\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{extern{.}convert\_any}} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../exec/runtime.html#syntax-ref}{\mathsf{ref{.}extern}}~{\href{../exec/runtime.html#syntax-ref}{\mathit{ref}}}) & \quad \mbox{otherwise} \\
\end{array}\end{split}\]
Numeric Instructions¶Numeric instructions are defined in terms of the generic numeric operators. The mapping of numeric instructions to their underlying operators is expressed by the following definition:
\[\begin{split}\begin{array}{lll@{\qquad}l}
\mathit{op}_{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}\scriptstyle\kern-0.1emN}}(i_1,\dots,i_k) &=& \href{../Step_pure/numerics.html#int-ops}{\mathrm{i}\mathit{op}}_N(i_1,\dots,i_k) \\
\mathit{op}_{\href{../syntax/types.html#syntax-numtype}{\mathsf{f}\scriptstyle\kern-0.1emN}}(z_1,\dots,z_k) &=& \href{../Step_pure/numerics.html#float-ops}{\mathrm{f}\mathit{op}}_N(z_1,\dots,z_k) \\
\end{array}\end{split}\]
And for conversion operators:
\[\begin{split}\begin{array}{lll@{\qquad}l}
\href{../syntax/instructions.html#syntax-cvtop}{\mathit{cvtop}}^{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}^?}_{t_1,t_2}(c) &=& \href{../Step_pure/numerics.html#convert-ops}{\mathit{cvtop}}^{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}^?}_{|t_1|,|t_2|}(c) \\
\end{array}\end{split}\]
Where the underlying operators are partial, the corresponding instruction will trap when the result is not defined. Where the underlying operators are non-deterministic, because they may return one of multiple possible NaN values, so are the corresponding instructions. Note For example, the result of instruction \(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{add}}\) applied to operands \(i_1, i_2\) invokes \(\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{add}}_{\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}}(i_1, i_2)\), which maps to the generic \(\href{../exec/numerics.html#op-iadd}{\mathrm{iadd}}_{32}(i_1, i_2)\) via the above definition. Similarly, \(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle64}}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{trunc}}\mathsf{\_}\href{../syntax/types.html#syntax-numtype}{\mathsf{f\scriptstyle32}}\mathsf{\_s}\) applied to \(z\) invokes \(\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{trunc}}^{\mathsf{s}}_{\href{../syntax/types.html#syntax-numtype}{\mathsf{f\scriptstyle32}},\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle64}}}(z)\), which maps to the generic \(\href{../exec/numerics.html#op-trunc}{\mathrm{trunc}^{\mathsf{s}}}_{32,64}(z)\). \(\mathit{nt}\mathsf{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c\)¶
Note No formal reduction rule is required for this instruction, since \(\mathsf{const}\) instructions already are values. \({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-unop}{\mathit{unop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-unop}{\mathit{unop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-unop}{\mathit{unop}}}}{{}_{{\mathit{nt}}}(c_1)} \\
& ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-unop}{\mathit{unop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-unop}{\mathit{unop}}}}{{}_{{\mathit{nt}}}(c_1)} = \epsilon \\
\end{array}\end{split}\]
\({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-binop}{\mathit{binop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-binop}{\mathit{binop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-binop}{\mathit{binop}}}}{{}_{{\mathit{nt}}}(c_1, c_2)} \\
& ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-binop}{\mathit{binop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-binop}{\mathit{binop}}}}{{}_{{\mathit{nt}}}(c_1, c_2)} = \epsilon \\
\end{array}\end{split}\]
\({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-testop}{\mathit{testop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-testop}{\mathit{testop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {{\href{../syntax/instructions.html#syntax-testop}{\mathit{testop}}}}{{}_{{\mathit{nt}}}(c_1)} \\
\end{array}\end{split}\]
\({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-relop}{\mathit{relop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{nt}} {.} {\href{../syntax/instructions.html#syntax-relop}{\mathit{relop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {{\href{../syntax/instructions.html#syntax-relop}{\mathit{relop}}}}{{}_{{\mathit{nt}}}(c_1, c_2)} \\
\end{array}\end{split}\]
\({\mathit{nt}}_2 {.} {{\href{../syntax/instructions.html#syntax-cvtop}{\mathit{cvtop}}}}{\mathsf{\_}}{{\mathit{nt}}_1}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({\mathit{nt}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{nt}}_2 {.} {{\href{../syntax/instructions.html#syntax-cvtop}{\mathit{cvtop}}}}{\mathsf{\_}}{{\mathit{nt}}_1}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({\mathit{nt}}_2{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-cvtop}{\mathit{cvtop}}}}{{}_{{\mathit{nt}}_1, {\mathit{nt}}_2}(c_1)} \\
& ({\mathit{nt}}_1{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{nt}}_2 {.} {{\href{../syntax/instructions.html#syntax-cvtop}{\mathit{cvtop}}}}{\mathsf{\_}}{{\mathit{nt}}_1}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-cvtop}{\mathit{cvtop}}}}{{}_{{\mathit{nt}}_1, {\mathit{nt}}_2}(c_1)} = \epsilon \\
\end{array}\end{split}\]
Vector Instructions¶Vector instructions that operate bitwise are handled as integer operations of respective bit width.
\[\begin{split}\begin{array}{lll@{\qquad}l}
\mathit{op}_{\href{../syntax/types.html#syntax-vectype}{\mathsf{v}\scriptstyle\kern-0.1emN}}(i_1,\dots,i_k) &=& \href{../Step_pure/numerics.html#int-ops}{\mathrm{i}\mathit{op}}_N(i_1,\dots,i_k) \\
\end{array}\end{split}\]
Most other vector instructions are defined in terms of numeric operators that are applied lane-wise according to the given shape.
\[\begin{split}\begin{array}{llll}
\mathit{op}_{t\mathsf{x}N}(n_1,\dots,n_k) &=&
\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}^{-1}_{t\mathsf{x}N}(\href{../Step_pure/instructions.html#exec-instr-numeric}{\mathit{op}}_t(i_1,\dots,i_k)^\ast) & \qquad(\mathrel{\mbox{if}} i_1^\ast = \href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}_{t\mathsf{x}N}(n_1) \land \dots \land i_k^\ast = \href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}_{t\mathsf{x}N}(n_k) \\
\end{array}\end{split}\]
Note For example, the result of instruction \(\mathsf{i32x4}.\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{add}}\) applied to operands \(v_1, v_2\) invokes \(\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{add}}_{\mathsf{i32x4}}(v_1, v_2)\), which maps to \(\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}^{-1}_{\mathsf{i32x4}}(\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{add}}_{\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}}(i_1, i_2)^\ast)\), where \(i_1^\ast\) and \(i_2^\ast\) are sequences resulting from invoking \(\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}_{\mathsf{i32x4}}(v_1)\) and \(\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}_{\mathsf{i32x4}}(v_2)\) respectively. For non-deterministic operators this definition is generalized to sets:
\[\begin{split}\begin{array}{lll}
\mathit{op}_{t\mathsf{x}N}(n_1,\dots,n_k) &=&
\{ \href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}^{-1}_{t\mathsf{x}N}(i^\ast) ~|~ i^\ast \in {\Large\times}(\href{../Step_pure/instructions.html#exec-instr-numeric}{\mathit{op}}_t(i_1,\dots,i_k)^\ast) \land i_1^\ast = \href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}_{t\mathsf{x}N}(n_1) \land \dots \land i_k^\ast = \href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}_{t\mathsf{x}N}(n_k) \} \\
\end{array}\end{split}\]
where \({\Large\times} \{x^\ast\}^N\) transforms a sequence of \(N\) sets of values into a set of sequences of \(N\) values by computing the set product:
\[\begin{array}{lll}
{\Large\times} (S_1 \dots S_N) &=& \{ x_1 \dots x_N ~|~ x_1 \in S_1 \land \dots \land x_N \in S_N \}
\end{array}\]
The remaining vector operators use individual definitions. \(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}\mathsf{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{const}}~c\)¶
Note No formal reduction rule is required for this instruction, since \(\mathsf{const}\) instructions are already values. \(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} {.} {\href{../syntax/instructions.html#syntax-vvunop}{\mathit{vvunop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} {.} {\href{../syntax/instructions.html#syntax-vvunop}{\mathit{vvunop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-vvunop}{\mathit{vvunop}}}}{{}_{\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}}(c_1)} \\
\end{array}\end{split}\]
\(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} {.} {\href{../syntax/instructions.html#syntax-vvbinop}{\mathit{vvbinop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} {.} {\href{../syntax/instructions.html#syntax-vvbinop}{\mathit{vvbinop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-vvbinop}{\mathit{vvbinop}}}}{{}_{\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}}(c_1, c_2)} \\
\end{array}\end{split}\]
\(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} {.} {\href{../syntax/instructions.html#syntax-vvternop}{\mathit{vvternop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_3)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} {.} {\href{../syntax/instructions.html#syntax-vvternop}{\mathit{vvternop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-vvternop}{\mathit{vvternop}}}}{{}_{\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}}(c_1, c_2, c_3)}
} \\
\end{array}\end{split}\]
\(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} {.} \href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{any\_true}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}} {.} \href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{any\_true}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {{\href{../exec/numerics.html#op-inez}{\mathrm{inez}}}}_{{|\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}|}}(c_1) \\
\end{array}\end{split}\]
\({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vunop}{\mathit{vunop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vunop}{\mathit{vunop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-vunop}{\mathit{vunop}}}}{{}_{{\mathit{sh}}}(c_1)} \\
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vunop}{\mathit{vunop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-vunop}{\mathit{vunop}}}}{{}_{{\mathit{sh}}}(c_1)} = \epsilon \\
\end{array}\end{split}\]
\({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vbinop}{\mathit{vbinop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vbinop}{\mathit{vbinop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-vbinop}{\mathit{vbinop}}}}{{}_{{\mathit{sh}}}(c_1, c_2)} \\
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vbinop}{\mathit{vbinop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-vbinop}{\mathit{vbinop}}}}{{}_{{\mathit{sh}}}(c_1, c_2)} = \epsilon \\
\end{array}\end{split}\]
\({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vternop}{\mathit{vternop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_3)~({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vternop}{\mathit{vternop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c \in {{\href{../syntax/instructions.html#syntax-vternop}{\mathit{vternop}}}}{{}_{{\mathit{sh}}}(c_1, c_2, c_3)} \\
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_3)~({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vternop}{\mathit{vternop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & \href{../exec/runtime.html#syntax-trap}{\mathsf{trap}} & \quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-vternop}{\mathit{vternop}}}}{{}_{{\mathit{sh}}}(c_1, c_2, c_3)} = \epsilon \\
\end{array}\end{split}\]
\({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M} {.} \href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{all\_true}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M} {.} \href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{all\_true}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ {i^\ast} = {{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}(c_1) \\
{\land}~ c = {\Pi}\, ({{{\href{../exec/numerics.html#op-inez}{\mathrm{inez}}}}_{N}(i)^\ast}) \\
\end{array} \\
\end{array}\end{split}\]
\({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vrelop}{\mathit{vrelop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vrelop}{\mathit{vrelop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {{\href{../syntax/instructions.html#syntax-vrelop}{\mathit{vrelop}}}}{{}_{{\mathit{sh}}}(c_1, c_2)} \\
\end{array}\end{split}\]
\({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vshiftop}{\mathit{vshiftop}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~i)~({\mathit{sh}} {.} {\href{../syntax/instructions.html#syntax-vshiftop}{\mathit{vshiftop}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {{\href{../syntax/instructions.html#syntax-vshiftop}{\mathit{vshiftop}}}}{{}_{{\mathit{sh}}}}{(c_1, i)} \\
\end{array}\end{split}\]
\({\mathit{sh}}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{bitmask}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{sh}}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{bitmask}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{bitmask}}}{{}_{{\mathit{sh}}}(c_1)} \\
\end{array}\end{split}\]
\({\mathit{sh}} {.} {\mathit{swizzlop}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{sh}} {.} {\mathit{swizzlop}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {{\mathit{swizzlop}}}{{}_{{\mathit{sh}}}(c_1, c_2)} \\
\end{array}\end{split}\]
\({\mathit{sh}}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{shuffle}}~{i^\ast}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{sh}}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{shuffle}}~{i^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{shuffle}}}{{}_{{\mathit{sh}}}({i^\ast}, c_1, c_2)} \\
\end{array}\end{split}\]
\({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{splat}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& ({\href{../syntax/types.html#aux-unpack}{\mathrm{unpack}}}({\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}){.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{splat}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {{{{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}^{{-1}}}}{({{{\href{../exec/numerics.html#aux-packnum}{\mathrm{pack}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}(c_1)^{M}})} \\
\end{array}\end{split}\]
\({{{\href{../syntax/instructions.html#syntax-lanetype}{\mathit{lanetype}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{extract\_lane}}}{\mathsf{\_}}{{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}'}^?}}~i\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({{\mathit{nt}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{extract\_lane}}~i) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & ({\mathit{nt}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2) & \quad \mbox{if}~ c_2 = {{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\mathit{nt}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}(c_1){}[i] \\
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({{{\mathit{pt}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{extract\_lane}}}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}~i) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-numtype}{\mathsf{i\scriptstyle32}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2) & \quad \mbox{if}~ c_2 = {{{{\href{../exec/numerics.html#op-extend}{\mathrm{extend}}}}_{{|{\mathit{pt}}|}, 32}^{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}}{({{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\mathit{pt}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}(c_1){}[i])} \\
\end{array}\end{split}\]
\({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{replace\_lane}}~i\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\href{../syntax/types.html#aux-unpack}{\mathrm{unpack}}}({\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}){.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{replace\_lane}}~i) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \\
& \multicolumn{4}{@{}l@{}}{\quad
\quad \mbox{if}~ c = {{{{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}^{{-1}}}}{({{\href{../exec/numerics.html#aux-lanes}{\mathrm{lanes}}}}_{{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}{\href{../syntax/instructions.html#syntax-shape}{\mathsf{x}}}{M}}(c_1){}[{}[i] = {{\href{../exec/numerics.html#aux-packnum}{\mathrm{pack}}}}_{{\href{../syntax/types.html#syntax-numtype}{\mathsf{i}}}{{\href{../syntax/types.html#syntax-numtype}{\scriptstyle\kern-0.1emN}}}}(c_2)])}
} \\
\end{array}\end{split}\]
\({\mathit{sh}}_2 {.} {{\href{../syntax/instructions.html#syntax-vextunop}{\mathit{vextunop}}}}{\mathsf{\_}}{{\mathit{sh}}_1}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{sh}}_2 {.} {{\href{../syntax/instructions.html#syntax-vextunop}{\mathit{vextunop}}}}{\mathsf{\_}}{{\mathit{sh}}_1}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-vextunop}{\mathit{vextunop}}}}{{}_{{\mathit{sh}}_1, {\mathit{sh}}_2}(c_1)} = c \\
\end{array}\end{split}\]
\({\mathit{sh}}_2 {.} {{\href{../syntax/instructions.html#syntax-vextbinop}{\mathit{vextbinop}}}}{\mathsf{\_}}{{\mathit{sh}}_1}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({\mathit{sh}}_2 {.} {{\href{../syntax/instructions.html#syntax-vextbinop}{\mathit{vextbinop}}}}{\mathsf{\_}}{{\mathit{sh}}_1}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-vextbinop}{\mathit{vextbinop}}}}{{}_{{\mathit{sh}}_1, {\mathit{sh}}_2}(c_1, c_2)} = c \\
\end{array}\end{split}\]
\({\mathit{sh}}_2 {.} {{\href{../syntax/instructions.html#syntax-vextternop}{\mathit{vextternop}}}}{\mathsf{\_}}{{\mathit{sh}}_1}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_3)~({\mathit{sh}}_2 {.} {{\href{../syntax/instructions.html#syntax-vextternop}{\mathit{vextternop}}}}{\mathsf{\_}}{{\mathit{sh}}_1}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \\
&&& \multicolumn{2}{@{}l@{}}{\quad
\quad \mbox{if}~ {{\href{../syntax/instructions.html#syntax-vextternop}{\mathit{vextternop}}}}{{}_{{\mathit{sh}}_1, {\mathit{sh}}_2}(c_1, c_2, c_3)} = c
} \\
\end{array}\end{split}\]
\({{\mathit{sh}}_2{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{narrow}}}{\mathsf{\_}}{{\mathit{sh}}_1}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~(\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_2)~({{\mathit{sh}}_2{.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{narrow}}}{\mathsf{\_}}{{\mathit{sh}}_1}{\mathsf{\_}}{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{narrow}}}{{{}_{{\mathit{sh}}_1, {\mathit{sh}}_2}^{{\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}}}}}{(c_1, c_2)} \\
\end{array}\end{split}\]
\({\mathit{sh}}_2 {.} {{\href{../syntax/instructions.html#syntax-vcvtop}{\mathit{vcvtop}}}}{\mathsf{\_}}{{\mathit{sh}}_1}\)¶
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c_1)~({\mathit{sh}}_2 {.} {{\href{../syntax/instructions.html#syntax-vcvtop}{\mathit{vcvtop}}}}{\mathsf{\_}}{{\mathit{sh}}_1}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & (\href{../syntax/types.html#syntax-vectype}{\mathsf{v\scriptstyle128}}{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{const}}~c) & \quad \mbox{if}~ c = {{\href{../syntax/instructions.html#syntax-vcvtop}{\mathit{vcvtop}}}}_{{\mathit{sh}}_1, {\mathit{sh}}_2}({\href{../syntax/instructions.html#syntax-vcvtop}{\mathit{vcvtop}}}, c_1) \\
\end{array}\end{split}\]
Contextual Rules¶The next instruction to execute as well as the current frame is determined according to the following contextual reduction rules.
\[\begin{split}\begin{array}[t]{@{}l@{}rcl@{}l@{}}
& z ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_1^\ast} & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {z'} ; {{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_1^\ast} & \quad
\begin{array}[t]{@{}l@{}}
\mbox{if}~ z ; {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast} \href{../exec/conventions.html#exec-notation}{\hookrightarrow} {z'} ; {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} \\
{\land}~ ({{\href{../exec/runtime.html#syntax-val}{\mathit{val}}}^\ast} \neq \epsilon \lor {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_1^\ast} \neq \epsilon) \\
\end{array} \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_0^\ast} \}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {z'} ; ({{\href{../exec/runtime.html#syntax-label}{\mathsf{label}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}_0^\ast} \}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast}) & \quad \mbox{if}~ z ; {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast} \href{../exec/conventions.html#exec-notation}{\hookrightarrow} {z'} ; {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} \\[0.8ex]
& z ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast} \}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \href{../exec/conventions.html#exec-notation}{\hookrightarrow} & {z'} ; ({{\href{../exec/runtime.html#syntax-handler}{\mathsf{handler}}}_{n}}{\{ {{\href{../syntax/instructions.html#syntax-catch}{\mathit{catch}}}^\ast} \}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast}) & \quad \mbox{if}~ z ; {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast} \href{../exec/conventions.html#exec-notation}{\hookrightarrow} {z'} ; {{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}'}^\ast} \\[0.8ex]
& s ; f ; ({{\href{../exec/runtime.html#syntax-frame}{\mathsf{frame}}}_{n}}{\{ {f'} \}}~{{\href{../syntax/instructions.html#syntax-instr}{\mathit{instr}}}^\ast}) & \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}) & \quad \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} \\
\end{array}\end{split}\]
Note In the prose formulation, the current instruction pointer and the current frame are implicit. Expressions¶An expression is evaluated relative to a current frame pointing to its containing module instance. Expression evaluation iterates single-step reduction until reaching a sequence of resulting values. Expressions constituting function bodies are executed during function invocation.
©2017-2025, WebAssembly Community Group.
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |