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

Method add_function

cranelift/object/src/unwind.rs:52–79  ·  view source on GitHub ↗

Record an FDE for the given function. Windows-flavored unwind info is silently ignored: `.pdata`/`.xdata` emission lives on a separate code path. The CIE is created lazily on the first System V FDE so that an unwind builder shared across many objects does not pay for an empty CIE when the target produces no System V info at all.

(
        &mut self,
        isa: &dyn TargetIsa,
        func_symbol: SymbolId,
        info: UnwindInfo,
    )

Source from the content-addressed store, hash-verified

50 /// objects does not pay for an empty CIE when the target produces no
51 /// System V info at all.
52 pub(crate) fn add_function(
53 &mut self,
54 isa: &dyn TargetIsa,
55 func_symbol: SymbolId,
56 info: UnwindInfo,
57 ) {
58 let UnwindInfo::SystemV(sysv) = info else {
59 return;
60 };
61 let cie_id = match self.cie_id {
62 Some(id) => id,
63 None => {
64 let Some(cie) = isa.create_systemv_cie() else {
65 return;
66 };
67 let id = self.frame_table.add_cie(cie);
68 self.cie_id = Some(id);
69 id
70 }
71 };
72 let symbol_index = self.symbols.len();
73 self.symbols.push(func_symbol);
74 let address = Address::Symbol {
75 symbol: symbol_index,
76 addend: 0,
77 };
78 self.frame_table.add_fde(cie_id, sysv.to_fde(address));
79 }
80
81 /// Serialize all collected FDEs into an `.eh_frame` section on `object`.
82 ///

Callers 2

register_functionMethod · 0.45

Calls 4

to_fdeMethod · 0.80
create_systemv_cieMethod · 0.45
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected