diff --git a/src/arch/aarch64.s b/src/arch/aarch64.s index 9c3e18907..eb8950233 100644 --- a/src/arch/aarch64.s +++ b/src/arch/aarch64.s @@ -1,8 +1,8 @@ .text -.global _aot_trampoline -_aot_trampoline: +.global _invoke_trampoline +_invoke_trampoline: // x0 <- fn_ptr: extern "C" fn() // x1 <- args_ptr: *const u64 // x2 <- args_len: usize @@ -15,7 +15,7 @@ _aot_trampoline: mov x9, x0 // We'll need x0. add x10, x1, x2, lsl 3 // Move the pointer to the end (past last element). - cmp x2, 8 // Check if there are more than 8 arguments. + cmp x2, 8 // Check if there are more than 8 arguments. ble 2f // If there are less than 8, skip to register arguments. // diff --git a/src/arch/x86_64.s b/src/arch/x86_64.s index c3602478a..0228bed6d 100644 --- a/src/arch/x86_64.s +++ b/src/arch/x86_64.s @@ -1,8 +1,8 @@ .text -.global aot_trampoline -aot_trampoline: +.global _invoke_trampoline +_invoke_trampoline: # rdi <- fn_ptr: extern "C" fn() # rsi <- args_ptr: *const u64 # rdx <- args_len: usize diff --git a/src/executor.rs b/src/executor.rs index 80729ae14..61029a732 100644 --- a/src/executor.rs +++ b/src/executor.rs @@ -35,11 +35,12 @@ global_asm!(include_str!("arch/aarch64.s")); global_asm!(include_str!("arch/x86_64.s")); extern "C" { - /// Invoke an AOT-compiled function. + /// Invoke an AOT or JIT-compiled function. /// /// The `ret_ptr` argument is only used when the first argument (the actual return pointer) is /// unused. Used for u8, u16, u32, u64, u128 and felt252, but not for arrays, enums or structs. - fn aot_trampoline( + #[cfg_attr(not(target_os = "macos"), link_name = "_invoke_trampoline")] + fn invoke_trampoline( fn_ptr: *const c_void, args_ptr: *const u64, args_len: usize, @@ -223,7 +224,7 @@ fn invoke_dynamic( let mut ret_registers = [0; 4]; unsafe { - aot_trampoline( + invoke_trampoline( function_ptr, invoke_data.invoke_data().as_ptr(), invoke_data.invoke_data().len(),