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

Function __cranelift_throw

cranelift/filetests/src/function_runner.rs:631–681  ·  view source on GitHub ↗
(
    entry_fp: usize,
    exit_fp: usize,
    exit_pc: usize,
    tag: u32,
    payload1: usize,
    payload2: usize,
)

Source from the content-addressed store, hash-verified

629 target_arch = "riscv64"
630))]
631extern "C-unwind" fn __cranelift_throw(
632 entry_fp: usize,
633 exit_fp: usize,
634 exit_pc: usize,
635 tag: u32,
636 payload1: usize,
637 payload2: usize,
638) -> ! {
639 let compiled_test_file = unsafe { &*COMPILED_TEST_FILE.get() };
640 let unwind_host = wasmtime_unwinder::UnwindHost;
641 let frame_handler = |frame: &wasmtime_unwinder::Frame| -> Option<(usize, usize)> {
642 let (base, table) = compiled_test_file
643 .module
644 .as_ref()
645 .unwrap()
646 .lookup_wasmtime_exception_data(frame.pc())?;
647 let relative_pc = u32::try_from(
648 frame
649 .pc()
650 .checked_sub(base)
651 .expect("module lookup did not return a module base below the PC"),
652 )
653 .expect("module larger than 4GiB");
654
655 table
656 .lookup_pc_tag(relative_pc, tag)
657 .map(|(frame_offset, handler)| {
658 let handler_sp = frame
659 .fp()
660 .wrapping_sub(usize::try_from(frame_offset).unwrap());
661 let handler_pc = base
662 .checked_add(usize::try_from(handler).unwrap())
663 .expect("Handler address computation overflowed");
664 (handler_pc, handler_sp)
665 })
666 };
667 unsafe {
668 match wasmtime_unwinder::Handler::find(
669 &unwind_host,
670 frame_handler,
671 exit_pc,
672 exit_fp,
673 entry_fp,
674 ) {
675 Some(handler) => handler.resume_tailcc(payload1, payload2),
676 None => {
677 panic!("Expected a handler to exit for throw of tag {tag} at pc {exit_pc:x}");
678 }
679 }
680 }
681}
682
683#[cfg(not(any(
684 target_arch = "x86_64",

Callers

nothing calls this directly

Calls 11

pcMethod · 0.80
checked_subMethod · 0.80
lookup_pc_tagMethod · 0.80
getMethod · 0.45
unwrapMethod · 0.45
as_refMethod · 0.45
expectMethod · 0.45
mapMethod · 0.45
fpMethod · 0.45
checked_addMethod · 0.45

Tested by

no test coverage detected