Skip to content

Releases: tessi/wasmex

v0.9.2

08 Nov 11:35
Compare
Choose a tag to compare

Added

Changed

  • Updated rustler to 0.35.0 and rustler_precompiled to 0.8 (thanks @DnOberon)
  • Updated wasmtime to 26.0.1

v0.9.1

08 Nov 11:40
4b41a93
Compare
Choose a tag to compare
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

25 Jul 09:56
4bf8bfd
Compare
Choose a tag to compare

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 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)
  • 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 call set_fuel/2 and get_fuel/1 instead.

Changed

  • Dependency updates (most notably wasmtime and rustler) - thanks @RoyalIcing and @scrogson
  • removed dialyzer

v0.8.3

24 May 13:57
f639b48
Compare
Choose a tag to compare

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

08 Jan 10:43
Compare
Choose a tag to compare

Added

  • list aarch64-unknown-linux-musl in rustler targets, so we actually include it in our releases

v0.8.1

08 Jan 10:13
Compare
Choose a tag to compare

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. See Wasmex.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 the wasm_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 with Module.unsafe_deserialize/2.
  • Added Wasmex.module/1 and Wasmex.store/1 to access the module and store of a running Wasmex GenServer process.
  • Added option to Wasmex.EngineConfig to configure the cranelift_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.12
  • Module.unsafe_deserialize/2 now accepts a Wasmex.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 a Wasmex.Module

v0.8.0

03 Jan 10:08
Compare
Choose a tag to compare

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() and Wasmex.Instance.new_wasi() in favor of Wasmex.Store.new() and Wasmex.Store.new_wasi().
  • WASI-options to Wasmex.Store.new_wasi() are now a proper struct Wasmex.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 with Wasmex.Pipe.seek()
  • Renamed Wasmex.Pipe.create() to Wasmex.Pipe.new() to be consistent with other struct-creation calls
  • Renamed Wasmex.Memory.length() to Wasmex.Memory.size() for consistenct with other size methods
  • Renamed Wasmex.Memory.set() to Wasmex.Memory.set_byte()
  • Renamed Wasmex.Memory.get() to Wasmex.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

25 May 18:38
Compare
Choose a tag to compare

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

27 Mar 21:46
Compare
Choose a tag to compare

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

07 Aug 11:32
Compare
Choose a tag to compare

Added

  • Wasmex.Module.compile/1 which compiles a .wasm file into a module. This module can be given to the new methods Wasmex.Instance.new/2 and Wasmex.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 and unsafe_deserialize/1 which allows serializing a module into a binary and back
    • name/1 and set_name/1 which allows getting/setting a modules name for better debugging
    • imports/1 and exports/1 which lists a modules imports and exports

Deprecated

  • Instance.from_bytes/2 and Instance.wasi_from_bytes/3 are deprecated in favor of Wasmex.Instance.new/2 and Wasmex.Instance.new_wasi/3. Both may be removed in any release after this one.