Change History

Since the original release 1.0 of the WebAssembly specification, a number of proposals for extensions have been integrated. The following sections provide an overview of what has changed.

Release 2.0

Sign extension instructions

Added new numeric instructions for performing sign extension within integer representations [1].

  • New numeric instructions: \(\mathsf{i}\mathit{nn}\mathsf{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{extend}}\mathit{N}\mathsf{\_s}\)

Non-trapping float-to-int conversions

Added new conversion instructions that avoid trapping when converting a floating-point number to an integer [2].

  • New numeric instructions: \(\mathsf{i}\mathit{nn}\mathsf{.}\href{../syntax/instructions.html#syntax-instr-numeric}{\mathsf{trunc}}\mathsf{\_sat\_f}\mathit{mm}\mathsf{\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\)

Multiple values

Generalized the result type of blocks and functions to allow for multiple values; in addition, introduced the ability to have block parameters [3].

Reference types

Added \(\href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}}\) and \(\href{../syntax/types.html#syntax-reftype}{\mathsf{externref}}\) as new value types and respective instructions [4].

  • New value types: reference types \(\href{../syntax/types.html#syntax-reftype}{\mathsf{funcref}}\) and \(\href{../syntax/types.html#syntax-reftype}{\mathsf{externref}}\)

  • New reference instructions: \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}null}}\), \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}func}}\), \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref{.}is\_null}}\)

  • Enrich parametric instruction: \(\href{../syntax/instructions.html#syntax-instr-parametric}{\mathsf{select}}\) with optional type immediate

  • New declarative form of element segment

Table instructions

Added instructions to directly access and modify tables [4].

  • Table types allow any reference type as element type

  • New table instructions: \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.get}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.set}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.size}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.grow}}\)

Multiple tables

Added the ability to use multiple tables per module [4].

  • Modules may define, import, and export multiple tables

  • Table instructions take a table index immediate: \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.get}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.set}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.size}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.grow}}\), \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_indirect}}\)

  • Element segments take a table index

Bulk memory and table instructions

Added instructions that modify ranges of memory or table entries [4] [5]

  • New memory instructions: \(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory.fill}}\), \(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory.init}}\), \(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{memory.copy}}\), \(\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{data.drop}}\)

  • New table instructions: \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.fill}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.init}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{table.copy}}\), \(\href{../syntax/instructions.html#syntax-instr-table}{\mathsf{elem.drop}}\)

  • New passive form of data segment

  • New passive form of element segment

  • New data count section in binary format

  • Active data and element segments boundaries are no longer checked at compile time but may trap instead

Vector instructions

Added vector type and instructions that manipulate multiple numeric values in parallel (also known as SIMD, single instruction multiple data) [6]

  • New value type: \(\href{../syntax/types.html#syntax-valtype}{\mathsf{v128}}\)

  • New memory instructions: \(\mathsf{v128.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}\), \(\mathsf{v128.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}{}\!N\!\mathsf{x}\!M\!\mathsf{\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{v128.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}{}N\mathsf{\_zero}\), \(\mathsf{v128.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}{}N\mathsf{\_splat}\), \(\mathsf{v128.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{load}}{}N\mathsf{\_lane}\), \(\mathsf{v128.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}\), \(\mathsf{v128.}\href{../syntax/instructions.html#syntax-instr-memory}{\mathsf{store}}{}N\mathsf{\_lane}\)

  • New constant vector instruction: \(\mathsf{v128.}\href{../syntax/instructions.html#syntax-instr-vec}{\mathsf{const}}\)

  • New unary vector instructions: \(\mathsf{v128.not}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.abs}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.neg}\), \(\mathsf{i8x16.popcnt}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.abs}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.neg}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.sqrt}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.ceil}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.floor}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.trunc}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.nearest}\)

  • New binary vector instructions: \(\mathsf{v128.and}\), \(\mathsf{v128.andnot}\), \(\mathsf{v128.or}\), \(\mathsf{v128.xor}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.add}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.sub}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.mul}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.add\_sat\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.sub\_sat\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.min\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.max\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.shl}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.shr\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.add}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.extmul\_}\href{../syntax/instructions.html#syntax-half}{\mathit{half}}\mathsf{\_i}\!N'\!\mathsf{x}\!M'\!\mathsf{\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i16x8.q15mulr\_sat\_s}\), \(\mathsf{i32x4.dot\_i16x8\_s}\), \(\mathsf{i16x8.extadd\_pairwise\_i8x16\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i32x4.extadd\_pairwise\_i16x8\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i8x16.avgr\_u}\), \(\mathsf{i16x8.avgr\_u}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.sub}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.mul}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.div}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.min}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.max}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.pmin}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.pmax}\)

  • New ternary vector instruction: \(\mathsf{v128.bitselect}\)

  • New test vector instructions: \(\mathsf{v128.any\_true}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.all\_true}\)

  • New relational vector instructions: \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.eq}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.ne}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.lt\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.gt\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.le\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.ge\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.eq}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.ne}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.lt}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.gt}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.le}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.ge}\)

  • New conversion vector instructions:\(\mathsf{i32x4.trunc\_sat\_f32x4\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i32x4.trunc\_sat\_f64x2\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\mathsf{\_zero}\), \(\mathsf{f32x4.convert\_i32x4\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{f32x4.demote\_f64x2\_zero}\), \(\mathsf{f64x2.convert\_low\_i32x4\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{f64x2.promote\_low\_f32x4}\)

  • New lane access vector instructions: \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.extract\_lane\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}^?\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.replace\_lane}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.extract\_lane}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.replace\_lane}\)

  • New lane splitting/combining vector instructions: \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.extend\_}\href{../syntax/instructions.html#syntax-half}{\mathit{half}}\mathsf{\_i}\!N'\!\mathsf{x}\!M'\!\mathsf{\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i8x16.narrow\_i16x8\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\), \(\mathsf{i16x8.narrow\_i32x4\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\)

  • New byte reordering vector instructions: \(\mathsf{i8x16.shuffle}\), \(\mathsf{i8x16.swizzle}\)

  • New injection/projection vector instructions: \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.splat}\), \(\mathsf{f}\!N\!\mathsf{x}\!M\!\mathsf{.splat}\), \(\mathsf{i}\!N\!\mathsf{x}\!M\!\mathsf{.bitmask}\)

Exception Handling

Added tag definitions, imports, and exports, and instructions to throw and catch exceptions [7]

  • Modules may define, import, and export tags.

  • New reference type \(\href{../syntax/types.html#syntax-reftype}{\mathsf{exnref}}\).

  • New control instructions: \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw}}\), \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{throw\_ref}}\), and \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{try\_table}}\).

  • New tag section in binary format.