Switch to passing the vmctx hidden argument at the beginning.

This switches to passing the vmctx hidden argument at the beginning of
the argument list, rather than the end.
This commit is contained in:
Dan Gohman
2019-01-31 16:38:57 -08:00
parent e66f01b923
commit 4675948c2a
7 changed files with 43 additions and 27 deletions

View File

@@ -91,9 +91,9 @@ fn push_jmp_buf(buf: jmp_buf) {
/// return values will be written.
#[no_mangle]
pub unsafe extern "C" fn wasmtime_call_trampoline(
vmctx: *mut VMContext,
callee: *const VMFunctionBody,
values_vec: *mut u8,
vmctx: *mut VMContext,
) -> Result<(), String> {
// Reset JMP_BUFS if the stack is unwound through this point.
let _guard = ScopeGuard::new();
@@ -106,8 +106,8 @@ pub unsafe extern "C" fn wasmtime_call_trampoline(
push_jmp_buf(buf);
// Call the function!
let func: fn(*mut u8, *mut VMContext) = mem::transmute(callee);
func(values_vec, vmctx);
let func: fn(*mut VMContext, *mut u8) = mem::transmute(callee);
func(vmctx, values_vec);
Ok(())
}
@@ -116,8 +116,8 @@ pub unsafe extern "C" fn wasmtime_call_trampoline(
/// return values.
#[no_mangle]
pub unsafe extern "C" fn wasmtime_call(
callee: *const VMFunctionBody,
vmctx: *mut VMContext,
callee: *const VMFunctionBody,
) -> Result<(), String> {
// Reset JMP_BUFS if the stack is unwound through this point.
let _guard = ScopeGuard::new();