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

Method run

cranelift/filetests/src/test_unwind.rs:37–72  ·  view source on GitHub ↗
(&self, func: Cow<ir::Function>, context: &Context)

Source from the content-addressed store, hash-verified

35 }
36
37 fn run(&self, func: Cow<ir::Function>, context: &Context) -> anyhow::Result<()> {
38 let isa = context.isa.expect("unwind needs an ISA");
39 let mut comp_ctx = cranelift_codegen::Context::for_function(func.into_owned());
40
41 let code = comp_ctx
42 .compile(isa, &mut Default::default())
43 .expect("failed to compile function");
44
45 let mut text = String::new();
46 match code.create_unwind_info(isa).expect("unwind info") {
47 Some(UnwindInfo::WindowsX64(info)) => {
48 let mut mem = vec![0; info.emit_size()];
49 info.emit(&mut mem);
50 windowsx64::dump(&mut text, &mem);
51 }
52 Some(UnwindInfo::SystemV(info)) => {
53 let mut table = FrameTable::default();
54 let cie = isa
55 .create_systemv_cie()
56 .expect("the ISA should support a System V CIE");
57
58 let cie_id = table.add_cie(cie);
59 table.add_fde(cie_id, info.to_fde(Address::Constant(0)));
60
61 let mut eh_frame = EhFrame(EndianVec::new(LittleEndian));
62 table.write_eh_frame(&mut eh_frame).unwrap();
63 systemv::dump(&mut text, &eh_frame.0.into_vec(), isa.pointer_bytes())
64 }
65 Some(ui) => {
66 anyhow::bail!("Unexpected unwind info type: {ui:?}");
67 }
68 None => {}
69 }
70
71 run_filecheck(&text, context)
72 }
73}
74
75mod windowsx64 {

Callers

nothing calls this directly

Calls 14

dumpFunction · 0.85
run_filecheckFunction · 0.85
into_ownedMethod · 0.80
to_fdeMethod · 0.80
newFunction · 0.50
ConstantClass · 0.50
expectMethod · 0.45
compileMethod · 0.45
create_unwind_infoMethod · 0.45
emitMethod · 0.45
create_systemv_cieMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected