mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-22 13:11:32 +00:00
Fix tests for the Cranelift backend
This commit is contained in:
@ -50,8 +50,8 @@ typedef struct {
|
||||
} callbacks_t;
|
||||
|
||||
typedef struct {
|
||||
size_t data, vtable;
|
||||
} box_any_t;
|
||||
size_t data;
|
||||
} runtime_error_t;
|
||||
|
||||
enum WasmTrapType {
|
||||
Unreachable = 0,
|
||||
@ -121,7 +121,7 @@ private:
|
||||
|
||||
struct WasmErrorSink {
|
||||
WasmTrapType *trap_out;
|
||||
box_any_t *user_error;
|
||||
runtime_error_t *user_error;
|
||||
};
|
||||
|
||||
struct WasmException : std::exception {
|
||||
@ -149,14 +149,14 @@ public:
|
||||
|
||||
struct UserException : UncatchableException {
|
||||
public:
|
||||
UserException(size_t data, size_t vtable) : error_data({data, vtable}) {}
|
||||
UserException(size_t data) : error_data({data}) {}
|
||||
|
||||
virtual std::string description() const noexcept override {
|
||||
return "user exception";
|
||||
}
|
||||
|
||||
// The parts of a `Box<dyn Any>`.
|
||||
box_any_t error_data;
|
||||
// The pointer to `Option<RuntimeError>`.
|
||||
runtime_error_t error_data;
|
||||
|
||||
virtual void write_error(WasmErrorSink &out) const noexcept override {
|
||||
*out.user_error = error_data;
|
||||
@ -274,10 +274,10 @@ result_t module_load(const uint8_t *mem_ptr, size_t mem_size,
|
||||
|
||||
void module_delete(WasmModule *module) { delete module; }
|
||||
|
||||
// Throw a fat pointer that's assumed to be `*mut dyn Any` on the rust
|
||||
// Throw a pointer that's assumed to be `*mut RuntimeError` on the rust
|
||||
// side.
|
||||
[[noreturn]] void throw_any(size_t data, size_t vtable) {
|
||||
unsafe_unwind(new UserException(data, vtable));
|
||||
[[noreturn]] void throw_runtime_error(size_t data) {
|
||||
unsafe_unwind(new UserException(data));
|
||||
}
|
||||
|
||||
// Throw a pointer that's assumed to be codegen::BreakpointHandler on the
|
||||
@ -288,7 +288,7 @@ void module_delete(WasmModule *module) { delete module; }
|
||||
|
||||
bool cxx_invoke_trampoline(trampoline_t trampoline, void *ctx, void *func,
|
||||
void *params, void *results, WasmTrapType *trap_out,
|
||||
box_any_t *user_error, void *invoke_env) noexcept {
|
||||
runtime_error_t *user_error, void *invoke_env) noexcept {
|
||||
try {
|
||||
catch_unwind([trampoline, ctx, func, params, results]() {
|
||||
trampoline(ctx, func, params, results);
|
||||
|
Reference in New Issue
Block a user