Affix
view release on metacpan or search on metacpan
lib/Affix.h view on Meta::CPAN
typedef struct {
infix_library_t * lib; ///< The handle to the opened library.
UV ref_count; ///< Reference count. The library is closed only when this reaches 0.
} LibRegistryEntry;
// Struct for the Direct Marshalling (aka "bundle") backend.
/// Represents a forward FFI call created with the high-performance direct marshalling API.
struct Affix_Backend {
infix_forward_t * infix; ///< Handle to the infix trampoline and type info.
infix_direct_cif_func cif; ///< Direct pointer to the specialized JIT code.
infix_library_t * lib_handle; ///< Handle for library cleanup.
const infix_type * ret_type; ///< Cached return type info.
Affix_Pull pull_handler; ///< Pre-resolved handler for marshalling the return value.
Affix_Opcode ret_opcode; ///< Optimized return opcode.
bool ret_readonly; ///< Should the returned aggregate prevent perl-side mutations?
size_t num_args; ///< Cached number of arguments.
char * sig_str;
char * sym_name;
void * target_addr;
char * lib_path;
dTHXfield(owner_perl)
};
// Trigger function for the experimental backend (shh!)
extern void Affix_trigger_backend(pTHX_ CV *);
// Main execution trigger
extern void Affix_trigger_stack(pTHX_ CV *);
extern void Affix_trigger_arena(pTHX_ CV *);
extern void Affix_trigger_variadic(pTHX_ CV *);
// Marshalling (Perl -> C)
void sv2ptr(pTHX_ Affix * affix, SV * perl_sv, void * c_ptr, const infix_type * type);
void push_struct(pTHX_ Affix * affix, const infix_type * type, SV * sv, void * p);
void push_array(pTHX_ Affix * affix, const infix_type * type, SV * sv, void * p);
void push_reverse_trampoline(pTHX_ Affix * affix, const infix_type * type, SV * sv, void * p);
// Marshalling (Perl <- C)
void ptr2sv(pTHX_ Affix *, void *, SV *, const infix_type *, bool);
void _populate_hv_from_c_struct(
pTHX_ Affix * affix, HV * hv, const infix_type * type, void * p, bool live, SV * owner_sv, bool);
// Handler resolution
Affix_Step_Executor get_plan_step_executor(const infix_type * type);
Affix_Pull get_pull_handler(pTHX_ const infix_type * type);
Affix_Out_Param_Writer get_out_param_writer(const infix_type * type);
// Pin management
// Reverse trampolines
void _affix_callback_handler_entry(infix_context_t *, void *, void **);
// Misc.
void _export_function(pTHX_ HV *, const char *, const char *);
// XS Bootstrap
void boot_Affix(pTHX_ CV *);
// 'Portable' XS MACROS
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) \
(PL_Sv = (SV *)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV *)PL_Sv)
#endif
#define newXS_deffile(a, b) Perl_newXS_deffile(aTHX_ a, b)
#define export_function(package, what, tag) \
_export_function(aTHX_ get_hv(form("%s::EXPORT_TAGS", package), GV_ADD), what, tag)
// Debugging Macros
#if DEBUG > 1
#define PING warn("Ping at %s line %d", __FILE__, __LINE__);
#else
#define PING
#endif
#define DumpHex(addr, len) _DumpHex(aTHX_ addr, len, __FILE__, __LINE__)
void _DumpHex(pTHX_ const void *, size_t, const char *, int);
#define DD(scalar) _DD(aTHX_ scalar, __FILE__, __LINE__)
void _DD(pTHX_ SV *, const char *, int);
#include <string.h>
#include <wchar.h>
void * _extract_pointer_value(pTHX_ SV * sv, MAGIC * ignore_mg);
void * get_address_v2(pTHX_ SV * sv);
bool is_pin_v2(pTHX_ SV * sv);
const infix_type * resolve_type(pTHX_ const infix_type * type);
SV * wrap_callable_pointer(pTHX_ void * addr, const infix_type * type);
void pull_pointer_as_callable(pTHX_ Affix *, SV *, const infix_type *, void *, bool);
const infix_type * _unwrap_pin_type(const infix_type * type);
void bind_placeholder(
pTHX_ SV *, void *, const infix_type *, uint8_t, uint8_t, bool, SV *, infix_arena_t *, bool, bool);
void pull_pointer_as_pin(pTHX_ Affix *, SV *, const infix_type *, void *, bool);
IV sizeof_type(pTHX_ const char * name);
SV * cast(pTHX_ SV * in, const char * name);
SV * alloc_owned(pTHX_ UV size);
void free_owned(pTHX_ SV * rv);
int is_v2_vtable(MGVTBL * v);
int is_string_list_type(pTHX_ const infix_type * type);
extern MGVTBL vtbl_lazy_aggregate;
extern MGVTBL vtbl_array;
extern MGVTBL vtbl_sint8, vtbl_uint8, vtbl_sint16, vtbl_uint16, vtbl_sint32, vtbl_uint32, vtbl_sint64, vtbl_uint64,
vtbl_float, vtbl_double, vtbl_float16, vtbl_bool, vtbl_sint128, vtbl_uint128, vtbl_void, vtbl_bitfield,
vtbl_pointer, vtbl_array, string_vtable, wstring_vtable, vtbl_lazy_aggregate, vtbl_enum;
Affix_Pin_2_Point_Oh * get_pin_v2(pTHX_ SV * sv);
SV * bind_aggregate(pTHX_ void *, const infix_type *, SV *, bool);
SV * bind_aggregate_anon(pTHX_ void *, const infix_type *, SV * owner, infix_arena_t * a, bool);
void * get_address_v2(pTHX_ SV * sv);
( run in 1.023 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )