Skip to content

Commit

Permalink
Rename aot trampoline and fix compatibility issues. (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
azteca1998 authored Mar 26, 2024
1 parent f18ff02 commit 7a4d510
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/arch/aarch64.s
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.

//
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64.s
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 7a4d510

Please sign in to comment.