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.
BinaryenSetFunctionTable
andmodule.setFunctionTable
have been removed in favor ofBinaryenAddTable
andmodule.addTable
respectively.BinaryenIsFunctionTableImported
is removed.- A new type
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
andmodule.addTable
no longer take offset and function names.BinaryenGetNumFunctionTableSegments
is replaced withBinaryenGetNumElementSegments
.BinaryenGetFunctionTableSegmentOffset
is replaced withBinaryenElementSegmentGetOffset
.BinaryenGetFunctionTableSegmentLength
is replaced withBinaryenElementSegmentGetLength
.BinaryenGetFunctionTableSegmentData
is replaced withBinaryenElementSegmentGetData
.- Boolean values in the C API now should use
bool
instead ofint
. - Experimental SIMD instructions have been removed and the names and opcodes of the standard instructions have been updated to match the final spec.
wasm-dis
now supports options to enable or disable Wasm features.- Reference types support has been improved by allowing multiple tables in a module.
call_indirect
andreturn_call_indirect
now take an additional table name parameter. This is necessary for reference types support.- New getter/setter methods have been introduced for
call_indirect
table name:BinaryenCallIndirectGetTable
BinaryenCallIndirectSetTable
- JS API
CallIndirect.table
- New APIs have been added to add and manipulate multiple tables in a module:
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
andref.func
respectively) now take an extratype
parameter, similar toRefNull
. This is necessary for typed function references support.- JS API functions for atomic notify/wait instructions are renamed.
module.atomic.notify
->module.memory.atomic.notify
module.i32.atomic.wait
->module.memory.atomic.wait32
module.i64.atomic.wait
->module.memory.atomic.wait64
- Remove old/broken SpollPointers pass. This pass: Spills values that might be pointers to the C stack. This allows Boehm-style GC to see them properly. This can be revived if needed from git history (#3261).
- Make
NUM_PARAMS
inFuncCastEmulation
a runtime configuration option namedmax-func-params
. This defaults to the original value of 16. BinaryenGetFunction
,BinaryenGetGlobal
andBinaryenGetEvent
now returnNULL
instead of aborting when the respective element does not yet exist.
- Add
--fast-math
mode. (#3155) - Initial implementation of "Memory64" proposal (#3130)
- Lots of changes in support of GC proposal
- Remove asm2wasm, which supported Emscripten's fastcomp backend, after fastcomp was removed.
- The new feature flag
--enable-anyref
enables just theanyref
type incl. basic subtyping ofexternref
,funcref
andexnref
(if enabled). - Enabling the exception handling or anyref features without also enabling reference types is a validation error now.
- The
Host
expression and its respective APIs have been refactored into separateMemorySize
andMemoryGrow
expressions to align with other memory instructions.
- Fuzzing: Compare wasm2js to the interpreter (#3026)
- Fix CountLeadingZeroes on MSVC, which lead to bad optimizations (#3028)
- Asyncify verbose option (#3022)
- wasm2js: Add an "Export" scope for name resolution, avoids annoying warnings (#2998)
- Extend the C- and JS-APIs (#2586)
- Add Asyncify "add list" that adds to the list of functions to be instrumented. Rename old lists to be clearer and more consistent with that, so now there is "remove list" to remove, "add list" to add, and "only list" which if set means that only those functions should be instrumented and nothing else.
- Renamed various ambiguous C-API functions for consistency:
BinaryenBlockGetChild
toBinaryenBlockGetChildAt
BinaryenSwitchGetName
toBinaryenSwitchGetNameAt
BinaryenCallGetOperand
toBinaryenCallGetOperandAt
BinaryenCallIndirectGetOperand
toBinaryenCallIndirectGetOperandAt
BinaryenHostGetOperand
toBinaryenHostGetOperandAt
BinaryenThrowGetOperand
toBinaryenThrowGetOperandAt
BinaryenTupleMakeGetOperand
toBinaryenTupleMakeGetOperandAt
- The C-API's
BinaryenSetAPITracing
and the JS-API'ssetAPITracing
have been removed because this feature was not very useful anymore and had a significant maintainance cost. - wasm-emscripten-finalize will no longer generate
stackSave
,stackAlloc
,stackRestore
function. It not expects them to be included in the input file.
- First release with binaries built with github actions.
- The
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 newtuple.make
pseudoinstruction and their elements are retrieved with the newtuple.extract
pseudoinstruction. - The internal type interner has been rewritten to avoid taking locks in far more situations. Depending on the workload, this may result in large speedups and increased parallelism.
- Represent the
dylink
section in Binaryen IR, so we can read, write, and update it.
BinaryenExpressionGetSideEffects
(C API) andgetSideEffects
(JS API) now takes an additionalfeatures
parameter.- Reference type support is added. Supported instructions are
ref.null
,ref.is_null
,ref.func
, and typedselect
. Table instructions are not supported yet. For typedselect
, 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, likelocal.get
. This is required to handle subtypes.- Added load_splat SIMD instructions
- Binaryen.js instruction API changes:
notify
->atomic.notify
i32.wait
/i64.wait
->i32.atomic.wait
/i64.atomic.wait
- Binaryen.js:
flags
argument insetMemory
function is removed. atomic.fence
instruction support is added.- wasm-emscripten-finalize: Don't rely on name section being present in the input. Use the exported names for things instead.
- Added
mutable
parameter to BinaryenAddGlobalImport. - Replace BinaryenSIMDBitselect* with BinaryenSIMDTernary* in the C API and add qfma/qfms instructions.
- Added
offset
parameter to BinaryenSetFunctionTable. - Add the ability to create multivalue Types in the C and JS APIs.
- Remove named function types. They are replaced by
params
andresults
types local to each function. - Binaryen.js can now be compiled to Wasm using the
binaryen_wasm
target. Unlike the JS variant, the Wasm variant requires asynchronously awaiting the Wasm blob's instantiation and initialization before being usable, using thebinaryen.ready
promise, e.g.binaryen.ready.then(() => ...)
. - Binaryen.js now uses
binaryen
(wasBinaryen
) as its global name to align with the npm package. - Binaryen.js: The result of
getMemorySegmentInfoByIndex
now has the same structure as the respective inputs on creation (byteOffset
->offset
).
- wasm-emscripten-finalize: For -pie binaries that import a mutable stack pointer we internalize this an import it as immutable.
- The
tail-call
feature including thereturn_call
andreturn_call_indirect
instructions is ready to use.
- Rename Bysyncify => Asyncify
- The --initial-stack-pointer argument to wasm-emscripten-finalize no longer has any effect. It will be removed completely in future release.
- Wast file parsing rules now don't allow a few invalid formats for typeuses
that were previously allowed. Typeuse entries should follow this format,
meaning they should have (type) -> (param) -> (result) order if more than one
of them exist.
Also, all (local) nodes in function definition should be after all typeuse elements.
typeuse ::= (type index|name)+ | (type index|name)+ (param ..)* (result ..)* | (param ..)* (result ..)*
- Removed APIs related to deprecated instruction names in Binaryen.js:
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
, andmemory.grow
.
- Add feature handling to the C/JS API with no feature enabled by default.
- Generate dynCall thunks for any signatures used in "invoke" calls.
- Fix AsmConstWalker handling of string address in arg0 with -fPIC code
- Change default feature set in the absence of a target features section from all features to MVP.
- Improve support for side modules
- Add
namedGlobals
to metadata output of wasm-emscripten-finalize - Add support for llvm PIC code.
- Add --side-module option to wasm-emscripten-finalize.
- Add
segmentPassive
argument toBinaryenSetMemory
for marking segments passive. - Make
-o -
print to stdout instead of a file named "-".
- Remove wasm-merge tool.
- Remove jsCall generation from wasm-emscripten-finalize. This is not needed as of emscripten-core/emscripten#8255.
RelooperCreate
in the C API now has a Module parameter, andRelooperRenderAndDispose
does not.- The JS API now has the
Relooper
constructor receive theModule
.
- The JS API now has the
- Relooper: Condition properties on Branches must not have side effects.
-
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 typeBinaryenImportRef
instead ofBinaryenFunctionRef
. #1650 -
BinaryenSetFunctionTable
in the C API now expects the initial and maximum table size as additional parameters, likeBinaryenSetMemory
does for pages, so tables can be grown dynamically. #1687 -
Add
shared
parameters toBinaryenAddMemoryImport
andBinaryenSetMemory
, to support a shared memory. #1686