mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-29 08:31:32 +00:00
Improved trap catching with call_protected macro
This commit is contained in:
committed by
Lachlan Sneff
parent
6d09fab498
commit
a44a3b0456
@ -516,16 +516,13 @@ impl Instance {
|
||||
get_function_addr(&func_index, &self.import_functions, &self.functions)
|
||||
}
|
||||
|
||||
pub fn start_func(&self, func_index: FuncIndex) -> Result<(), i32> {
|
||||
let func: fn(&Instance) = get_instance_function!(&self, func_index);
|
||||
unsafe { recovery::protected_call(func, self) }
|
||||
}
|
||||
|
||||
pub fn start(&self) -> Result<(), i32> {
|
||||
pub fn start(&self) -> Result<(), ErrorKind> {
|
||||
if let Some(func_index) = self.start_func {
|
||||
self.start_func(func_index)
|
||||
} else {
|
||||
panic!("start func not found")
|
||||
let func: fn(&Instance) = get_instance_function!(&self, func_index);
|
||||
call_protected!(func(self))
|
||||
}
|
||||
else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user