wasmer_vm/libcalls/eh/
mod.rs

1// Part of the logic, here, is borrowed as-is from rust's stdlib.
2
3mod dwarf;
4
5cfg_if::cfg_if! {
6    if #[cfg(any(target_env = "msvc", target_family = "wasm"))] {
7        // We have yet to figure this out.
8        #[repr(C)]
9        pub struct UwExceptionWrapper {
10            pub _uwe: (),
11            pub cause: Box<dyn std::any::Any + Send>,
12        }
13
14        impl UwExceptionWrapper {
15            pub fn new(tag: u64, data_ptr: usize, data_size: u64) -> Self {
16                Self {
17                    _uwe: (),
18                    cause: Box::new(WasmerException {
19                        tag,
20                        data_ptr,
21                        data_size,
22                    }),
23                }
24            }
25        }
26
27        #[repr(C)]
28        #[derive(Debug, thiserror::Error, Clone)]
29        #[error("Uncaught exception in wasm code!")]
30        pub struct WasmerException {
31            pub tag: u64,
32            pub data_ptr: usize,
33            pub data_size: u64,
34        }
35
36        pub fn wasmer_eh_personality() {
37            panic!()
38        }
39
40        pub  fn throw(tag: u64, data_ptr: usize, data_size: u64) -> ! {
41            panic!()
42        }
43
44        pub fn rethrow(exc: *mut UwExceptionWrapper) -> ! {
45            panic!()
46        }
47
48
49    } else if #[cfg(any(
50        all(target_family = "windows", target_env = "gnu"),
51        target_family = "unix",
52    ))] {
53        // gcc-like eh-personality mechanisms.
54        mod gcc;
55        pub use gcc::*;
56    } else {
57        // Targets that don't support unwinding.
58        // - os=none ("bare metal" targets)
59        // - os=uefi
60        // - os=espidf
61        // - os=hermit
62        // - nvptx64-nvidia-cuda
63        // - arch=avr
64    }
65}