Optimize codegen slightly calling wasm functions

Currently wasm-calls work with `Result<T, Trap>` internally but `Trap`
is an enum defined in `wasmtime-runtime` which is actually quite large.
Since traps are supposed to be rare this commit changes these functions
to return a `Box<Trap>` which is un-boxed later up in the `wasmtime`
crate within a `#[cold]` function.
This commit is contained in:
Alex Crichton
2021-08-31 08:34:31 -07:00
parent 25755ff23a
commit c8f55ed688
7 changed files with 38 additions and 27 deletions

View File

@@ -74,7 +74,7 @@ unsafe extern "system" fn exception_handler(exception_info: PEXCEPTION_POINTERS)
})
}
pub fn lazy_per_thread_init() -> Result<(), Trap> {
pub fn lazy_per_thread_init() -> Result<(), Box<Trap>> {
// Unused on Windows
Ok(())
}