alexcrichton opened PR #3206 from refactor-compiler
to main
:
This commit concludes the saga of refactoring Wasmtime and making
Cranelift an optional dependency by adding a new Cargo feature to the
wasmtime
crate calledcranelift
, which is enabled by default.This feature is implemented by having a new cfg for
wasmtime
itself,
cfg(compiler)
, which is used wherever compilation is necessary. This
bubbles up to disable APIs such asModule::new
,Func::new
,
Engine::precompile_module
, and a number ofConfig
methods affecting
compiler configuration. Checks are added to CI that when built in this
mode Wasmtime continues to successfully build. It's hoped that although
this is effectively "sprinkle#[cfg]
until things compile" this won't
be too too bad to maintain over time since it's also an use case we're
interested in supporting.With
cranelift
disabled the only way to create aModule
is with the
Module::deserialize
method, which requires some form of precompiled
artifact.Two consequences of this change are:
Module::serialize
is also disabled in this mode. The reason for this
is that serialized modules contain ISA/shared flags encoded in them
which were used to produce the compiled code. There's no storage for
this if compilation is disabled. This could probably be re-enabled in
the future if necessary, but it may not end up being all that necessary.Deserialized modules are not checked to ensure that their ISA/shared
flags are compatible with the host CPU. This is actually already the
case, though, with normal modules. We'll likely want to fix this in
the future using a shared implementation for both these locations.Documentation should be updated to indicate that
cranelift
can be
disabled, although it's not really the most prominent documentation
because this is expected to be a somewhat niche use case (albeit
important, just not too common).
alexcrichton requested pchickey for a review on PR #3206.
alexcrichton updated PR #3206 from refactor-compiler
to main
.
alexcrichton updated PR #3206 from refactor-compiler
to main
.
bjorn3 created PR review comment:
cranelift is enabled by default so this is equivalent to not passin
--feature
bjorn3 submitted PR review.
bjorn3 edited PR review comment.
pchickey submitted PR review.
alexcrichton updated PR #3206 from refactor-compiler
to main
.
alexcrichton merged PR #3206.
Last updated: Nov 22 2024 at 16:03 UTC