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}}\)

  • Extended 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}\)

Release 2.?

Typeful References

Added more precise types for references [7].

  • New generalised form of reference types: \((\href{../syntax/types.html#syntax-reftype}{\mathsf{ref}}~\href{../syntax/types.html#syntax-reftype}{\mathsf{null}}^?~\href{../syntax/types.html#syntax-heaptype}{\mathit{heaptype}})\)

  • New class of heap types: \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{func}}\), \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{extern}}\), \(\href{../syntax/modules.html#syntax-typeidx}{\mathit{typeidx}}\)

  • Basic subtyping on reference and value types

  • New reference instructions: \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref.as\_non\_null}}\), \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_null}}\), \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_non\_null}}\)

  • New control instruction: \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{call\_ref}}\)

  • Refined typing of reference instruction \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref.func}}\) with more precise result type

  • Refined typing of local instructions and instruction sequences to track the initialization status of locals with non-defaultable type

  • Extended table definitions with optional initializer expression

Garbage Collection

Added managed reference types [8].

  • New forms of heap types: \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{any}}\), \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{eq}}\), \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{i31}}\), \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{struct}}\), \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{array}}\), \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{none}}\), \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{nofunc}}\), \(\href{../syntax/types.html#syntax-heaptype}{\mathsf{noextern}}\)

  • New reference type short-hands: \(\href{../syntax/types.html#syntax-reftype}{\mathsf{anyref}}\), \(\href{../syntax/types.html#syntax-reftype}{\mathsf{eqref}}\), \(\href{../syntax/types.html#syntax-reftype}{\mathsf{i31ref}}\), \(\href{../syntax/types.html#syntax-reftype}{\mathsf{structref}}\), \(\href{../syntax/types.html#syntax-reftype}{\mathsf{arrayref}}\), \(\href{../syntax/types.html#syntax-reftype}{\mathsf{nullref}}\), \(\href{../syntax/types.html#syntax-reftype}{\mathsf{nullfuncref}}\), \(\href{../syntax/types.html#syntax-reftype}{\mathsf{nullexternref}}\)

  • New forms of type definitions: structure and array types, sub types, and recursive types

  • Enriched subtyping based on explicitly declared sub types and the new heap types

  • New generic reference instructions: \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref.eq}}\), \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref.test}}\), \(\href{../syntax/instructions.html#syntax-instr-ref}{\mathsf{ref.cast}}\), \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_cast}}\), \(\href{../syntax/instructions.html#syntax-instr-control}{\mathsf{br\_on\_cast\_fail}}\)

  • New reference instructions for unboxed scalars: \(\href{../syntax/instructions.html#syntax-instr-i31}{\mathsf{ref.i31}}\), \(\href{../syntax/instructions.html#syntax-instr-i31}{\mathsf{i31.get}}\mathsf{\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}\)

  • New reference instructions for structure types: \(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct.new}}\), \(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct.new\_default}}\), \(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct.get}}\mathsf{\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}^?\), \(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct.set}}\)

  • New reference instructions for array types: \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.new}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.new\_default}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.new\_fixed}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.new\_data}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.new\_elem}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.get}}\mathsf{\_}\href{../syntax/instructions.html#syntax-sx}{\mathit{sx}}^?\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.set}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.len}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.fill}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.copy}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.init\_data}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.init\_elem}}\)

  • New reference instructions for converting host types: \(\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{any.convert\_extern}}\), \(\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{extern.convert\_any}}\)

  • Extended set of constant instructions with \(\href{../syntax/instructions.html#syntax-instr-i31}{\mathsf{ref.i31}}\), \(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct.new}}\), \(\href{../syntax/instructions.html#syntax-instr-struct}{\mathsf{struct.new\_default}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.new}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.new\_default}}\), \(\href{../syntax/instructions.html#syntax-instr-array}{\mathsf{array.new\_fixed}}\), \(\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{any.convert\_extern}}\), \(\href{../syntax/instructions.html#syntax-instr-extern}{\mathsf{extern.convert\_any}}\), and \(\href{../syntax/instructions.html#syntax-instr-variable}{\mathsf{global.get}}\) for any previously declared immutable global