Releases: tessi/wasmex
v0.9.2
Added
- Added an option to enable the WebAssembly memory64 proposal - thanks @samcamwilliams
Changed
- Updated rustler to 0.35.0 and rustler_precompiled to 0.8 (thanks @DnOberon)
- Updated wasmtime to 26.0.1
v0.9.1
Same as 0.9.1, but with correct checksum for precompiled binaries Wasmtime rewrote their fuel-related API and simplified it. To remain consistent with Wasmtime, we follow this change in this release. A Wasmex `Store` now only implements `set_fuel/2` and `get_fuel/1`. All other methods are removed with this release. The underlying implementation of the fuel system got rewritten as well. If you are using fuel in your app, please check your fuel consumption values. - official support for Elixir 1.15 and 1.16 - fuel-related API got rewritten, because the underlying Wasm library (wasmtime) changed their API and we want to be consistent. Added `Store.get_fuel/1` and `Store.set_fuel/2` which is a much simpler API than before. - read and write a global’s value with `Instance.get_global_value/3` and `Instance.set_global_value/4` ([#540](https://github.com/tessi/wasmex/pull/540)) - ability to dynamically link wasm modules ([#596](https://github.com/tessi/wasmex/pull/596)) thanks @munjalpatel - ability to use 128 bit unsigned integers (wasm type `V128`) - added support for multi-value returns from WASM and elixir callbacks. This enables passing string return values safely by pointer and length, for example. - removed support for Elixir 1.12 - with the fuel-related API changed, the existing methods on `Store` (`consume_fuel`, `fuel_remaining`, `add_fuel`) were removed. Please call `set_fuel/2` and `get_fuel/1` instead. - Dependency updates (most notably wasmtime and rustler) - thanks @RoyalIcing and @scrogson - removed dialyzer
v0.9.0
Wasmtime rewrote their fuel-related API and simplified it. To remain consistent with Wasmtime, we follow this change in this release. A Wasmex Store
now only implements set_fuel/2
and get_fuel/1
. All other methods are removed with this release.
The underlying implementation of the fuel system got rewritten as well. If you are using fuel in your app,
please check your fuel consumption values.
Added
- official support for Elixir 1.15 and 1.16
- fuel-related API got rewritten, because the underlying Wasm library (wasmtime) changed their API and we want to be consistent. Added
Store.get_fuel/1
andStore.set_fuel/2
which is a much simpler API than before. - read and write a global’s value with
Instance.get_global_value/3
andInstance.set_global_value/4
(#540) - ability to dynamically link wasm modules (#596) thanks @munjalpatel
- ability to use 128 bit unsigned integers (wasm type
V128
) - added support for multi-value returns from WASM and elixir callbacks. This enables passing string return values safely by pointer and length, for example.
Removed
- removed support for Elixir 1.12
- with the fuel-related API changed, the existing methods on
Store
(consume_fuel
,fuel_remaining
,add_fuel
) were removed. Please callset_fuel/2
andget_fuel/1
instead.
Changed
- Dependency updates (most notably wasmtime and rustler) - thanks @RoyalIcing and @scrogson
- removed dialyzer
v0.8.3
Added
- added support for
riscv64gc-unknown-linux-gnu
- added support for OTP 26
Changed
- updated rustler from 0.27.0 to 0.28.0
- updated wasmtime from 4.0.1 to 9.0.1
v0.8.2
Added
- list
aarch64-unknown-linux-musl
in rustler targets, so we actually include it in our releases
v0.8.1
This release makes running user-provided WASM binaries a whole bunch safter by providing restrictions on memory and CPU usage.
Have a look at Wasmex.StoreLimits
for memory restrictions and Wasmer.EngineConfig
on how to limit fuel (CPU usage quota).
The new Wasmex.EngineConfig
allows better reporting when WASM execution fails -- setting wasm_backtrace_details
enables error backtraces to include file and line number information if that debug info is available in the running WASM file.
A Wasmex.EngineConfig
is used to create a Wasmex.Engine
, which holds configuration for a Wasmex.Store
. It allows us to selectively enable/disable more WASM option (e.g. enabling certain WASM proposals).
Today, a Wasmex.Engine
already gives us a faster way to precompile modules without the need to instantiate them through Wasmex.Engine.precompile_module/2
.
Added
- Added precompiled binary for
aarch64-unknown-linux-musl
- Added support for setting store limits. This allows users to limit memory usage, instance creation, table sizes and more. See
Wasmex.StoreLimits
for details. - Added support for metering/fuel_consumption. This allows users to limit CPU usage. A
Wasmex.Store
can be given fuel, where each WASM instruction of a running WASM binary uses a certain amount of fuel. If no fuel remains, execution stops. SeeWasmex.EngineConfig
for details. - Added
Wasmex.EngineConfig
as a place for more complex WASM settings. With this release an engine can be configured to provide more detailed backtraces on errors during WASM execution by setting thewasm_backtrace_details
flag. - Added
Wasmex.Engine.precompile_module/2
which allows module precompilation from a .wat or .wasm binary without the need to instantiate said module. A precompiled module can be hydrated withModule.unsafe_deserialize/2
. - Added
Wasmex.module/1
andWasmex.store/1
to access the module and store of a running Wasmex GenServer process. - Added option to
Wasmex.EngineConfig
to configure thecranelift_opt_level
(:none, :speed, :speed_and_size) allowing users to trade compilation time against execution speed
Changed
mix.exs
now also requires at least Elixir 1.12Module.unsafe_deserialize/2
now accepts aWasmex.Engine
in addition to the serialized module binary. It's best to hydrate a module using the same engine config used to serialize or precompile it. It has no harsh consequences today, but will be important when we add more WASM features (e.g. SIMD support) in the future.- added typespecs for all public
Wasmex
methods - improved documentation and typespecs
- allow starting the
Wasmex
GenServer with a%{bytes: bytes, store: store}
map as a convenience to spare users the task of manually compiling aWasmex.Module
v0.8.0
This release brings some changes to our API because of the change of the underlying WASM engine to wasmtime.
It brings a new abstraction, the Wasmex.Store
, which holds all internal structures. Thus, the store (or a "caller" in function-call contexts) needs to be provided in most Wasmex APIs in the form of a Wasmex.StoreOrCaller
struct.
The WASM engine change requires us to do further changes, most notably a change in how Wasmex.Memory
is accessed. We dropped support for different data types and simplified the memory model to be just an array of bytes. The concept of memory offsets was dropped.
Special thanks goes to @hamptokr for his help in getting the wasmtime/Rust side working 💜
Please see the list of changes below for more details.
Added
- Added support for OTP 25
- Added support for Elixir 1.14
Removed
- Removed official support for OTP 22 and 23
- Removed official support for Elixir 1.12
- Removed
Wasmex.Module.set_name()
without replacement as this is not supported by Wasmtime - Removed
Wasmex.Memory.bytes_per_element()
without replacement because we dropped support for different data types and now only handle bytes - Removed
Wasmex.Pipe.set_len()
without replacement - WASI directory/file preopens can not configure read/write/create permissions anymore because wasmtime does not support this feature well. We very much plan to add support back once wasmtime allows.
Changed
- Changed the underlying WASM engine from wasmer to wasmtime
- Removed
Wasmex.Instance.new()
andWasmex.Instance.new_wasi()
in favor ofWasmex.Store.new()
andWasmex.Store.new_wasi()
. - WASI-options to
Wasmex.Store.new_wasi()
are now a proper structWasmex.Wasi.WasiOptions
to improve typespecs, docs, and compile-time warnings. Wasmex.Pipe
went through an internal rewrite. It is now a positioned read/write stream. You may change the read/write position withWasmex.Pipe.seek()
- Renamed
Wasmex.Pipe.create()
toWasmex.Pipe.new()
to be consistent with other struct-creation calls - Renamed
Wasmex.Memory.length()
toWasmex.Memory.size()
for consistenct with othersize
methods - Renamed
Wasmex.Memory.set()
toWasmex.Memory.set_byte()
- Renamed
Wasmex.Memory.get()
toWasmex.Memory.get_byte()
- Updated and rewrote most of the docs - all examples are now doctests and tested on CI
- Updated all Elixir/Rust dependencies
v0.7.1
Added
- Added an optional fourth parameter to call_function, timeout, which accepts a value in milliseconds that will cap the execution time of the function. The default behavior if not supplied is preserved, which is a 5 second timeout. Thanks @brooksmtownsend for this contribution
- several dependency updates
v0.7.0
Added
- Added support for precompiled binaries. This should reduce compilation time of wasmex significantly. At the same time it frees most of our users from needing to install Rust. Thanks @fahchen for implementing this feature
Changed
- Wasmex now aims to support the last three elixir and OTP releases. The oldest supported versions for this release are elixir 1.11.4 and OTP 22.3 - Thanks to @fahchen for contributing the CI workflow to test older elixir/OTP versions
- Moved CI systems from CircleCI to GitHub Actions. Let me thank CircleCI for the years of free of charge CI runs, thanks! Let me also thank @fahchen for contributing this change
- Thanks to @phaleth for fixing page sizes in our Memory documentation
- Updated several project dependencies, most notably wasmer to 2.1.1
v0.6.0
Added
Wasmex.Module.compile/1
which compiles a .wasm file into a module. This module can be given to the new methodsWasmex.Instance.new/2
andWasmex.Instance.new_wasi/3
allowing to re-use precompiled modules. This has a big potential speed-up if one wishes to run a WASI instance multiple times. For example, the wasmex test suite went from 14.5s to 0.6s runtime with this release.Wasmex.start_link
can now be called with a precompiled module.Wasmex.Module.compile/1
can now parse WebAssembly text format (WAT) too.- WASM modules without exported memory can now be instantiated without error.
- Added the following functions to
Wasmex.Module
:serialize/1
andunsafe_deserialize/1
which allows serializing a module into a binary and backname/1
andset_name/1
which allows getting/setting a modules name for better debuggingimports/1
andexports/1
which lists a modules imports and exports
Deprecated
Instance.from_bytes/2
andInstance.wasi_from_bytes/3
are deprecated in favor ofWasmex.Instance.new/2
andWasmex.Instance.new_wasi/3
. Both may be removed in any release after this one.