Releases: wasmi-labs/wasmi
Releases · wasmi-labs/wasmi
v0.36.0 - 2024-07-24
Added
- Added support for the official Wasm C-API. (#1009)
- This allows to use Wasmi from any program that can interface with C code.
- The
wasmi_c_api_impl
crate allows to use Wasmi via the Wasm C-API from Rust code. - Visit the Wasmi C-API readme to learn more.
- Added
Instance::new
API. (#1134)- This was mainly needed to support the Wasm C-API.
- The new API offers a more low-level way for Wasm module instantiation
that may be more efficient for certain use cases.
- Added
Clone
implementation forModule
. (#1130)- This was mainly needed to support the Wasm C-API.
Changed
- The store fuel API now returns
Error
instead ofFuelError
. (#1131)- This was needed to support the Wasm C-API.
- The
FuelError
is still accessible via theError::kind
method.
v0.35.0 - 2024-07-11
Fixed
- Fixed a dead-lock that prevented users from compiling Wasm modules in host functions
called from Wasmi's executor. (#1122)- This was a very long-standing bug in the Wasmi interpreter and it is now finally closed.
- Note that this regressed performance of call-intense workloads by roughly 5-10%.
Future work is under way to hopefully fix these regressions. - Before this fix, users had to use a work-around using resumable function calls to
cirumvent this issue which is no longer necessary, fortunately.
Internals
- Add
CodeMap::alloc_funcs
API and use it when compiling Wasm modules. (#1125)- This significantly improved performance for (lazily) compiling
Wasm modules (e.g. viaModule::new
) by up to 23%.
- This significantly improved performance for (lazily) compiling
v0.34.0 - 2024-07-08
Added
- Allows Wasmi CLI to be installed with locked dependencies. (#1096)
- This can be done as follows:
cargo install --locked wasmi_cli
- This can be done as follows:
Fixed
- Allow Wasm module instantiation in host functions called from Wasmi's executor. (#1116)
Changed
- Limit number of parameter and result types in
FuncType
to 1000, each. (#1116)
Dev. Note
v0.33.1 - 2024-07-01
v0.33.0 - 2024-06-24
Added
- Added support for Wasm custom sections processing. (#1085)
- It is now possible to query name and data of Wasm custom sections of a
Module
. - Use the new
Config::ignore_custom_sections
flag to disable this functionality.
- It is now possible to query name and data of Wasm custom sections of a
- Added
Config::ignore_custom_sections
flag to disable processing custom sections if this is unwanted. (#1085) - Add
Memory::{data_ptr, data_size, size}
methods. (#1082) - Added a Wasmi usage guide documentation. (#1072)
Changed
- Optimized the Wasmi executor in various ways.
- In summary the Wasmi executor now more optimally caches the currently used
Wasm instance and optimizes access to instance related data.
In particular access to the default linear memory bytes as well as the global
variable at index 0 (often used as shadow stack pointer) are more efficient. - The following PRs are part of this effort:
- In summary the Wasmi executor now more optimally caches the currently used
- Changed
Memory::grow
signature to mirror Wasmtime'sMemory::grow
method. (#1082)
Removed
- Removed
Memory::current_pages
method. (#1082)- Users should use the new
Memory::size
method instead.
- Users should use the new
v0.32.3 - 2024-06-06
v0.32.2 - 2024-06-03
Fixed
- Refine and generalize the fix for v0.32.1. (#1054)
v0.32.1 - 2024-06-03
v0.32.0 - 2024-05-28
Note:
- This release is the culmination of months of research, development and QA
with a new execution engine utilizing register-based IR at its core boosting
both startup and execution performance to new levels for the Wasmi interpreter. - This release is accompanied with an article that presents some of the highlights.
Added
- Added a new execution engine based on register-machine bytecode. (#729)
- The register-machine Wasmi
Engine
executes roughly 80-100% faster and
compiles roughly 30% slower according to benchmarks conducted so far.
- The register-machine Wasmi
- Added
Module::new_unchecked
API. (#829)- This allows to compile a Wasm module without Wasm validation which can be useful
when users know that their inputs are valid Wasm binaries. - This improves Wasm compilation performance for faster startup times by roughly 10-20%.
- This allows to compile a Wasm module without Wasm validation which can be useful
- Added Wasm compilation modes. (#844)
- When using
Module::new
Wasmi eagerly compiles Wasm bytecode into Wasmi bytecode
which is optimized for efficient execution. However, this compilation can become very
costly especially for large Wasm binaries. - The solution to this problem is to introduce new compilation modes, namely:
CompilationMode::Eager
: Eager compilation, what Wasmi did so far. (default)CompilationMode::LazyTranslation
: Eager Wasm validation and lazy Wasm translation.CompilationMode::Lazy
: Lazy Wasm validation and translation.
- Benchmarks concluded that
CompilationMode::LazyTanslation
: Usually improves startup performance by a factor of 2 to 3.CompilationMode::Lazy
: Usually improves startup performance by a factor of up to 27.
- Note that
CompilationMode::Lazy
can lead to partially validated Wasm modules
which can introduce non-determinism when using different Wasm implementations.
Therefore users should know what they are doing when usingCompilationMode::Lazy
if this is a concern. - Enable lazy Wasm compilation with:
let mut config = wasmi::Config::default(); config.compilation_mode(wasmi::CompilationMode::Lazy);
- When
CompilationMode::Lazy
orCompilationMode::LazyTranslation
and fuel metering is enabled
the first function access that triggers compilation (and validation) will charge fuel respective
to the number of bytes of the Wasm function body. (#876)
- When using
- Added non-streaming Wasm module compilation. (#1035)
- So far Wasmi only offered a streaming Wasm module compilation API, however most users
probably never really needed that. So starting from this version bothModule::new
and
Module::new_unchecked
are now non-streaming with insane performance improvements of up
to 80% in certain configurations. - For streaming Wasm module users we added
Module::new_streaming
andModule::new_streaming_unchecked
APIs.
- So far Wasmi only offered a streaming Wasm module compilation API, however most users
- Added
Module::validate
API. (#840)- This allows to quickly check if a Wasm binary is valid according to a Wasmi
Engine
config. - Note that this does not translate the Wasm and thus
Module::new
orModule::new_unchecked
might still fail due to translation errors.
- This allows to quickly check if a Wasm binary is valid according to a Wasmi
- CLI: Added
--compilation-mode
argument to enable lazy Wasm compilation. (#849) - Added
--verbose
mode to Wasmi CLI by @tjpalmer. (#957)- By default Wasmi CLI no longer prints messages during execution.
- Added
Memory::new_static
constructor by @Ddystopia. (#939)- This allows to construct a Wasm
Memory
from a static byte array
which is especially handy for certain embedded use cases.
- This allows to construct a Wasm
- Added
LinkerBuilder
type. (#989)- Using
LinkerBuilder
to create newLinker
s with the same set of host functions is a lot more
efficient than creating thoseLinker
s the original way. However, the initialLinkerBuilder
construction will be as inefficient as building up aLinker
previously.
- Using
- Added
EnforcedLimits
configuration option toConfig
. (#985)- Some users want to run Wasm binaries in a specially restricted or limited mode.
For example this mode limits the amount of functions, globals, tables etc. can be defined
in a single Wasm module.
With this change they can enable this new strict mode usingIn future updates we might relax this to makelet mut config = wasmi::Config::default(); config.engine_limits(wasmi::EnforcedLimits::strict());
EnforcedLimits
fully customizable.
- Some users want to run Wasm binaries in a specially restricted or limited mode.
- Added
EngineWeak
constructed viaEngine::weak
. (#1003)- This properly mirrors the Wasmtime API and allows users to store weak references to the
Engine
.
- This properly mirrors the Wasmtime API and allows users to store weak references to the
- Added
no-hash-maps
crate feature to thewasmi
crate. (#1007)- This tells the
wasmi
crate to avoid using hash based data structures which can be beneficial for
running Wasmi in some embedded environments such aswasm32-unknown-unknown
that do not support
random sources and thus are incapable to spawn hash maps that are resilient to malicious actors. - Note that Wasmi has always avoided using hash map based data structures prior to this change so
not enabling this new crate feature kind of acts as an optimization.
- This tells the
- Added
Default
implementation forStore<T> where T: Default
. (#1031)- This mostly serves as a convenient way to create a minimal Wasmi setup.
- Added
WasmTy
implementations forf32
andf64
Rust primitives. (#1031)- This is convenience for
Linker::func_wrap
calls that take those primitives as arguments.
Before this change users had to useF32
andF64
instead which is a bit cumbersome.
- This is convenience for
Changed
- Minimum Rust version set to 1.77. (#961)
- CLI: Enabled Wasm
tail-calls
andextend-const
proposals by default. (#849)- We expect those Wasm proposals to be stabilized very soon so we feel safe to enable them by default already.
- Improved
Debug
andDisplay
impls for NaNs of Wasmf32
andf64
values.- They now show
nan:0x{bytes}
where{bytes}
is their respective raw bytes.
- They now show
- Implement
Sync
forResumableInvocation
andTypedResumableInvocation
. (#870) - Properly mirror Wasmtime's fuel API. (#1002)
- Renamed some Wasmi items to improve its Wasmtime mirroring. (#1011)
- Improved Wasmtime API mirror for Store fuel. (#1002)
- Enabled
Config::tail_call
andConfig::extended_const
by default. (#1031)- Those Wasm proposals have been moved to phase 4 for many months now.
Removed
- Removed the stack-machine bytecode based Wasmi
Engine
backend. (#818)- The new register-machine bytecode based Wasmi
Engine
is more promising
and the Wasmi team does not want to maintain two different engine backends.
- The new register-machine bytecode based Wasmi
- Removed
FuelConsumptionMode
fromConfig
. (#877)FuelConsumptionMode
was required to differentiate between lazy and eager fuel consumption.
This was necessary due to how lazy fuel consumption was implemented in that it would pre-charge
for instruction execution were the exact amount of required fuel was not possible to determine
at compilation time. Examples arememory.grow
andtable.copy
instructions. The linked PR
improved lazy fuel consumption to no longer pre-charge and instead pre-check if the operation
is going to succeed and only charge fuel in that case.
Dev. Note
v0.31.2 - 2024-01-24
Fixes
- Fixes a
Sync
impl bug inwasmi_arena
.