43#if defined(INFIX_OS_MACOS)
46#if defined(INFIX_OS_WINDOWS)
57 size_t num_fixed_args,
58 void * user_callback_fn,
62#if defined(INFIX_ABI_WINDOWS_X64)
66#elif defined(INFIX_ABI_SYSV_X64)
70#elif defined(INFIX_ABI_AAPCS64)
85#if defined(INFIX_ABI_WINDOWS_X64)
87#elif defined(INFIX_ABI_SYSV_X64)
89#elif defined(INFIX_ABI_AAPCS64)
102#if defined(INFIX_ABI_WINDOWS_X64)
104#elif defined(INFIX_ABI_SYSV_X64)
106#elif defined(INFIX_ABI_AAPCS64)
118#if defined(INFIX_ABI_WINDOWS_X64)
120#elif defined(INFIX_ABI_SYSV_X64)
122#elif defined(INFIX_ABI_AAPCS64)
157 if (len > SIZE_MAX - buf->
size) {
163 size_t new_capacity = buf->
capacity;
164 while (new_capacity < buf->size + len) {
165 if (new_capacity > SIZE_MAX / 2) {
173 if (new_code ==
nullptr) {
179 buf->
code = new_code;
267 size_t total_size = 0;
271 total_size +=
sizeof(
infix_type *) * num_args;
272 for (
size_t i = 0; i < num_args; ++i)
321 size_t num_fixed_args,
323 if (out_trampoline ==
nullptr ||
return_type ==
nullptr || (
arg_types ==
nullptr && num_args > 0)) {
332 for (
size_t i = 0; i < num_args; ++i) {
339 if (spec ==
nullptr) {
379 if (handle ==
nullptr) {
386 handle->
arena = target_arena;
393 if (handle->
arena ==
nullptr) {
405 for (
size_t i = 0; i < num_args; ++i) {
429 *out_trampoline = handle;
476 if (spec ==
nullptr) {
521 if (handle ==
nullptr) {
531 if (handle->
arena ==
nullptr) {
543 for (
size_t i = 0; i < num_args; ++i) {
568 *out_trampoline = handle;
598 size_t num_fixed_args,
599 void * target_function) {
624 size_t num_fixed_args) {
637 if (trampoline ==
nullptr)
654#if defined(INFIX_OS_WINDOWS)
656 GetSystemInfo(&sysInfo);
657 return sysInfo.dwPageSize;
660 return sysconf(_SC_PAGESIZE);
690 size_t num_fixed_args,
691 void * user_callback_fn,
694 if (out_context ==
nullptr ||
return_type ==
nullptr || num_fixed_args > num_args) {
703 if (
arg_types ==
nullptr && num_args > 0) {
707 for (
size_t i = 0; i < num_args; ++i) {
714 if (spec ==
nullptr) {
733 size_t context_alloc_size = (
sizeof(
infix_reverse_t) + page_size - 1) & ~(page_size - 1);
735 if (prot.
rw_ptr ==
nullptr) {
745 if (context->
arena ==
nullptr) {
753 context->
is_variadic = (num_fixed_args < num_args);
766 for (
size_t i = 0; i < num_args; ++i) {
823 *out_context = context;
827 if (prot.
rw_ptr !=
nullptr)
847 size_t num_fixed_args,
848 void * user_callback_fn) {
851 out_context,
return_type,
arg_types, num_args, num_fixed_args, user_callback_fn,
nullptr,
true);
868 size_t num_fixed_args,
873 out_context,
return_type,
arg_types, num_args, num_fixed_args, (
void *)user_callback_fn, user_data,
false);
883 if (reverse_trampoline ==
nullptr)
888 if (reverse_trampoline->
arena)
901 if (reverse_trampoline ==
nullptr)
911 if (reverse_trampoline ==
nullptr)
918 const char * signature,
919 void * target_function,
929 size_t num_args = 0, num_fixed = 0;
932 if (signature[0] ==
'@') {
939 if (func_type == NULL) {
966 for (
size_t i = 0; i < num_args; ++i)
986 for (
size_t i = 0; i < num_args; ++i)
991 out_trampoline, target_arena,
ret_type,
arg_types, num_args, num_fixed, target_function);
996 const char * signature,
997 void * target_function,
1002 const char * signature,
1007 const char * signature,
1008 void * target_function,
1012 if (!signature || !target_function || !
handlers) {
1020 size_t num_args = 0, num_fixed = 0;
1038 for (
size_t i = 0; i < num_args; ++i)
1051 const char * signature,
1052 void * user_callback_fn,
1057 size_t num_args = 0, num_fixed = 0;
1070 for (
size_t i = 0; i < num_args; ++i)
1079 const char * signature,
1086 size_t num_args = 0, num_fixed = 0;
1099 for (
size_t i = 0; i < num_args; ++i)
1102 out_context,
ret_type,
arg_types, num_args, num_fixed, user_callback_fn, user_data);
1114#if defined(INFIX_ABI_WINDOWS_X64)
1115#include "../arch/x64/abi_win_x64.c"
1116#include "../arch/x64/abi_x64_emitters.c"
1117#elif defined(INFIX_ABI_SYSV_X64)
1118#include "../arch/x64/abi_sysv_x64.c"
1119#include "../arch/x64/abi_x64_emitters.c"
1120#elif defined(INFIX_ABI_AAPCS64)
1121#include "../arch/aarch64/abi_arm64.c"
1122#include "../arch/aarch64/abi_arm64_emitters.c"
1124#error "No supported ABI was selected for the unity build in trampoline.c."
infix_arena_t * arena
Definition 005_layouts.c:60
infix_registry_t * registry
Definition 008_registry_introspection.c:31
infix_status status
Definition 103_unions.c:59
void * args[]
Definition 202_in_structs.c:57
infix_type * return_type
Definition 202_in_structs.c:53
infix_type * arg_types[]
Definition 901_call_overhead.c:61
infix_type * ret_type
Definition 901_call_overhead.c:60
infix_direct_arg_handler_t handlers[2]
Definition 901_call_overhead.c:103
const infix_reverse_abi_spec g_arm64_reverse_spec
Definition abi_arm64.c:116
const infix_forward_abi_spec g_arm64_forward_spec
Definition abi_arm64.c:95
const infix_direct_forward_abi_spec g_arm64_direct_forward_spec
Definition abi_arm64.c:139
const infix_reverse_abi_spec g_sysv_x64_reverse_spec
Definition abi_sysv_x64.c:113
const infix_direct_forward_abi_spec g_sysv_x64_direct_forward_spec
Definition abi_sysv_x64.c:137
const infix_forward_abi_spec g_sysv_x64_forward_spec
Definition abi_sysv_x64.c:92
const infix_direct_forward_abi_spec g_win_x64_direct_forward_spec
Definition abi_win_x64.c:125
const infix_reverse_abi_spec g_win_x64_reverse_spec
Definition abi_win_x64.c:101
const infix_forward_abi_spec g_win_x64_forward_spec
Definition abi_win_x64.c:81
#define c23_nodiscard
A compatibility macro for the C23 [[nodiscard]] attribute.
Definition compat_c23.h:106
c23_nodiscard infix_status infix_forward_create_direct(infix_forward_t **out_trampoline, const char *signature, void *target_function, infix_direct_arg_handler_t *handlers, infix_registry_t *registry)
Creates a forward trampoline with direct, JIT-bound marshalling.
Definition trampoline.c:1006
void(* infix_direct_cif_func)(void *, void **)
A function pointer for a direct marshalling forward trampoline.
Definition infix.h:1301
c23_nodiscard infix_direct_cif_func infix_forward_get_direct_code(infix_forward_t *trampoline)
Gets the callable function pointer from a direct marshalling trampoline.
Definition trampoline.c:288
@ INFIX_CODE_MISSING_REGISTRY
Definition infix.h:1230
@ INFIX_CODE_UNRESOLVED_NAMED_TYPE
Definition infix.h:1251
@ INFIX_CODE_INTEGER_OVERFLOW
Definition infix.h:1243
@ INFIX_CODE_UNEXPECTED_TOKEN
Definition infix.h:1239
@ INFIX_CODE_UNSUPPORTED_ABI
Definition infix.h:1249
@ INFIX_CODE_NULL_POINTER
Definition infix.h:1229
@ INFIX_CODE_OUT_OF_MEMORY
Definition infix.h:1233
@ INFIX_CATEGORY_ABI
Definition infix.h:1220
@ INFIX_CATEGORY_ALLOCATION
Definition infix.h:1218
@ INFIX_CATEGORY_GENERAL
Definition infix.h:1217
@ INFIX_CATEGORY_PARSER
Definition infix.h:1219
c23_nodiscard infix_status infix_reverse_create_callback(infix_reverse_t **out_context, const char *signature, void *user_callback_fn, infix_registry_t *registry)
Creates a type-safe reverse trampoline (callback).
Definition trampoline.c:1050
struct infix_type_t::@0::@1 pointer_info
Metadata for INFIX_TYPE_POINTER.
union infix_type_t::@0 meta
A union containing metadata specific to the type's category.
bool is_incomplete
Definition infix.h:200
infix_type * type
Definition infix.h:268
struct infix_type_t::@0::@4 func_ptr_info
Metadata for INFIX_TYPE_REVERSE_TRAMPOLINE.
void(* infix_cif_func)(void *, void **)
A function pointer type for a bound forward trampoline.
Definition infix.h:338
void(* infix_unbound_cif_func)(void *, void *, void **)
A function pointer type for an unbound forward trampoline.
Definition infix.h:329
c23_nodiscard infix_status infix_forward_create_unbound(infix_forward_t **out_trampoline, const char *signature, infix_registry_t *registry)
Creates an "unbound" forward trampoline from a signature string.
Definition trampoline.c:1001
c23_nodiscard infix_status infix_forward_create(infix_forward_t **out_trampoline, const char *signature, void *target_function, infix_registry_t *registry)
Creates a "bound" forward trampoline from a signature string.
Definition trampoline.c:995
infix_struct_member * members
Definition infix.h:213
c23_nodiscard infix_status infix_forward_create_in_arena(infix_forward_t **out_trampoline, infix_arena_t *target_arena, const char *signature, void *target_function, infix_registry_t *registry)
Creates a "bound" forward trampoline within a user-provided arena.
Definition trampoline.c:916
c23_nodiscard infix_status infix_reverse_create_closure(infix_reverse_t **out_context, const char *signature, infix_closure_handler_fn user_callback_fn, void *user_data, infix_registry_t *registry)
Creates a generic reverse trampoline (closure) for stateful callbacks.
Definition trampoline.c:1078
infix_function_argument * args
Definition infix.h:226
infix_status
Enumerates the possible status codes returned by infix API functions.
Definition infix.h:354
infix_type_category category
Definition infix.h:196
struct infix_type_t::@0::@2 aggregate_info
Metadata for INFIX_TYPE_STRUCT and INFIX_TYPE_UNION.
struct infix_type_t::@0::@3 array_info
Metadata for INFIX_TYPE_ARRAY.
struct infix_type_t * pointee_type
Definition infix.h:209
infix_type * type
Definition infix.h:256
struct infix_type_t * element_type
Definition infix.h:219
struct infix_type_t * return_type
Definition infix.h:225
c23_nodiscard infix_status infix_signature_parse(const char *, infix_arena_t **, infix_type **, infix_function_argument **, size_t *, size_t *, infix_registry_t *)
Parses a full function signature string into its constituent parts.
Definition signature.c:1077
size_t num_members
Definition infix.h:214
size_t num_fixed_args
Definition infix.h:228
void(* infix_closure_handler_fn)(infix_context_t *, void *, void **)
A function pointer type for a generic closure handler.
Definition infix.h:350
size_t num_args
Definition infix.h:227
@ INFIX_ERROR_ALLOCATION_FAILED
Definition infix.h:356
@ INFIX_ERROR_PROTECTION_FAILED
Definition infix.h:360
@ INFIX_ERROR_UNSUPPORTED_ABI
Definition infix.h:358
@ INFIX_SUCCESS
Definition infix.h:355
@ INFIX_ERROR_INVALID_ARGUMENT
Definition infix.h:357
c23_nodiscard infix_cif_func infix_forward_get_code(infix_forward_t *trampoline)
Gets the callable function pointer from a bound forward trampoline.
Definition trampoline.c:283
c23_nodiscard void * infix_reverse_get_code(const infix_reverse_t *reverse_trampoline)
Gets the native, callable C function pointer from a reverse trampoline.
Definition trampoline.c:900
c23_nodiscard infix_unbound_cif_func infix_forward_get_unbound_code(infix_forward_t *trampoline)
Gets the callable function pointer from an unbound forward trampoline.
Definition trampoline.c:278
c23_nodiscard void * infix_reverse_get_user_data(const infix_reverse_t *reverse_trampoline)
Gets the user-provided data pointer from a closure context.
Definition trampoline.c:910
void infix_reverse_destroy(infix_reverse_t *reverse_trampoline)
Destroys a reverse trampoline and frees all associated memory.
Definition trampoline.c:882
c23_nodiscard infix_status infix_forward_create_manual(infix_forward_t **out_trampoline, infix_type *return_type, infix_type **arg_types, size_t num_args, size_t num_fixed_args, void *target_function)
Creates a bound forward trampoline from infix_type objects (Manual API).
Definition trampoline.c:594
c23_nodiscard infix_status infix_reverse_create_callback_manual(infix_reverse_t **out_context, infix_type *return_type, infix_type **arg_types, size_t num_args, size_t num_fixed_args, void *user_callback_fn)
Creates a type-safe reverse trampoline (callback) from infix_type objects (Manual API).
Definition trampoline.c:843
c23_nodiscard infix_status infix_reverse_create_closure_manual(infix_reverse_t **out_context, infix_type *return_type, infix_type **arg_types, size_t num_args, size_t num_fixed_args, infix_closure_handler_fn user_callback_fn, void *user_data)
Creates a generic reverse trampoline (closure) from infix_type objects (Manual API).
Definition trampoline.c:864
c23_nodiscard infix_status infix_forward_create_unbound_manual(infix_forward_t **out_trampoline, infix_type *return_type, infix_type **arg_types, size_t num_args, size_t num_fixed_args)
Creates an unbound forward trampoline from infix_type objects (Manual API).
Definition trampoline.c:620
void infix_forward_destroy(infix_forward_t *trampoline)
Destroys a forward trampoline and frees all associated memory.
Definition trampoline.c:636
#define infix_free
A macro that can be defined to override the default free function.
Definition infix.h:303
void infix_arena_destroy(infix_arena_t *)
Destroys an arena and frees all memory allocated from it.
Definition arena.c:83
#define infix_memcpy
A macro that can be defined to override the default memcpy function.
Definition infix.h:307
#define infix_calloc
A macro that can be defined to override the default calloc function.
Definition infix.h:295
c23_nodiscard void * infix_arena_alloc(infix_arena_t *, size_t, size_t)
Allocates a block of memory from an arena.
Definition arena.c:117
#define infix_memset
A macro that can be defined to override the default memset function.
Definition infix.h:311
c23_nodiscard infix_arena_t * infix_arena_create(size_t)
Creates a new memory arena.
Definition arena.c:52
c23_nodiscard const infix_type * infix_registry_lookup_type(const infix_registry_t *, const char *)
Retrieves the canonical infix_type object for a given name from the registry.
Definition type_registry.c:783
@ INFIX_TYPE_UNION
Definition infix.h:152
@ INFIX_TYPE_ARRAY
Definition infix.h:153
@ INFIX_TYPE_POINTER
Definition infix.h:150
@ INFIX_TYPE_NAMED_REFERENCE
Definition infix.h:158
@ INFIX_TYPE_REVERSE_TRAMPOLINE
Definition infix.h:154
@ INFIX_TYPE_STRUCT
Definition infix.h:151
#define INFIX_TRAMPOLINE_HEADROOM
Extra bytes to allocate in a trampoline's private arena.
Definition infix_config.h:201
Internal data structures, function prototypes, and constants.
void infix_protected_free(infix_protected_t prot)
Frees a block of protected memory.
Definition executor.c:466
c23_nodiscard bool infix_executable_make_executable(infix_executable_t exec)
Makes a block of JIT memory executable, completing the W^X process.
Definition executor.c:369
void infix_executable_free(infix_executable_t exec)
Frees a block of executable memory and applies guard pages to prevent use-after-free.
Definition executor.c:311
void _infix_set_error(infix_error_category_t category, infix_error_code_t code, size_t position)
Sets the thread-local error state with detailed information.
Definition error.c:173
infix_type * _copy_type_graph_to_arena(infix_arena_t *, const infix_type *)
Performs a deep copy of a type graph into a destination arena.
Definition types.c:1133
size_t _infix_estimate_graph_size(infix_arena_t *temp_arena, const infix_type *type)
Estimates the total memory required to deep-copy a complete type graph.
Definition types.c:1238
c23_nodiscard infix_protected_t infix_protected_alloc(size_t size)
Allocates a block of standard memory for later protection.
Definition executor.c:432
c23_nodiscard infix_executable_t infix_executable_alloc(size_t size)
Allocates a block of executable memory using the platform's W^X strategy.
Definition executor.c:205
void _infix_clear_error(void)
Clears the thread-local error state.
Definition error.c:266
c23_nodiscard bool infix_protected_make_readonly(infix_protected_t prot)
Makes a block of memory read-only for security hardening.
Definition executor.c:486
void infix_internal_dispatch_callback_fn_impl(infix_reverse_t *context, void *return_value_ptr, void **args_array)
The universal C entry point for all reverse call trampolines.
Definition executor.c:525
A dynamic buffer for staged machine code generation.
Definition infix_internals.h:192
uint8_t * code
Definition infix_internals.h:193
bool error
Definition infix_internals.h:196
size_t size
Definition infix_internals.h:195
size_t capacity
Definition infix_internals.h:194
infix_arena_t * arena
Definition infix_internals.h:197
Internal definition of a memory arena.
Definition infix_internals.h:138
bool error
Definition infix_internals.h:142
A complete layout blueprint for a forward call frame.
Definition infix_internals.h:281
A struct containing all the necessary handlers for a single function argument.
Definition infix.h:1364
A complete layout blueprint for a direct marshalling forward call frame.
Definition infix_internals.h:464
Defines the ABI-specific implementation interface for direct marshalling forward trampolines.
Definition infix_internals.h:478
infix_status(* generate_direct_forward_call_instruction)(code_buffer *buf, infix_direct_call_frame_layout *layout)
Generates the call instruction to the target function.
Definition infix_internals.h:492
infix_status(* generate_direct_forward_argument_moves)(code_buffer *buf, infix_direct_call_frame_layout *layout)
Generates code to call marshallers and move arguments into their native locations.
Definition infix_internals.h:490
infix_status(* prepare_direct_forward_call_frame)(infix_arena_t *arena, infix_direct_call_frame_layout **out_layout, infix_type *ret_type, infix_type **arg_types, size_t num_args, infix_direct_arg_handler_t *handlers, void *target_fn)
Analyzes a function signature to create a complete direct call frame layout.
Definition infix_internals.h:480
infix_status(* generate_direct_forward_epilogue)(code_buffer *buf, infix_direct_call_frame_layout *layout, infix_type *ret_type)
Generates the function epilogue (handling return value, calling write-back handlers,...
Definition infix_internals.h:495
infix_status(* generate_direct_forward_prologue)(code_buffer *buf, infix_direct_call_frame_layout *layout)
Generates the function prologue (stack setup, saving registers).
Definition infix_internals.h:488
size_t size
Definition infix_internals.h:64
void * rw_ptr
Definition infix_internals.h:63
void * rx_ptr
Definition infix_internals.h:62
Defines the ABI-specific implementation interface for forward trampolines.
Definition infix_internals.h:325
infix_status(* generate_forward_prologue)(code_buffer *buf, infix_call_frame_layout *layout)
Generates the function prologue (stack setup, saving registers).
Definition infix_internals.h:354
infix_status(* generate_forward_argument_moves)(code_buffer *buf, infix_call_frame_layout *layout, infix_type **arg_types, size_t num_args, size_t num_fixed_args)
Generates code to move arguments from the void** array into registers and/or the stack.
Definition infix_internals.h:364
infix_status(* generate_forward_call_instruction)(code_buffer *buf, infix_call_frame_layout *layout)
Generates the call instruction to the target function.
Definition infix_internals.h:375
infix_status(* prepare_forward_call_frame)(infix_arena_t *arena, infix_call_frame_layout **out_layout, infix_type *ret_type, infix_type **arg_types, size_t num_args, size_t num_fixed_args, void *target_fn)
Analyzes a function signature to create a complete call frame layout.
Definition infix_internals.h:341
infix_status(* generate_forward_epilogue)(code_buffer *buf, infix_call_frame_layout *layout, infix_type *ret_type)
Generates the function epilogue (handling return value, restoring stack, returning).
Definition infix_internals.h:383
Internal definition of a forward trampoline handle.
Definition infix_internals.h:88
infix_executable_t exec
Definition infix_internals.h:92
void * target_fn
Definition infix_internals.h:97
size_t num_args
Definition infix_internals.h:95
bool is_external_arena
Definition infix_internals.h:90
size_t num_fixed_args
Definition infix_internals.h:96
infix_type ** arg_types
Definition infix_internals.h:94
infix_type * return_type
Definition infix_internals.h:93
infix_arena_t * arena
Definition infix_internals.h:89
bool is_direct_trampoline
Definition infix_internals.h:98
Describes a single argument to a C function.
Definition infix.h:266
Internal representation of a memory block that will be made read-only.
Definition infix_internals.h:75
void * rw_ptr
Definition infix_internals.h:76
Internal definition of a named type registry.
Definition infix_internals.h:165
Defines the ABI-specific implementation interface for reverse trampolines.
Definition infix_internals.h:394
infix_status(* generate_reverse_argument_marshalling)(code_buffer *buf, infix_reverse_call_frame_layout *layout, infix_reverse_t *context)
Generates code to marshal arguments from their native locations (registers/stack) into a void** array...
Definition infix_internals.h:419
infix_status(* prepare_reverse_call_frame)(infix_arena_t *arena, infix_reverse_call_frame_layout **out_layout, infix_reverse_t *context)
Analyzes a function signature to create a layout for the reverse call stub's stack frame.
Definition infix_internals.h:402
infix_status(* generate_reverse_prologue)(code_buffer *buf, infix_reverse_call_frame_layout *layout)
Generates the reverse stub's prologue (stack setup).
Definition infix_internals.h:411
infix_status(* generate_reverse_dispatcher_call)(code_buffer *buf, infix_reverse_call_frame_layout *layout, infix_reverse_t *context)
Generates the call to the universal C dispatcher (infix_internal_dispatch_callback_fn_impl).
Definition infix_internals.h:429
infix_status(* generate_reverse_epilogue)(code_buffer *buf, infix_reverse_call_frame_layout *layout, infix_reverse_t *context)
Generates the reverse stub's epilogue (handling return value, restoring stack, returning).
Definition infix_internals.h:439
A complete layout blueprint for a reverse call frame.
Definition infix_internals.h:303
Internal definition of a reverse trampoline (callback/closure) handle.
Definition infix_internals.h:114
infix_type * return_type
Definition infix_internals.h:118
void * user_data
Definition infix_internals.h:124
void * user_callback_fn
Definition infix_internals.h:123
infix_executable_t exec
Definition infix_internals.h:116
infix_internal_dispatch_callback_fn internal_dispatcher
Definition infix_internals.h:126
size_t num_args
Definition infix_internals.h:120
size_t num_fixed_args
Definition infix_internals.h:121
infix_protected_t protected_ctx
Definition infix_internals.h:117
bool is_variadic
Definition infix_internals.h:122
infix_forward_t * cached_forward_trampoline
Definition infix_internals.h:128
infix_arena_t * arena
Definition infix_internals.h:115
infix_type ** arg_types
Definition infix_internals.h:119
A semi-opaque structure that describes a C type.
Definition infix.h:194
Definition trampoline.c:193
const infix_type * type
Definition trampoline.c:194
struct visited_node_t * next
Definition trampoline.c:195
void emit_byte(code_buffer *buf, uint8_t byte)
A convenience wrapper to append a single byte to a code buffer.
Definition trampoline.c:186
static bool _is_type_graph_resolved_recursive(const infix_type *type, visited_node_t *visited_head)
Definition trampoline.c:209
c23_nodiscard infix_status _infix_forward_create_impl(infix_forward_t **out_trampoline, infix_arena_t *target_arena, infix_type *return_type, infix_type **arg_types, size_t num_args, size_t num_fixed_args, void *target_fn)
Definition trampoline.c:316
const infix_forward_abi_spec * get_current_forward_abi_spec()
Gets the ABI v-table for forward calls for the current platform.
Definition trampoline.c:84
void code_buffer_init(code_buffer *buf, infix_arena_t *arena)
Initializes a code buffer for JIT code generation.
Definition trampoline.c:135
static bool _is_type_graph_resolved(const infix_type *type)
Definition trampoline.c:248
c23_nodiscard infix_status _infix_forward_create_direct_impl(infix_forward_t **out_trampoline, infix_type *return_type, infix_type **arg_types, size_t num_args, void *target_fn, infix_direct_arg_handler_t *handlers)
Definition trampoline.c:463
void emit_int64(code_buffer *buf, int64_t value)
A convenience wrapper to append a 64-bit integer (little-endian) to a code buffer.
Definition trampoline.c:190
void code_buffer_append(code_buffer *buf, const void *data, size_t len)
Appends raw bytes to a code buffer, reallocating within its arena if necessary.
Definition trampoline.c:154
static size_t get_page_size()
Definition trampoline.c:653
void emit_int32(code_buffer *buf, int32_t value)
A convenience wrapper to append a 32-bit integer (little-endian) to a code buffer.
Definition trampoline.c:188
static size_t _estimate_metadata_size(infix_arena_t *temp_arena, infix_type *return_type, infix_type **arg_types, size_t num_args)
Definition trampoline.c:263
const infix_direct_forward_abi_spec * get_current_direct_forward_abi_spec()
Gets the ABI v-table for direct marshalling forward calls for the current platform.
Definition trampoline.c:117
static infix_status _infix_reverse_create_internal(infix_reverse_t **out_context, infix_type *return_type, infix_type **arg_types, size_t num_args, size_t num_fixed_args, void *user_callback_fn, void *user_data, bool is_callback)
Definition trampoline.c:686
const infix_reverse_abi_spec * get_current_reverse_abi_spec()
Gets the ABI v-table for reverse calls for the current platform.
Definition trampoline.c:101
A header for conditionally compiled debugging utilities.
static void infix_dump_hex(c23_maybe_unused const void *data, c23_maybe_unused size_t size, c23_maybe_unused const char *title)
Definition utility.h:115