pub trait Compiler: Send + Debug {
// Required methods
fn name(&self) -> &str;
fn deterministic_id(&self) -> String;
fn compile_module(
&self,
target: &Target,
module: &CompileModuleInfo,
compile_info_blob: &[u8],
module_translation: &ModuleTranslationState,
function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'_>>,
progress_callback: Option<&CompilationProgressCallback>,
) -> Result<Compilation, CompileError>;
fn get_middlewares(&self) -> &[Arc<dyn ModuleMiddleware>];
// Provided methods
fn artifact_format(&self) -> String { ... }
fn with_opts(
&mut self,
_suggested_compiler_opts: &UserCompilerOptimizations,
) -> Result<(), CompileError> { ... }
fn validate_module(
&self,
features: &Features,
data: &[u8],
) -> Result<(), CompileError> { ... }
fn enable_readonly_funcref_table(&self) -> bool { ... }
fn get_cpu_features_used(
&self,
cpu_features: &EnumSet<CpuFeature>,
) -> EnumSet<CpuFeature> { ... }
fn get_perfmap_enabled(&self) -> bool { ... }
fn get_debugger(&self) -> Option<Debugger> { ... }
}Expand description
An implementation of a Compiler from parsed WebAssembly module to Compiled native code.
Required Methods§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Returns a descriptive name for this compiler.
Note that this is an API breaking change since 3.0
Sourcefn deterministic_id(&self) -> String
fn deterministic_id(&self) -> String
Returns the deterministic id of this compiler. Same compilers with different optimizations map to different deterministic IDs.
Sourcefn compile_module(
&self,
target: &Target,
module: &CompileModuleInfo,
compile_info_blob: &[u8],
module_translation: &ModuleTranslationState,
function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'_>>,
progress_callback: Option<&CompilationProgressCallback>,
) -> Result<Compilation, CompileError>
fn compile_module( &self, target: &Target, module: &CompileModuleInfo, compile_info_blob: &[u8], module_translation: &ModuleTranslationState, function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'_>>, progress_callback: Option<&CompilationProgressCallback>, ) -> Result<Compilation, CompileError>
Compiles a parsed module.
It returns the Compilation or a [CompileError].
Sourcefn get_middlewares(&self) -> &[Arc<dyn ModuleMiddleware>]
fn get_middlewares(&self) -> &[Arc<dyn ModuleMiddleware>]
Get the middlewares for this compiler
Provided Methods§
Sourcefn artifact_format(&self) -> String
fn artifact_format(&self) -> String
Returns the used artifact format: rkyv or native.
Sourcefn with_opts(
&mut self,
_suggested_compiler_opts: &UserCompilerOptimizations,
) -> Result<(), CompileError>
👎Deprecated: User compilation options are currently unused
fn with_opts( &mut self, _suggested_compiler_opts: &UserCompilerOptimizations, ) -> Result<(), CompileError>
User compilation options are currently unused
Add suggested optimizations to this compiler.
Sourcefn validate_module(
&self,
features: &Features,
data: &[u8],
) -> Result<(), CompileError>
fn validate_module( &self, features: &Features, data: &[u8], ) -> Result<(), CompileError>
Validates a module.
It returns the a successful Result in case is valid, CompileError in case is not.
Sourcefn enable_readonly_funcref_table(&self) -> bool
fn enable_readonly_funcref_table(&self) -> bool
Get whether translation-time readonly funcref table analysis should run.
Sourcefn get_cpu_features_used(
&self,
cpu_features: &EnumSet<CpuFeature>,
) -> EnumSet<CpuFeature>
fn get_cpu_features_used( &self, cpu_features: &EnumSet<CpuFeature>, ) -> EnumSet<CpuFeature>
Get the CpuFeatures used by the compiler
Sourcefn get_perfmap_enabled(&self) -> bool
fn get_perfmap_enabled(&self) -> bool
Get whether perfmap is enabled or not.
Sourcefn get_debugger(&self) -> Option<Debugger>
fn get_debugger(&self) -> Option<Debugger>
Get the enabled debugger command-file format, if any.