mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-13 00:51:20 +00:00
Merge branch 'master' into feature/cleanup-imports-unsafe
This commit is contained in:
@ -213,6 +213,8 @@ fn main() {
|
||||
|
||||
println!("cargo:rustc-link-lib=static=llvm-backend");
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=cpp/object_loader.cpp");
|
||||
println!("cargo:rerun-if-changed=cpp/object_loader.hh");
|
||||
|
||||
// Enable "nightly" cfg if the current compiler is nightly.
|
||||
if rustc_version::version_meta().unwrap().channel == rustc_version::Channel::Nightly {
|
||||
|
@ -43,6 +43,11 @@ typedef struct
|
||||
visit_fde_t visit_fde;
|
||||
} callbacks_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
size_t data, vtable;
|
||||
} box_any_t;
|
||||
|
||||
struct WasmException
|
||||
{
|
||||
public:
|
||||
@ -61,7 +66,7 @@ struct UncatchableException : WasmException
|
||||
struct UserException : UncatchableException
|
||||
{
|
||||
public:
|
||||
UserException(size_t data, size_t vtable) : data(data), vtable(vtable) {}
|
||||
UserException(size_t data, size_t vtable) : error_data({ data, vtable }) {}
|
||||
|
||||
virtual std::string description() const noexcept override
|
||||
{
|
||||
@ -69,7 +74,7 @@ struct UserException : UncatchableException
|
||||
}
|
||||
|
||||
// The parts of a `Box<dyn Any>`.
|
||||
size_t data, vtable;
|
||||
box_any_t error_data;
|
||||
};
|
||||
|
||||
struct WasmTrap : UncatchableException
|
||||
@ -194,6 +199,7 @@ extern "C"
|
||||
void *params,
|
||||
void *results,
|
||||
WasmTrap::Type *trap_out,
|
||||
box_any_t *user_error,
|
||||
void *invoke_env) throw()
|
||||
{
|
||||
try
|
||||
@ -206,6 +212,11 @@ extern "C"
|
||||
*trap_out = e.type;
|
||||
return false;
|
||||
}
|
||||
catch (const UserException &e)
|
||||
{
|
||||
*user_error = e.error_data;
|
||||
return false;
|
||||
}
|
||||
catch (const WasmException &e)
|
||||
{
|
||||
*trap_out = WasmTrap::Type::Unknown;
|
||||
|
@ -93,6 +93,7 @@ extern "C" {
|
||||
params: *const u64,
|
||||
results: *mut u64,
|
||||
trap_out: *mut WasmTrapInfo,
|
||||
user_error: *mut Option<Box<dyn Any>>,
|
||||
invoke_env: Option<NonNull<c_void>>,
|
||||
) -> bool;
|
||||
}
|
||||
|
Reference in New Issue
Block a user