mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-24 06:01:33 +00:00
Move requires pre validation into the ModuleCodeGenerator
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
use crate::fault::FaultInfo;
|
||||
use crate::{
|
||||
backend::RunnableModule,
|
||||
backend::{Backend, CacheGen, Compiler, CompilerConfig, Features, Token},
|
||||
backend::{CacheGen, Compiler, CompilerConfig, Features, Token},
|
||||
cache::{Artifact, Error as CacheError},
|
||||
error::{CompileError, CompileResult},
|
||||
module::{ModuleInfo, ModuleInner},
|
||||
@ -94,6 +94,11 @@ pub trait ModuleCodeGenerator<FCG: FunctionCodeGenerator<E>, RM: RunnableModule,
|
||||
/// Returns the backend id associated with this MCG.
|
||||
fn backend_id() -> Backend;
|
||||
|
||||
/// It sets if the current compiler requires validation before compilation
|
||||
fn requires_pre_validation(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Feeds the compiler config.
|
||||
fn feed_compiler_config(&mut self, _config: &CompilerConfig) -> Result<(), E> {
|
||||
Ok(())
|
||||
@ -222,7 +227,7 @@ impl<
|
||||
compiler_config: CompilerConfig,
|
||||
_: Token,
|
||||
) -> CompileResult<ModuleInner> {
|
||||
if requires_pre_validation(MCG::backend_id()) {
|
||||
if MCG::requires_pre_validation() {
|
||||
validate_with_features(wasm, &compiler_config.features)?;
|
||||
}
|
||||
|
||||
@ -263,15 +268,6 @@ impl<
|
||||
}
|
||||
}
|
||||
|
||||
fn requires_pre_validation(backend: Backend) -> bool {
|
||||
match backend {
|
||||
Backend::Cranelift => true,
|
||||
Backend::LLVM => true,
|
||||
Backend::Singlepass => false,
|
||||
Backend::Auto => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// A sink for parse events.
|
||||
pub struct EventSink<'a, 'b> {
|
||||
buffer: SmallVec<[Event<'a, 'b>; 2]>,
|
||||
|
Reference in New Issue
Block a user