Skip to content

Latest commit

 

History

History
157 lines (84 loc) · 8.33 KB

changes.rst

File metadata and controls

157 lines (84 loc) · 8.33 KB
.. index:: ! changes

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

.. index:: instruction, integer

Sign extension instructions

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

  • New :ref:`numeric instructions <syntax-instr-numeric>`: \K{i}\X{nn}\K{.}\EXTEND\X{N}\K{\_s}
.. index:: instruction, trap, floating-point, integer

Non-trapping float-to-int conversions

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

  • New :ref:`numeric instructions <syntax-instr-numeric>`: \K{i}\X{nn}\K{.}\TRUNC\K{\_sat\_f}\X{mm}\K{\_}\sx
.. index:: block, function, value type, result type

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].

  • :ref:`Function types <syntax-functype>` allow more than one result
  • :ref:`Block types <syntax-blocktype>` can be arbitrary function types
.. index:: value type, reference, reference type, instruction, element segment

Reference types

Added |FUNCREF| and |EXTERNREF| as new value types and respective instructions [4].

  • New :ref:`value types <syntax-valtype>`: :ref:`reference types <syntax-reftype>` |FUNCREF| and |EXTERNREF|
  • New :ref:`reference instructions <syntax-instr-ref>`: |REFNULL|, |REFFUNC|, |REFISNULL|
  • Enrich :ref:`parametric instruction <syntax-instr-parametric>`: |SELECT| with optional type immediate
  • New :ref:`declarative <syntax-elemmode>` form of :ref:`element segment <syntax-elem>`
.. index:: reference, instruction, table, table type

Table instructions

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

  • :ref:`Table types <syntax-tabletype>` allow any :ref:`reference type <syntax-reftype>` as element type
  • New :ref:`table instructions <syntax-instr-table>`: |TABLEGET|, |TABLESET|, |TABLESIZE|, |TABLEGROW|
.. index:: table, instruction, table index, element segment

Multiple tables

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

  • :ref:`Modules <syntax-module>` may :ref:`define <syntax-table>`, :ref:`import <syntax-import>`, and :ref:`export <syntax-export>` multiple tables
  • :ref:`Table instructions <syntax-instr-table>` take a :ref:`table index <syntax-tableidx>` immediate: |TABLEGET|, |TABLESET|, |TABLESIZE|, |TABLEGROW|, |CALLINDIRECT|
  • :ref:`Element segments <syntax-elem>` take a :ref:`table index <syntax-tableidx>`
.. index:: instruction, table, memory, data segment, element segment

Bulk memory and table instructions

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

  • New :ref:`memory instructions <syntax-instr-memory>`: |MEMORYFILL|, |MEMORYINIT|, |MEMORYCOPY|, |DATADROP|
  • New :ref:`table instructions <syntax-instr-table>`: |TABLEFILL|, |TABLEINIT|, |TABLECOPY|, |ELEMDROP|
  • New :ref:`passive <syntax-datamode>` form of :ref:`data segment <syntax-data>`
  • New :ref:`passive <syntax-elemmode>` form of :ref:`element segment <syntax-elem>`
  • New :ref:`data count section <binary-datacountsec>` in binary format
  • Active data and element segments boundaries are no longer checked at compile time but may trap instead
.. index:: instructions, SIMD, value type, vector type

Vector instructions

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

  • New :ref:`value type <syntax-valtype>`: |V128|
  • New :ref:`memory instructions <syntax-instr-memory>`: \K{v128.}\LOAD, \K{v128.}\LOAD{}\!N\!\K{x}\!M\!\K{\_}\sx, \K{v128.}\LOAD{}N\K{\_zero}, \K{v128.}\LOAD{}N\K{\_splat}, \K{v128.}\LOAD{}N\K{\_lane}, \K{v128.}\STORE, \K{v128.}\STORE{}N\K{\_lane}
  • New constant :ref:`vector instruction <syntax-instr-vec>`: \K{v128.}\VCONST
  • New unary :ref:`vector instructions <syntax-instr-vec>`: \K{v128.not}, \K{i}\!N\!\K{x}\!M\!\K{.abs}, \K{i}\!N\!\K{x}\!M\!\K{.neg}, \K{i8x16.popcnt}, \K{f}\!N\!\K{x}\!M\!\K{.abs}, \K{f}\!N\!\K{x}\!M\!\K{.neg}, \K{f}\!N\!\K{x}\!M\!\K{.sqrt}, \K{f}\!N\!\K{x}\!M\!\K{.ceil}, \K{f}\!N\!\K{x}\!M\!\K{.floor}, \K{f}\!N\!\K{x}\!M\!\K{.trunc}, \K{f}\!N\!\K{x}\!M\!\K{.nearest}
  • New binary :ref:`vector instructions <syntax-instr-vec>`: \K{v128.and}, \K{v128.andnot}, \K{v128.or}, \K{v128.xor}, \K{i}\!N\!\K{x}\!M\!\K{.add}, \K{i}\!N\!\K{x}\!M\!\K{.sub}, \K{i}\!N\!\K{x}\!M\!\K{.mul}, \K{i}\!N\!\K{x}\!M\!\K{.add\_sat\_}\sx, \K{i}\!N\!\K{x}\!M\!\K{.sub\_sat\_}\sx, \K{i}\!N\!\K{x}\!M\!\K{.min\_}\sx, \K{i}\!N\!\K{x}\!M\!\K{.max\_}\sx, \K{i}\!N\!\K{x}\!M\!\K{.shl}, \K{i}\!N\!\K{x}\!M\!\K{.shr\_}\sx, \K{f}\!N\!\K{x}\!M\!\K{.add}, \K{i}\!N\!\K{x}\!M\!\K{.extmul\_}\half\K{\_i}\!N'\!\K{x}\!M'\!\K{\_}\sx, \K{i16x8.q15mulr\_sat\_s}, \K{i32x4.dot\_i16x8\_s}, \K{i16x8.extadd\_pairwise\_i8x16\_}\sx, \K{i32x4.extadd\_pairwise\_i16x8\_}\sx, \K{i8x16.avgr\_u}, \K{i16x8.avgr\_u}, \K{f}\!N\!\K{x}\!M\!\K{.sub}, \K{f}\!N\!\K{x}\!M\!\K{.mul}, \K{f}\!N\!\K{x}\!M\!\K{.div}, \K{f}\!N\!\K{x}\!M\!\K{.min}, \K{f}\!N\!\K{x}\!M\!\K{.max}, \K{f}\!N\!\K{x}\!M\!\K{.pmin}, \K{f}\!N\!\K{x}\!M\!\K{.pmax}
  • New ternary :ref:`vector instruction <syntax-instr-vec>`: \K{v128.bitselect}
  • New test :ref:`vector instructions <syntax-instr-vec>`: \K{v128.any\_true}, \K{i}\!N\!\K{x}\!M\!\K{.all\_true}
  • New relational :ref:`vector instructions <syntax-instr-vec>`: \K{i}\!N\!\K{x}\!M\!\K{.eq}, \K{i}\!N\!\K{x}\!M\!\K{.ne}, \K{i}\!N\!\K{x}\!M\!\K{.lt\_}\sx, \K{i}\!N\!\K{x}\!M\!\K{.gt\_}\sx, \K{i}\!N\!\K{x}\!M\!\K{.le\_}\sx, \K{i}\!N\!\K{x}\!M\!\K{.ge\_}\sx, \K{f}\!N\!\K{x}\!M\!\K{.eq}, \K{f}\!N\!\K{x}\!M\!\K{.ne}, \K{f}\!N\!\K{x}\!M\!\K{.lt}, \K{f}\!N\!\K{x}\!M\!\K{.gt}, \K{f}\!N\!\K{x}\!M\!\K{.le}, \K{f}\!N\!\K{x}\!M\!\K{.ge}
  • New conversion :ref:`vector instructions <syntax-instr-vec>`:\K{i32x4.trunc\_sat\_f32x4\_}\sx, \K{i32x4.trunc\_sat\_f64x2\_}\sx\K{\_zero}, \K{f32x4.convert\_i32x4\_}\sx, \K{f32x4.demote\_f64x2\_zero}, \K{f64x2.convert\_low\_i32x4\_}\sx, \K{f64x2.promote\_low\_f32x4}
  • New lane access :ref:`vector instructions <syntax-instr-vec>`: \K{i}\!N\!\K{x}\!M\!\K{.extract\_lane\_}\sx^?, \K{i}\!N\!\K{x}\!M\!\K{.replace\_lane}, \K{f}\!N\!\K{x}\!M\!\K{.extract\_lane}, \K{f}\!N\!\K{x}\!M\!\K{.replace\_lane}
  • New lane splitting/combining :ref:`vector instructions <syntax-instr-vec>`: \K{i}\!N\!\K{x}\!M\!\K{.extend\_}\half\K{\_i}\!N'\!\K{x}\!M'\!\K{\_}\sx, \K{i8x16.narrow\_i16x8\_}\sx, \K{i16x8.narrow\_i32x4\_}\sx
  • New byte reordering :ref:`vector instructions <syntax-instr-vec>`: \K{i8x16.shuffle}, \K{i8x16.swizzle}
  • New injection/projection :ref:`vector instructions <syntax-instr-vec>`: \K{i}\!N\!\K{x}\!M\!\K{.splat}, \K{f}\!N\!\K{x}\!M\!\K{.splat}, \K{i}\!N\!\K{x}\!M\!\K{.bitmask}
[1]https://github.com/WebAssembly/spec/tree/main/proposals/sign-extension-ops/
[2]https://github.com/WebAssembly/spec/tree/main/proposals/nontrapping-float-to-int-conversion/
[3]https://github.com/WebAssembly/spec/tree/main/proposals/multi-value/
[4](1, 2, 3, 4) https://github.com/WebAssembly/spec/tree/main/proposals/reference-types/
[5]https://github.com/WebAssembly/spec/tree/main/proposals/bulk-memory-operations/
[6]https://github.com/WebAssembly/spec/tree/main/proposals/simd/