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:
@@ -387,7 +387,7 @@ impl InstanceContents {
|
||||
};
|
||||
|
||||
// Make the call.
|
||||
unsafe { wasmtime_call(callee_address, callee_vmctx) }
|
||||
unsafe { wasmtime_call(callee_vmctx, callee_address) }
|
||||
.map_err(InstantiationError::StartTrap)
|
||||
}
|
||||
|
||||
|
||||
@@ -90,9 +90,9 @@ pub extern "C" fn wasmtime_f64_nearest(x: f64) -> f64 {
|
||||
/// Implementation of memory.grow for locally-defined 32-bit memories.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wasmtime_memory32_grow(
|
||||
vmctx: *mut VMContext,
|
||||
delta: u32,
|
||||
memory_index: u32,
|
||||
vmctx: *mut VMContext,
|
||||
) -> u32 {
|
||||
let instance_contents = (&mut *vmctx).instance_contents();
|
||||
let memory_index = DefinedMemoryIndex::from_u32(memory_index);
|
||||
@@ -105,9 +105,9 @@ pub unsafe extern "C" fn wasmtime_memory32_grow(
|
||||
/// Implementation of memory.grow for imported 32-bit memories.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wasmtime_imported_memory32_grow(
|
||||
vmctx: *mut VMContext,
|
||||
delta: u32,
|
||||
memory_index: u32,
|
||||
vmctx: *mut VMContext,
|
||||
) -> u32 {
|
||||
let instance_contents = (&mut *vmctx).instance_contents();
|
||||
let memory_index = MemoryIndex::from_u32(memory_index);
|
||||
@@ -119,7 +119,7 @@ pub unsafe extern "C" fn wasmtime_imported_memory32_grow(
|
||||
|
||||
/// Implementation of memory.size for locally-defined 32-bit memories.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wasmtime_memory32_size(memory_index: u32, vmctx: *mut VMContext) -> u32 {
|
||||
pub unsafe extern "C" fn wasmtime_memory32_size(vmctx: *mut VMContext, memory_index: u32) -> u32 {
|
||||
let instance_contents = (&mut *vmctx).instance_contents();
|
||||
let memory_index = DefinedMemoryIndex::from_u32(memory_index);
|
||||
|
||||
@@ -129,8 +129,8 @@ pub unsafe extern "C" fn wasmtime_memory32_size(memory_index: u32, vmctx: *mut V
|
||||
/// Implementation of memory.size for imported 32-bit memories.
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wasmtime_imported_memory32_size(
|
||||
memory_index: u32,
|
||||
vmctx: *mut VMContext,
|
||||
memory_index: u32,
|
||||
) -> u32 {
|
||||
let instance_contents = (&mut *vmctx).instance_contents();
|
||||
let memory_index = MemoryIndex::from_u32(memory_index);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user