CompilerConfig

Trait CompilerConfig 

pub trait CompilerConfig {
    // Required methods
    fn compiler(self: Box<Self>) -> Box<dyn Compiler>;
    fn push_middleware(&mut self, middleware: Arc<dyn ModuleMiddleware>);

    // Provided methods
    fn enable_pic(&mut self) { ... }
    fn enable_verifier(&mut self) { ... }
    fn enable_perfmap(&mut self) { ... }
    fn enable_non_volatile_memops(&mut self) { ... }
    fn enable_experimental_unaligned_memory_accesses(&mut self) { ... }
    fn enable_readonly_funcref_table(&mut self) { ... }
    fn canonicalize_nans(&mut self, _enable: bool) { ... }
    fn default_features_for_target(&self, target: &Target) -> Features { ... }
    fn supported_features_for_target(&self, _target: &Target) -> Features { ... }
}
Expand description

The compiler configuration options.

Required Methods§

fn compiler(self: Box<Self>) -> Box<dyn Compiler>

Gets the custom compiler config

fn push_middleware(&mut self, middleware: Arc<dyn ModuleMiddleware>)

Pushes a middleware onto the back of the middleware chain.

Provided Methods§

fn enable_pic(&mut self)

Enable Position Independent Code (PIC).

This is required for shared object generation (Native Engine), but will make the JIT Engine to fail, since PIC is not yet supported in the JIT linking phase.

fn enable_verifier(&mut self)

Enable compiler IR verification.

For compilers capable of doing so, this enables internal consistency checking.

fn enable_perfmap(&mut self)

Enable generation of perfmaps to sample the JIT compiled frames.

fn enable_non_volatile_memops(&mut self)

For the LLVM compiler, we can use non-volatile memory operations which lead to a better performance (but are not 100% SPEC compliant).

fn enable_experimental_unaligned_memory_accesses(&mut self)

Enable run-time handling of potentially unaligned memory accesses.

This feature is experimental and currently supports only Cranelift scalar types and Singlepass on RISC-V for integral types.

fn enable_readonly_funcref_table(&mut self)

Enables treating eligible funcref tables as read-only so the backend can place them in read-only data.

fn canonicalize_nans(&mut self, _enable: bool)

Enable NaN canonicalization.

NaN canonicalization is useful when trying to run WebAssembly deterministically across different architectures.

fn default_features_for_target(&self, target: &Target) -> Features

Gets the default features for this compiler in the given target

fn supported_features_for_target(&self, _target: &Target) -> Features

Gets the supported features for this compiler in the given target

Trait Implementations§

§

impl<T> From<T> for Box<dyn CompilerConfig>
where T: CompilerConfig + 'static,

§

fn from(other: T) -> Box<dyn CompilerConfig>

Converts to this type from the input type.

Implementors§