Affix
view release on metacpan or search on metacpan
infix/src/common/infix_internals.h view on Meta::CPAN
void ** args_array);
// Utility Macros & Inlines
/** @brief Appends a sequence of bytes (e.g., an instruction opcode) to a code buffer. */
#define EMIT_BYTES(buf, ...) \
do { \
const uint8_t bytes[] = {__VA_ARGS__}; \
code_buffer_append((buf), bytes, sizeof(bytes)); \
} while (0)
/**
* @brief Aligns a value up to the next multiple of a power-of-two alignment.
* @param value The value to align.
* @param alignment The alignment boundary (must be a power of two).
* @return The aligned value.
*/
static inline size_t _infix_align_up(size_t value, size_t alignment) {
return (value + alignment - 1) & ~(alignment - 1);
}
/**
* @brief A fast inline check to determine if an `infix_type` is a half-precision float (`float16`).
* @param type The type to check.
* @return `true` if the type is a float16 primitive.
*/
static inline bool is_float16(const infix_type * type) {
return type->category == INFIX_TYPE_PRIMITIVE && type->meta.primitive_id == INFIX_PRIMITIVE_FLOAT16;
}
/**
* @brief A fast inline check to determine if an `infix_type` is a `float` (32-bit).
* @param type The type to check.
* @return `true` if the type is a float primitive.
*/
static inline bool is_float(const infix_type * type) {
return type->category == INFIX_TYPE_PRIMITIVE && type->meta.primitive_id == INFIX_PRIMITIVE_FLOAT;
}
/**
* @brief A fast inline check to determine if an `infix_type` is a `double`.
* @param type The type to check.
* @return `true` if the type is a double primitive.
*/
static inline bool is_double(const infix_type * type) {
return type->category == INFIX_TYPE_PRIMITIVE && type->meta.primitive_id == INFIX_PRIMITIVE_DOUBLE;
}
/**
* @brief A fast inline check to determine if an `infix_type` is a `long double`.
* @param type The type to check.
* @return `true` if the type is a long double primitive.
*/
static inline bool is_long_double(const infix_type * type) {
return type->category == INFIX_TYPE_PRIMITIVE && type->meta.primitive_id == INFIX_PRIMITIVE_LONG_DOUBLE;
}
// Include architecture-specific emitter prototypes for internal use by the JIT engine.
#if defined(INFIX_ABI_SYSV_X64) || defined(INFIX_ABI_WINDOWS_X64)
#include "arch/x64/abi_x64_emitters.h"
#elif defined(INFIX_ABI_AAPCS64)
#include "arch/aarch64/abi_arm64_emitters.h"
#elif defined(INFIX_ABI_RISCV64)
#include "arch/riscv/abi_riscv64_emitters.h"
#endif
// Trampoline Caching
/** @internal Maximum number of trampoline handles the global forward cache will retain.
* The cache is bounded so that applications creating many unique trampoline signatures
* cannot exhaust memory by permanently retaining every JIT-compiled handle. */
#define INFIX_CACHE_MAX_ENTRIES 1024
INFIX_INTERNAL infix_forward_t * _infix_cache_lookup(const char * signature, void * target_fn, bool is_safe);
INFIX_INTERNAL void _infix_cache_insert(infix_forward_t * trampoline);
INFIX_INTERNAL bool _infix_cache_remove(infix_forward_t * trampoline);
INFIX_INTERNAL void _infix_cache_release(infix_forward_t * trampoline);
INFIX_INTERNAL void _infix_cache_clear(void);
INFIX_INTERNAL size_t _infix_cache_count(void);
// Internal Cleanup
INFIX_INTERNAL void _infix_forward_destroy_internal(infix_forward_t * trampoline);
/** @endinternal */
( run in 1.877 second using v1.01-cache-2.11-cpan-5c0b1e786e0 )