Sha256: 7228e494c7d2d0d391497de1999afebed7bb7139fac0162fcb980fd3736dd5b1

Contents?: true

Size: 984 Bytes

Versions: 2

Compression:

Stored size: 984 Bytes

Contents

// For MIRI, there's no way to implement longjmp/setjmp. The only possible way
// to implement this is with panic/catch_panic, but the entrypoint into Rust
// from wasm is defined as `extern "C"` which isn't allowed to panic. That
// means that panicking here triggers UB which gets routed to `libc::abort()`.
//
// This maens that on MIRI all tests which trap are configured to be skipped at
// this time.
//
// Note that no actual JIT code runs in MIRI so this is purely here for
// host-to-host calls.

use crate::prelude::*;
use crate::runtime::vm::VMContext;

pub fn wasmtime_setjmp(
    _jmp_buf: *mut *const u8,
    callback: extern "C" fn(*mut u8, *mut VMContext) -> bool,
    payload: *mut u8,
    callee: *mut VMContext,
) -> bool {
    callback(payload, callee)
}

pub fn wasmtime_longjmp(_jmp_buf: *const u8) -> ! {
    unsafe {
        libc::abort();
    }
}

#[allow(missing_docs)]
pub type SignalHandler = Box<dyn Fn() + Send + Sync>;

pub fn lazy_per_thread_init() {}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/wasmtime-29.0.0/src/runtime/vm/sys/miri/traphandlers.rs
wasmtime-28.0.0 ./ext/cargo-vendor/wasmtime-28.0.0/src/runtime/vm/sys/miri/traphandlers.rs