Alien-LibJIT
view release on metacpan or search on metacpan
libjit/jit/jit-internal.h view on Meta::CPAN
* Destroy all memory associated with a function.
*/
void _jit_function_destroy(jit_function_t func);
/*
* Compute value liveness and "next use" information for a function.
*/
void _jit_function_compute_liveness(jit_function_t func);
/*
* Compile a function on-demand. Returns the entry point.
*/
void *_jit_function_compile_on_demand(jit_function_t func);
/*
* Get the bytecode offset that is associated with a native
* offset within a method. Returns JIT_CACHE_NO_OFFSET
* if the bytecode offset could not be determined.
*/
unsigned long _jit_function_get_bytecode(jit_function_t func, void *func_info, void *pc, int exact);
/*
* Information about a registered external symbol.
*/
typedef struct jit_regsym *jit_regsym_t;
struct jit_regsym
{
void *value;
int after;
char name[1];
};
/*
* Internal structure of a context.
*/
struct _jit_context
{
/* The context's memory control */
jit_memory_manager_t memory_manager;
jit_memory_context_t memory_context;
jit_mutex_t memory_lock;
/* Lock that controls access to the building process */
jit_mutex_t builder_lock;
/* List of functions that are currently registered with the context */
jit_function_t functions;
jit_function_t last_function;
/* Metadata that is associated with the context */
jit_meta_t meta;
/* ELF binaries that have been loaded into this context */
jit_readelf_t elf_binaries;
/* Table of symbols that have been registered with this context */
jit_regsym_t *registered_symbols;
int num_registered_symbols;
/* Debugger support */
jit_debugger_hook_func debug_hook;
jit_debugger_t debugger;
/* On-demand compilation driver */
jit_on_demand_driver_func on_demand_driver;
};
void *_jit_malloc_exec(unsigned int size);
void _jit_free_exec(void *ptr, unsigned int size);
void _jit_flush_exec(void *ptr, unsigned int size);
void _jit_memory_lock(jit_context_t context);
void _jit_memory_unlock(jit_context_t context);
int _jit_memory_ensure(jit_context_t context);
void _jit_memory_destroy(jit_context_t context);
jit_function_info_t _jit_memory_find_function_info(jit_context_t context, void *pc);
jit_function_t _jit_memory_get_function(jit_context_t context, jit_function_info_t info);
void *_jit_memory_get_function_start(jit_context_t context, jit_function_info_t info);
void *_jit_memory_get_function_end(jit_context_t context, jit_function_info_t info);
jit_function_t _jit_memory_alloc_function(jit_context_t context);
void _jit_memory_free_function(jit_context_t context, jit_function_t func);
int _jit_memory_start_function(jit_context_t context, jit_function_t func);
int _jit_memory_end_function(jit_context_t context, int result);
int _jit_memory_extend_limit(jit_context_t context, int count);
void *_jit_memory_get_limit(jit_context_t context);
void *_jit_memory_get_break(jit_context_t context);
void _jit_memory_set_break(jit_context_t context, void *brk);
void *_jit_memory_alloc_trampoline(jit_context_t context);
void _jit_memory_free_trampoline(jit_context_t context, void *ptr);
void *_jit_memory_alloc_closure(jit_context_t context);
void _jit_memory_free_closure(jit_context_t context, void *ptr);
void *_jit_memory_alloc_data(jit_context_t context, jit_size_t size, jit_size_t align);
/*
* Backtrace control structure, for managing stack traces.
* These structures must be allocated on the stack.
*/
typedef struct jit_backtrace *jit_backtrace_t;
struct jit_backtrace
{
jit_backtrace_t parent;
void *pc;
void *security_object;
jit_meta_free_func free_security_object;
};
/*
* Push a new backtrace onto the stack. The fields in "trace" are filled in.
*/
void _jit_backtrace_push(jit_backtrace_t trace, void *pc);
/*
* Pop the top-most backtrace item.
*/
void _jit_backtrace_pop(void);
/*
* Reset the backtrace stack to "trace". Used in exception catch
* blocks to fix up the backtrace information.
libjit/jit/jit-internal.h view on Meta::CPAN
/*
* Record the label mapping for a block.
*/
int _jit_block_record_label(jit_block_t block, jit_label_t label);
/*
* Record the label flags.
*/
int _jit_block_record_label_flags(jit_function_t func, jit_label_t label, int flags);
/*
* Add an instruction to a block.
*/
jit_insn_t _jit_block_add_insn(jit_block_t block);
/*
* Get the last instruction in a block. NULL if the block is empty.
*/
jit_insn_t _jit_block_get_last(jit_block_t block);
/*
* The block goes just before the function end possibly excluding
* some empty blocks.
*/
int _jit_block_is_final(jit_block_t block);
/*
* Free one element in a metadata list.
*/
void _jit_meta_free_one(void *meta);
/*
* Determine if a NULL pointer check is redundant. The specified
* iterator is assumed to be positioned one place beyond the
* "check_null" instruction that we are testing.
*/
int _jit_insn_check_is_redundant(const jit_insn_iter_t *iter);
/*
* Get the correct opcode to use for a "load" instruction,
* starting at a particular opcode base. We assume that the
* instructions are laid out as "sbyte", "ubyte", "short",
* "ushort", "int", "long", "float32", "float64", "nfloat",
* and "struct".
*/
int _jit_load_opcode(int base_opcode, jit_type_t type,
jit_value_t value, int no_temps);
/*
* Get the correct opcode to use for a "store" instruction.
* We assume that the instructions are laid out as "byte",
* "short", "int", "long", "float32", "float64", "nfloat",
* and "struct".
*/
int _jit_store_opcode(int base_opcode, int small_base, jit_type_t type);
/*
* Function that is called upon each breakpoint location.
*/
void _jit_debugger_hook(jit_function_t func, jit_nint data1, jit_nint data2);
/*
* Internal structure of a type descriptor.
*/
struct jit_component
{
jit_type_t type;
jit_nuint offset;
char *name;
};
struct _jit_type
{
unsigned int ref_count;
int kind : 19;
int abi : 8;
int is_fixed : 1;
int layout_flags : 4;
jit_nuint size;
jit_nuint alignment;
jit_type_t sub_type;
unsigned int num_components;
struct jit_component components[1];
};
struct jit_tagged_type
{
struct _jit_type type;
void *data;
jit_meta_free_func free_func;
};
/*
* Pre-defined type descriptors.
*/
extern struct _jit_type const _jit_type_void_def;
extern struct _jit_type const _jit_type_sbyte_def;
extern struct _jit_type const _jit_type_ubyte_def;
extern struct _jit_type const _jit_type_short_def;
extern struct _jit_type const _jit_type_ushort_def;
extern struct _jit_type const _jit_type_int_def;
extern struct _jit_type const _jit_type_uint_def;
extern struct _jit_type const _jit_type_nint_def;
extern struct _jit_type const _jit_type_nuint_def;
extern struct _jit_type const _jit_type_long_def;
extern struct _jit_type const _jit_type_ulong_def;
extern struct _jit_type const _jit_type_float32_def;
extern struct _jit_type const _jit_type_float64_def;
extern struct _jit_type const _jit_type_nfloat_def;
extern struct _jit_type const _jit_type_void_ptr_def;
/*
* Intrinsic signatures.
*
* Naming convention is return type folowed by an underscore and the
* argument types.
*
* jit_int -> i (lower case I)
* jit_uint -> I
* jit_long -> l (lower case L)
* jit_ulong -> L
( run in 0.711 second using v1.01-cache-2.11-cpan-02777c243ea )