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

Function module_for

cranelift/object/tests/basic.rs:326–336  ·  view source on GitHub ↗

Build an `ObjectModule` for `triple` with the unwind-info builder flag set to `unwind_info`. Frame pointers are forced on so cranelift emits a non-trivial prologue (and therefore unwind info) for every function.

(triple: &str, unwind_info: bool)

Source from the content-addressed store, hash-verified

324 /// set to `unwind_info`. Frame pointers are forced on so cranelift emits
325 /// a non-trivial prologue (and therefore unwind info) for every function.
326 fn module_for(triple: &str, unwind_info: bool) -> ObjectModule {
327 let mut flag_builder = settings::builder();
328 flag_builder.set("preserve_frame_pointers", "true").unwrap();
329 let isa = cranelift_codegen::isa::lookup_by_name(triple)
330 .unwrap()
331 .finish(settings::Flags::new(flag_builder))
332 .unwrap();
333 let mut builder = ObjectBuilder::new(isa, "test", default_libcall_names()).unwrap();
334 builder.unwind_info(unwind_info);
335 ObjectModule::new(builder)
336 }
337
338 /// Define a leaf function that just returns. With `preserve_frame_pointers`
339 /// on, this is enough to make cranelift emit a System V FDE for it.

Calls 8

lookup_by_nameFunction · 0.85
default_libcall_namesFunction · 0.85
builderFunction · 0.50
newFunction · 0.50
unwrapMethod · 0.45
setMethod · 0.45
finishMethod · 0.45
unwind_infoMethod · 0.45

Tested by

no test coverage detected