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

Method declare_func_in_func

cranelift/module/src/module.rs:904–918  ·  view source on GitHub ↗

Use this when you're building the IR of a function to reference a function. TODO: Coalesce redundant decls and signatures. TODO: Look into ways to reduce the risk of using a FuncRef in the wrong function.

(&mut self, func_id: FuncId, func: &mut ir::Function)

Source from the content-addressed store, hash-verified

902 /// TODO: Coalesce redundant decls and signatures.
903 /// TODO: Look into ways to reduce the risk of using a FuncRef in the wrong function.
904 fn declare_func_in_func(&mut self, func_id: FuncId, func: &mut ir::Function) -> ir::FuncRef {
905 let decl = &self.declarations().functions[func_id];
906 let signature = func.import_signature(decl.signature.clone());
907 let user_name_ref = func.declare_imported_user_function(ir::UserExternalName {
908 namespace: 0,
909 index: func_id.as_u32(),
910 });
911 let colocated = decl.linkage.is_final();
912 func.import_function(ir::ExtFuncData {
913 name: ir::ExternalName::user(user_name_ref),
914 signature,
915 colocated,
916 patchable: false,
917 })
918 }
919
920 /// Use this when you're building the IR of a function to reference a data object.
921 ///

Callers

nothing calls this directly

Implementers 3

module.rscranelift/module/src/module.rs
backend.rscranelift/jit/src/backend.rs
backend.rscranelift/object/src/backend.rs

Calls 7

declarationsMethod · 0.45
import_signatureMethod · 0.45
cloneMethod · 0.45
as_u32Method · 0.45
is_finalMethod · 0.45
import_functionMethod · 0.45

Tested by

no test coverage detected