Generate trampolines based on signatures (#947)
* Generate trampolines based on signatures Instead of generating a trampoline-per-function generate a trampoline-per-signature. This should hopefully greatly increase the cache hit rate on trampolines within a module and avoid generating a function-per-function. * Update crates/runtime/src/traphandlers.rs Co-Authored-By: Sergei Pepyakin <s.pepyakin@gmail.com> Co-authored-by: Sergei Pepyakin <s.pepyakin@gmail.com>
This commit is contained in:
@@ -7,7 +7,8 @@ int WasmtimeCallTrampoline(
|
||||
void **buf_storage,
|
||||
void *vmctx,
|
||||
void *caller_vmctx,
|
||||
void (*body)(void*, void*, void*),
|
||||
void (*trampoline)(void*, void*, void*, void*),
|
||||
void *body,
|
||||
void *args)
|
||||
{
|
||||
jmp_buf buf;
|
||||
@@ -15,12 +16,16 @@ int WasmtimeCallTrampoline(
|
||||
return 0;
|
||||
}
|
||||
*buf_storage = &buf;
|
||||
body(vmctx, caller_vmctx, args);
|
||||
trampoline(vmctx, caller_vmctx, body, args);
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
int WasmtimeCall(void **buf_storage, void *vmctx, void *caller_vmctx, void (*body)(void*, void*)) {
|
||||
int WasmtimeCall(
|
||||
void **buf_storage,
|
||||
void *vmctx,
|
||||
void *caller_vmctx,
|
||||
void (*body)(void*, void*)) {
|
||||
jmp_buf buf;
|
||||
if (setjmp(buf) != 0) {
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user