mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-18 00:50:51 +00:00
In the `wrap` functions, we use `std::mem::transmute(&())` to get the pointer to the value “around” `wrap` (`Fn` has a method `to_raw` which declares a `wrap` function, which uses `transmute` to retrieve `Fn`). This is an undefined behavior. It was working until the `FuncCtx` is introduced. Since then, the undefined behavior was causing an error with the Singlepass backend. This patch stores the pointer to `Fn` in `func_env`, so that the pointer to the user-defined host function is always predictable.
Wasmer Runtime Core
Wasmer is a standalone JIT WebAssembly runtime, aiming to be fully compatible with WASI, Emscripten, Rust and Go. Learn more.
This crate represents the core of the runtime. Consider
[wasmer-runtime
] for higher level APIs.