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

Method add_functions

cranelift/filetests/src/function_runner.rs:146–167  ·  view source on GitHub ↗

Declares and compiles all functions in `functions`. Additionally creates a trampoline for each one of them.

(
        &mut self,
        functions: &[Function],
        ctrl_planes: Vec<ControlPlane>,
    )

Source from the content-addressed store, hash-verified

144 /// Declares and compiles all functions in `functions`. Additionally creates a trampoline for
145 /// each one of them.
146 pub fn add_functions(
147 &mut self,
148 functions: &[Function],
149 ctrl_planes: Vec<ControlPlane>,
150 ) -> Result<()> {
151 // Declare all functions in the file, so that they may refer to each other.
152 for func in functions {
153 self.declare_function(func)?;
154 }
155
156 let ctrl_planes = ctrl_planes
157 .into_iter()
158 .chain(std::iter::repeat(ControlPlane::default()));
159
160 // Define all functions and trampolines
161 for (func, ref mut ctrl_plane) in functions.iter().zip(ctrl_planes) {
162 self.define_function(func.clone(), ctrl_plane)?;
163 self.create_trampoline_for_function(func, ctrl_plane)?;
164 }
165
166 Ok(())
167 }
168
169 /// Registers all functions in a [TestFile]. Additionally creates a trampoline for each one
170 /// of them.

Callers 1

add_testfileMethod · 0.80

Calls 9

OkFunction · 0.85
chainMethod · 0.80
repeatFunction · 0.50
declare_functionMethod · 0.45
into_iterMethod · 0.45
iterMethod · 0.45
define_functionMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected