Cranelift: ensure ISA level needed for SIMD is present when SIMD is enabled. (#3816)
Addresses #3809: when we are asked to create a Cranelift backend with shared flags that indicate support for SIMD, we should check that the ISA level needed for our SIMD lowerings is present.
This commit is contained in:
@@ -101,12 +101,15 @@ impl CompilerBuilder for Builder {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn build(&self) -> Box<dyn wasmtime_environ::Compiler> {
|
||||
fn build(&self) -> Result<Box<dyn wasmtime_environ::Compiler>> {
|
||||
let isa = self
|
||||
.isa_flags
|
||||
.clone()
|
||||
.finish(settings::Flags::new(self.flags.clone()));
|
||||
Box::new(crate::compiler::Compiler::new(isa, self.linkopts.clone()))
|
||||
.finish(settings::Flags::new(self.flags.clone()))?;
|
||||
Ok(Box::new(crate::compiler::Compiler::new(
|
||||
isa,
|
||||
self.linkopts.clone(),
|
||||
)))
|
||||
}
|
||||
|
||||
fn settings(&self) -> Vec<Setting> {
|
||||
|
||||
@@ -104,7 +104,7 @@ pub trait CompilerBuilder: Send + Sync + fmt::Debug {
|
||||
fn settings(&self) -> Vec<Setting>;
|
||||
|
||||
/// Builds a new [`Compiler`] object from this configuration.
|
||||
fn build(&self) -> Box<dyn Compiler>;
|
||||
fn build(&self) -> Result<Box<dyn Compiler>>;
|
||||
}
|
||||
|
||||
/// Description of compiler settings returned by [`CompilerBuilder::settings`].
|
||||
|
||||
@@ -64,7 +64,7 @@ impl Engine {
|
||||
Ok(Engine {
|
||||
inner: Arc::new(EngineInner {
|
||||
#[cfg(compiler)]
|
||||
compiler: config.compiler.build(),
|
||||
compiler: config.compiler.build()?,
|
||||
config,
|
||||
allocator,
|
||||
signatures: registry,
|
||||
|
||||
Reference in New Issue
Block a user