fn new(
        compiler: &mut Compiler,
        data: &'data [u8],
        resolver: &mut dyn Resolver,
    ) -> Result<Self, SetupError> {
        let environ = ModuleEnvironment::new(compiler.frontend_config(), compiler.tunables());

        let translation = environ
            .translate(data)
            .map_err(|error| SetupError::Compile(CompileError::Wasm(error)))?;

        let (allocated_functions, relocations) =
            compiler.compile(&translation.module, translation.function_body_inputs)?;

        let imports = link_module(
            &translation.module,
            &allocated_functions,
            relocations,
            resolver,
        )
        .map_err(|err| SetupError::Instantiate(InstantiationError::Link(err)))?;

        // Gather up the pointers to the compiled functions.
        let finished_functions: BoxedSlice<DefinedFuncIndex, *const VMFunctionBody> =
            allocated_functions
                .into_iter()
                .map(|(_index, allocated)| {
                    let fatptr: *const [VMFunctionBody] = *allocated;
                    fatptr as *const VMFunctionBody
                })
                .collect::<PrimaryMap<_, _>>()
                .into_boxed_slice();

        // Compute indices into the shared signature table.
        let signatures = {
            let signature_registry = compiler.signatures();
            let mut signatures = PrimaryMap::new();
            for sig in translation.module.signatures.values() {
                signatures.push(signature_registry.register(sig));
            }
            signatures
        };

        // Make all code compiled thus far executable.
        compiler.publish_compiled_code();

        Ok(Self {
            module: translation.module,
            finished_functions,
            imports,
            data_initializers: translation.data_initializers.into_boxed_slice(),
            signatures: signatures.into_boxed_slice(),
        })
    }
/// Create a new `RawCompiledModule` by compiling the wasm module in `data` and instatiating it.
Create a new `RawCompiledModule` by compiling the wasm module in `data` and instatiating it.
Create a new ` RawCompiledModule ` by compiling the wasm module in ` data ` and instatiating it .
fn new(
        compiler: &mut Compiler,
        data: &'data [u8],
        resolver: &mut dyn Resolver,
    ) -> Result<Self, SetupError> {
        let environ = ModuleEnvironment::new(compiler.frontend_config(), compiler.tunables());
        let translation = environ
            .translate(data)
            .map_err(|error| SetupError::Compile(CompileError::Wasm(error)))?;
        let (allocated_functions, relocations) =
            compiler.compile(&translation.module, translation.function_body_inputs)?;
        let imports = link_module(
            &translation.module,
            &allocated_functions,
            relocations,
            resolver,
        )
        .map_err(|err| SetupError::Instantiate(InstantiationError::Link(err)))?;
        // Gather up the pointers to the compiled functions.
        let finished_functions: BoxedSlice<DefinedFuncIndex, *const VMFunctionBody> =
            allocated_functions
                .into_iter()
                .map(|(_index, allocated)| {
                    let fatptr: *const [VMFunctionBody] = *allocated;
                    fatptr as *const VMFunctionBody
                })
                .collect::<PrimaryMap<_, _>>()
                .into_boxed_slice();
        // Compute indices into the shared signature table.
        let signatures = {
            let signature_registry = compiler.signatures();
            let mut signatures = PrimaryMap::new();
            for sig in translation.module.signatures.values() {
                signatures.push(signature_registry.register(sig));
            }
            signatures
        };
        // Make all code compiled thus far executable.
        compiler.publish_compiled_code();
        Ok(Self {
            module: translation.module,
            finished_functions,
            imports,
            data_initializers: translation.data_initializers.into_boxed_slice(),
            signatures: signatures.into_boxed_slice(),
        })
    }
fn new ( compiler : & mut Compiler , data : & ' data [ u8 ] , resolver : & mut dyn Resolver , ) -> Result < Self , SetupError > { let environ = ModuleEnvironment :: new ( compiler . frontend_config ( ) , compiler . tunables ( ) ) ; let translation = environ . translate ( data ) . map_err ( | error | SetupError :: Compile ( CompileError :: Wasm ( error ) ) ) ? ; let ( allocated_functions , relocations ) = compiler . compile ( & translation . module , translation . function_body_inputs ) ? ; let imports = link_module ( & translation . module , & allocated_functions , relocations , resolver , ) . map_err ( | err | SetupError :: Instantiate ( InstantiationError :: Link ( err ) ) ) ? ; // Gather up the pointers to the compiled functions. let finished_functions : BoxedSlice < DefinedFuncIndex , * const VMFunctionBody > = allocated_functions . into_iter ( ) . map ( | ( _index , allocated ) | { let fatptr : * const [ VMFunctionBody ] = * allocated ; fatptr as * const VMFunctionBody } ) . collect :: < PrimaryMap < _ , _ > > ( ) . into_boxed_slice ( ) ; // Compute indices into the shared signature table. let signatures = { let signature_registry = compiler . signatures ( ) ; let mut signatures = PrimaryMap :: new ( ) ; for sig in translation . module . signatures . values ( ) { signatures . push ( signature_registry . register ( sig ) ) ; } signatures } ; // Make all code compiled thus far executable. compiler . publish_compiled_code ( ) ; Ok ( Self { module : translation . module , finished_functions , imports , data_initializers : translation . data_initializers . into_boxed_slice ( ) , signatures : signatures . into_boxed_slice ( ) , } ) }
Create a new `RawCompiledModule` by compiling the wasm module in `data` and instatiating it.
Create a new ` RawCompiledModule ` by compiling the wasm module in ` data ` and instatiating it .
compiler
&mut Compiler
data
&'data [u8]
resolver
&mut dyn Resolver