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

Function create_func_refs

cranelift/codegen/src/inline.rs:1514–1550  ·  view source on GitHub ↗

Translate `ir::FuncRef`s from the callee into the caller.

(
    allocs: &InliningAllocs,
    func: &mut ir::Function,
    callee: &ir::Function,
    entity_map: &EntityMap,
)

Source from the content-addressed store, hash-verified

1512
1513/// Translate `ir::FuncRef`s from the callee into the caller.
1514fn create_func_refs(
1515 allocs: &InliningAllocs,
1516 func: &mut ir::Function,
1517 callee: &ir::Function,
1518 entity_map: &EntityMap,
1519) -> u32 {
1520 let offset = func.dfg.ext_funcs.len();
1521 let offset = u32::try_from(offset).unwrap();
1522
1523 func.dfg.ext_funcs.reserve(callee.dfg.ext_funcs.len());
1524 for ir::ExtFuncData {
1525 name,
1526 signature,
1527 colocated,
1528 patchable,
1529 } in callee.dfg.ext_funcs.values()
1530 {
1531 func.dfg.ext_funcs.push(ir::ExtFuncData {
1532 name: match name {
1533 ir::ExternalName::User(name_ref) => {
1534 ir::ExternalName::User(allocs.user_external_name_refs[*name_ref].expect(
1535 "should have translated all `ir::UserExternalNameRef`s before translating \
1536 `ir::FuncRef`s",
1537 ))
1538 }
1539 ir::ExternalName::TestCase(_)
1540 | ir::ExternalName::LibCall(_)
1541 | ir::ExternalName::KnownSymbol(_) => name.clone(),
1542 },
1543 signature: entity_map.inlined_sig_ref(*signature),
1544 colocated: *colocated,
1545 patchable: *patchable,
1546 });
1547 }
1548
1549 offset
1550}
1551
1552/// Copy stack slots from the callee into the caller.
1553fn create_stack_slots(func: &mut ir::Function, callee: &ir::Function) -> u32 {

Callers 1

create_entitiesFunction · 0.85

Calls 8

inlined_sig_refMethod · 0.80
lenMethod · 0.45
unwrapMethod · 0.45
reserveMethod · 0.45
valuesMethod · 0.45
pushMethod · 0.45
expectMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected