MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / compile

Method compile

cranelift/codegen/src/context.rs:211–225  ·  view source on GitHub ↗

Compile the function, Run the function through all the passes necessary to generate code for the target ISA represented by `isa`. The generated machine code is not relocated. Instead, any relocations can be obtained from `compiled_code.buffer.relocs()`. Performs any optimizations that are enabled, unless `optimize()` was already invoked. Returns the generated machine code as well as information

(
        &mut self,
        isa: &dyn TargetIsa,
        ctrl_plane: &mut ControlPlane,
    )

Source from the content-addressed store, hash-verified

209 /// Returns the generated machine code as well as information about
210 /// the function's code and read-only data.
211 pub fn compile(
212 &mut self,
213 isa: &dyn TargetIsa,
214 ctrl_plane: &mut ControlPlane,
215 ) -> CompileResult<'_, &CompiledCode> {
216 let stencil = self
217 .compile_stencil(isa, ctrl_plane)
218 .map_err(|error| CompileError {
219 inner: error,
220 func: &self.func,
221 })?;
222 Ok(self
223 .compiled_code
224 .insert(stencil.apply_params(&self.func.params)))
225 }
226
227 /// If available, return information about the code layout in the
228 /// final machine code: the offsets (in bytes) of each basic-block

Callers 10

compile_with_cacheMethod · 0.45
compile_and_emitMethod · 0.45
test_simple_funcFunction · 0.45
test_multi_return_funcFunction · 0.45
test_simple_funcFunction · 0.45
test_multi_return_funcFunction · 0.45
test_simple_funcFunction · 0.45
test_multi_return_funcFunction · 0.45
test_simple_funcFunction · 0.45
test_multi_return_funcFunction · 0.45

Calls 4

OkFunction · 0.85
compile_stencilMethod · 0.80
apply_paramsMethod · 0.80
insertMethod · 0.45

Tested by 8

test_simple_funcFunction · 0.36
test_multi_return_funcFunction · 0.36
test_simple_funcFunction · 0.36
test_multi_return_funcFunction · 0.36
test_simple_funcFunction · 0.36
test_multi_return_funcFunction · 0.36
test_simple_funcFunction · 0.36
test_multi_return_funcFunction · 0.36