infix
A JIT-Powered FFI Library for C
|
Declarations for internal-only functions, types, and constants. More...
Go to the source code of this file.
Classes | |
struct | infix_executable_t |
struct | infix_protected_t |
struct | infix_forward_t |
struct | infix_reverse_t |
struct | infix_arena_t |
struct | _infix_registry_entry_t |
struct | infix_registry_t |
struct | code_buffer |
struct | infix_arg_location |
struct | infix_call_frame_layout |
struct | infix_reverse_call_frame_layout |
struct | infix_forward_abi_spec |
struct | infix_reverse_abi_spec |
Macros | |
#define | INFIX_MAX_STACK_ALLOC (1024 * 1024 * 4) |
#define | INFIX_MAX_ARG_SIZE (1024 * 64) |
#define | EMIT_BYTES(buf, ...) |
A macro for emitting a sequence of literal bytes into a code buffer. | |
Typedefs | |
typedef void(* | infix_internal_dispatch_callback_fn) (infix_reverse_t *, void *, void **) |
typedef struct _infix_registry_entry_t | _infix_registry_entry_t |
Functions | |
void | _infix_set_error (infix_error_category_t, infix_error_code_t, size_t) |
Sets the thread-local error details for a library-internal error. | |
void | _infix_set_system_error (infix_error_category_t, infix_error_code_t, long, const char *) |
Sets the thread-local error details for an error originating from the OS. | |
void | _infix_clear_error (void) |
Resets the thread-local error state. Called at the start of every public API function. | |
infix_type * | _copy_type_graph_to_arena (infix_arena_t *, const infix_type *) |
Performs a deep copy of a type graph from one arena to another. | |
c23_nodiscard infix_status | _infix_resolve_type_graph (infix_type **, infix_registry_t *) |
Walks a type graph, replacing all @Name placeholders with their concrete definitions from a registry. | |
c23_nodiscard infix_status | _infix_parse_type_internal (infix_type **, infix_arena_t **, const char *, infix_registry_t *) |
The core, non-resolving entry point for the signature parser. | |
const infix_forward_abi_spec * | get_current_forward_abi_spec (void) |
Gets the ABI v-table for the current target platform (forward calls). | |
const infix_reverse_abi_spec * | get_current_reverse_abi_spec (void) |
Gets the ABI v-table for the current target platform (reverse calls). | |
void | code_buffer_init (code_buffer *, infix_arena_t *) |
Initializes a code buffer for JIT code generation. | |
void | code_buffer_append (code_buffer *, const void *, size_t) |
Appends raw bytes to a code buffer, reallocating if necessary. | |
void | emit_byte (code_buffer *, uint8_t) |
Appends a single byte to a code buffer. | |
void | emit_int32 (code_buffer *, int32_t) |
Appends a 32-bit integer to a code buffer. | |
void | emit_int64 (code_buffer *, int64_t) |
Appends a 64-bit integer to a code buffer. | |
c23_nodiscard infix_status | _infix_forward_create_internal (infix_forward_t **, infix_type *, infix_type **, size_t, size_t, infix_arena_t *, void *) |
The internal core logic for creating a forward trampoline. | |
c23_nodiscard infix_executable_t | infix_executable_alloc (size_t) |
Allocates a page-aligned block of W^X-compliant executable memory. | |
void | infix_executable_free (infix_executable_t) |
Frees executable memory, creating a guard page to prevent use-after-free. | |
c23_nodiscard bool | infix_executable_make_executable (infix_executable_t) |
Makes a JIT memory region readable and executable (and non-writable). | |
c23_nodiscard infix_protected_t | infix_protected_alloc (size_t) |
Allocates a page-aligned block of data memory. | |
void | infix_protected_free (infix_protected_t) |
Frees a block of protected data memory. | |
c23_nodiscard bool | infix_protected_make_readonly (infix_protected_t) |
Hardens a block of protected data memory to be read-only. | |
void | infix_internal_dispatch_callback_fn_impl (infix_reverse_t *, void *, void **) |
The high-level C dispatcher function called by reverse trampoline stubs. | |
static size_t | _infix_align_up (size_t value, size_t alignment) |
static bool | is_float (const infix_type *type) |
Convenience helper to check if an infix_type is a float . | |
static bool | is_double (const infix_type *type) |
Convenience helper to check if an infix_type is a double . | |
static bool | is_long_double (const infix_type *type) |
Convenience helper to check if an infix_type is a longdouble . | |
Declarations for internal-only functions, types, and constants.
Copyright (c) 2025 Sanko Robinson
This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.
SPDX-License-Identifier: (Artistic-2.0 OR MIT)
The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
SPDX-License-Identifier: CC-BY-4.0
#define EMIT_BYTES | ( | buf, | |
... | |||
) |
A macro for emitting a sequence of literal bytes into a code buffer.
#define INFIX_MAX_ARG_SIZE (1024 * 64) |
#define INFIX_MAX_STACK_ALLOC (1024 * 1024 * 4) |
typedef struct _infix_registry_entry_t _infix_registry_entry_t |
typedef void(* infix_internal_dispatch_callback_fn) (infix_reverse_t *, void *, void **) |
infix_type * _copy_type_graph_to_arena | ( | infix_arena_t * | dest_arena, |
const infix_type * | src_type | ||
) |
Performs a deep copy of a type graph from one arena to another.
|
inlinestatic |
void _infix_clear_error | ( | void | ) |
Resets the thread-local error state. Called at the start of every public API function.
c23_nodiscard infix_status _infix_forward_create_internal | ( | infix_forward_t ** | out_trampoline, |
infix_type * | return_type, | ||
infix_type ** | arg_types, | ||
size_t | num_args, | ||
size_t | num_fixed_args, | ||
infix_arena_t * | source_arena, | ||
void * | target_fn | ||
) |
The internal core logic for creating a forward trampoline.
c23_nodiscard infix_status _infix_parse_type_internal | ( | infix_type ** | out_type, |
infix_arena_t ** | out_arena, | ||
const char * | signature, | ||
infix_registry_t * | registry | ||
) |
The core, non-resolving entry point for the signature parser.
c23_nodiscard infix_status _infix_resolve_type_graph | ( | infix_type ** | type_ptr, |
infix_registry_t * | registry | ||
) |
Walks a type graph, replacing all @Name
placeholders with their concrete definitions from a registry.
void _infix_set_error | ( | infix_error_category_t | category, |
infix_error_code_t | code, | ||
size_t | position | ||
) |
Sets the thread-local error details for a library-internal error.
void _infix_set_system_error | ( | infix_error_category_t | category, |
infix_error_code_t | code, | ||
long | system_code, | ||
const char * | msg | ||
) |
Sets the thread-local error details for an error originating from the OS.
void code_buffer_append | ( | code_buffer * | buf, |
const void * | data, | ||
size_t | len | ||
) |
Appends raw bytes to a code buffer, reallocating if necessary.
void code_buffer_init | ( | code_buffer * | buf, |
infix_arena_t * | arena | ||
) |
Initializes a code buffer for JIT code generation.
void emit_byte | ( | code_buffer * | buf, |
uint8_t | byte | ||
) |
Appends a single byte to a code buffer.
void emit_int32 | ( | code_buffer * | buf, |
int32_t | value | ||
) |
Appends a 32-bit integer to a code buffer.
void emit_int64 | ( | code_buffer * | buf, |
int64_t | value | ||
) |
Appends a 64-bit integer to a code buffer.
const infix_forward_abi_spec * get_current_forward_abi_spec | ( | void | ) |
Gets the ABI v-table for the current target platform (forward calls).
const infix_reverse_abi_spec * get_current_reverse_abi_spec | ( | void | ) |
Gets the ABI v-table for the current target platform (reverse calls).
c23_nodiscard infix_executable_t infix_executable_alloc | ( | size_t | size | ) |
Allocates a page-aligned block of W^X-compliant executable memory.
void infix_executable_free | ( | infix_executable_t | exec | ) |
Frees executable memory, creating a guard page to prevent use-after-free.
c23_nodiscard bool infix_executable_make_executable | ( | infix_executable_t | exec | ) |
Makes a JIT memory region readable and executable (and non-writable).
void infix_internal_dispatch_callback_fn_impl | ( | infix_reverse_t * | context, |
void * | return_value_ptr, | ||
void ** | args_array | ||
) |
The high-level C dispatcher function called by reverse trampoline stubs.
c23_nodiscard infix_protected_t infix_protected_alloc | ( | size_t | size | ) |
Allocates a page-aligned block of data memory.
void infix_protected_free | ( | infix_protected_t | prot | ) |
Frees a block of protected data memory.
c23_nodiscard bool infix_protected_make_readonly | ( | infix_protected_t | prot | ) |
Hardens a block of protected data memory to be read-only.
|
inlinestatic |
Convenience helper to check if an infix_type
is a double
.
|
inlinestatic |
Convenience helper to check if an infix_type
is a float
.
|
inlinestatic |
Convenience helper to check if an infix_type
is a longdouble
.