This document describes changes between tagged Binaryen versions.
To browse or download snapshots of old tagged versions, visit https://github.com/WebAssembly/binaryen/releases.
Not all changes are documented here. In particular, new features, user-oriented fixes, options, command-line parameters, usage changes, deprecations, significant internal modifications and optimizations etc. generally deserve a mention. To examine the full set of changes between versions, visit the link to full changeset diff at the end of each section.
getSideEffects()
. It is now mandatory to pass in the module.import Binaryen from "path/to/binaryen.js"; const binaryen = await Binaryen(); ...
Add BinaryenUpdateMaps
to the C API.
Adds a TrapsNeverHappen mode (#4059). This has many of the benefits of IgnoreImplicitTraps, but can be used safely in more cases. IgnoreImplicitTraps is now deprecated.
Adds type argument for BinaryenAddTable method (#4107). For the binaryen.js api this parameter is optional and by default is set to funcref type.
Replace BinaryenExpressionGetSideEffects
's features parameter with a module parameter.
OptimizeInstructions now lifts identical code in select
/if
arms (#3828). This may cause direct BinaryenTupleExtract(BinaryenTupleMake(...))
to use multivalue types.
BinaryenSetFunctionTable
and module.setFunctionTable
have been removed in favor of BinaryenAddTable
and module.addTable
respectively.BinaryenIsFunctionTableImported
is removed.BinaryenElementSegmentRef
has been added to the C API with new apis in both C & JS:BinaryenAddActiveElementSegment
BinaryenAddPassiveElementSegment
BinaryenRemoveElementSegment
BinaryenGetElementSegment
BinaryenGetElementSegmentByIndex
BinaryenElementSegmentGetName
BinaryenElementSegmentSetName
BinaryenElementSegmentGetTable
BinaryenElementSegmentSetTable
BinayenElementSegmentIsPassive
module.addActiveElementSegment
module.addPassiveElementSegment
module.removeElementSegment
module.getElementSegment
module.getElementSegmentByIndex
module.getTableSegments
module.getNumElementSegments
binaryen.getElementSegmentInfo
BinaryenAddTable
and module.addTable
no longer take offset and function names.BinaryenGetNumFunctionTableSegments
is replaced with BinaryenGetNumElementSegments
.BinaryenGetFunctionTableSegmentOffset
is replaced with BinaryenElementSegmentGetOffset
.BinaryenGetFunctionTableSegmentLength
is replaced with BinaryenElementSegmentGetLength
.BinaryenGetFunctionTableSegmentData
is replaced with BinaryenElementSegmentGetData
.bool
instead of int
.wasm-dis
now supports options to enable or disable Wasm features.call_indirect
and return_call_indirect
now take an additional table name parameter. This is necessary for reference types support.call_indirect
table name:BinaryenCallIndirectGetTable
BinaryenCallIndirectSetTable
CallIndirect.table
BinaryenAddTable
BinaryenRemoveTable
BinaryenGetNumTables
BinaryenGetTable
BinaryenGetTableByIndex
BinaryenTableGetName
BinaryenTableGetInitial
BinaryenTableHasMax
BinaryenTableGetMax
BinaryenTableImportGetModule
BinaryenTableImportGetBase
module.addTable
module.removeTable
module.getTable
module.getTableByIndex
module.getNumTables
binaryen.getTableInfo
RefFunc
C and JS API constructors (BinaryenRefFunc
and ref.func
respectively) now take an extra type
parameter, similar to RefNull
. This is necessary for typed function references support.module.atomic.notify
-> module.memory.atomic.notify
module.i32.atomic.wait
-> module.memory.atomic.wait32
module.i64.atomic.wait
-> module.memory.atomic.wait64
NUM_PARAMS
in FuncCastEmulation
a runtime configuration option named max-func-params
. This defaults to the original value of 16.BinaryenGetFunction
, BinaryenGetGlobal
and BinaryenGetEvent
now return NULL
instead of aborting when the respective element does not yet exist.--fast-math
mode. (#3155)--enable-anyref
enables just the anyref
type incl. basic subtyping of externref
, funcref
and exnref
(if enabled).Host
expression and its respective APIs have been refactored into separate MemorySize
and MemoryGrow
expressions to align with other memory instructions.BinaryenBlockGetChild
to BinaryenBlockGetChildAt
BinaryenSwitchGetName
to BinaryenSwitchGetNameAt
BinaryenCallGetOperand
to BinaryenCallGetOperandAt
BinaryenCallIndirectGetOperand
to BinaryenCallIndirectGetOperandAt
BinaryenHostGetOperand
to BinaryenHostGetOperandAt
BinaryenThrowGetOperand
to BinaryenThrowGetOperandAt
BinaryenTupleMakeGetOperand
to BinaryenTupleMakeGetOperandAt
BinaryenSetAPITracing
and the JS-API’s setAPITracing
have been removed because this feature was not very useful anymore and had a significant maintainance cost.stackSave
, stackAlloc
, stackRestore
function. It not expects them to be included in the input file.multivalue
feature has been added. It allows functions and control flow structures to return tuples and for locals and globals to have tuple types. Tuples are created with the new tuple.make
pseudoinstruction and their elements are retrieved with the new tuple.extract
pseudoinstruction.dylink
section in Binaryen IR, so we can read, write, and update it.BinaryenExpressionGetSideEffects
(C API) and getSideEffects
(JS API) now takes an additional features
parameter.ref.null
, ref.is_null
, ref.func
, and typed select
. Table instructions are not supported yet. For typed select
, C/JS API can take an additional ‘type’ parameter.local.tee
's C/Binaryen.js API now takes an additional type parameter for its local type, like local.get
. This is required to handle subtypes.notify
-> atomic.notify
i32.wait
/ i64.wait
-> i32.atomic.wait
/ i64.atomic.wait
flags
argument in setMemory
function is removed.atomic.fence
instruction support is added.mutable
parameter to BinaryenAddGlobalImport.offset
parameter to BinaryenSetFunctionTable.params
and results
types local to each function.binaryen_wasm
target. Unlike the JS variant, the Wasm variant requires asynchronously awaiting the Wasm blob's instantiation and initialization before being usable, using the binaryen.ready
promise, e.g. binaryen.ready.then(() => ...)
.binaryen
(was Binaryen
) as its global name to align with the npm package.getMemorySegmentInfoByIndex
now has the same structure as the respective inputs on creation (byteOffset
-> offset
).tail-call
feature including the return_call
and return_call_indirect
instructions is ready to use.typeuse ::= (type index|name)+ | (type index|name)+ (param ..)* (result ..)* | (param ..)* (result ..)*Also, all (local) nodes in function definition should be after all typeuse elements.
get_local
/ getLocal
set_local
/ setLocal
tee_local
/ teeLocal
get_global
/ getGlobal
set_global
/ setGlobal
current_memory
/ currentMemory
grow_memory
/ growMemory
They are now available as their new instruction names: local.get
, local.set
, local.tee
, global.get
, global.set
, memory.size
, and memory.grow
.namedGlobals
to metadata output of wasm-emscripten-finalizesegmentPassive
argument to BinaryenSetMemory
for marking segments passive.-o -
print to stdout instead of a file named “-”.RelooperCreate
in the C API now has a Module parameter, and RelooperRenderAndDispose
does not.Relooper
constructor receive the Module
.BinaryenSetFunctionTable
in the C API no longer accepts an array of functions, instead it accepts an array of function names, const char** funcNames
. Previously, you could not include imported functions because they are of type BinaryenImportRef
instead of BinaryenFunctionRef
. #1650
BinaryenSetFunctionTable
in the C API now expects the initial and maximum table size as additional parameters, like BinaryenSetMemory
does for pages, so tables can be grown dynamically. #1687
Add shared
parameters to BinaryenAddMemoryImport
and BinaryenSetMemory
, to support a shared memory. #1686