Alien-LibJIT
view release on metacpan or search on metacpan
libjit/jit/jit-internal.h view on Meta::CPAN
#define JIT_INSN_DEST_IS_VALUE 0x1000
/*
* Information about each label associated with a function.
*
* Multiple labels may belong to the same basic block. Such labels are
* linked into list.
*/
typedef struct _jit_label_info _jit_label_info_t;
struct _jit_label_info
{
/* Block the label assigned to */
jit_block_t block;
/* Next label that might belong to the same block */
jit_label_t alias;
/* Label flags */
int flags;
};
#define JIT_LABEL_ADDRESS_OF 0x0001
/*
* Information that is associated with a function for building
* the instructions and values. This structure can be discarded
* once the function has been fully compiled.
*/
typedef struct _jit_builder *jit_builder_t;
struct _jit_builder
{
/* Entry point for the function (and the head of the block list) */
jit_block_t entry_block;
/* Exit point for the function (and the tail of the block list) */
jit_block_t exit_block;
/* The position to insert initialization blocks */
jit_block_t init_block;
/* The current block that is being constructed */
jit_block_t current_block;
/* The list of deleted blocks */
jit_block_t deleted_blocks;
/* Blocks sorted in order required by an optimization pass */
jit_block_t *block_order;
int num_block_order;
/* The next block label to be allocated */
jit_label_t next_label;
/* Mapping from label numbers to blocks */
_jit_label_info_t *label_info;
jit_label_t max_label_info;
/* Exception handling definitions for the function */
jit_value_t setjmp_value;
jit_value_t thrown_exception;
jit_value_t thrown_pc;
jit_label_t catcher_label;
jit_value_t eh_frame_info;
/* Flag that is set to indicate that this function is not a leaf */
unsigned non_leaf : 1;
/* Flag that indicates if we've seen code that may throw an exception */
unsigned may_throw : 1;
/* Flag that indicates if the function has an ordinary return */
unsigned ordinary_return : 1;
/* Flag that indicates that the current function contains a tail call */
unsigned has_tail_call : 1;
/* Generate position-independent code */
unsigned position_independent : 1;
/* Memory pools that contain values, instructions, and metadata blocks */
jit_memory_pool value_pool;
jit_memory_pool edge_pool;
jit_memory_pool meta_pool;
/* Common constants that have been cached */
jit_value_t null_constant;
jit_value_t zero_constant;
/* The values for the parameters, structure return, and parent frame */
jit_value_t *param_values;
jit_value_t struct_return;
jit_value_t parent_frame;
/* Metadata that is stored only while the function is being built */
jit_meta_t meta;
/* Current size of the local variable frame (used by the back end) */
jit_nint frame_size;
/* Number of stack items that are queued for a deferred pop */
jit_nint deferred_items;
/* Size of the outgoing parameter area in the frame */
jit_nint param_area_size;
#ifdef _JIT_COMPILE_DEBUG
int block_count;
int insn_count;
#endif
};
/*
* Internal structure of a function.
*/
struct _jit_function
{
/* The context that the function is associated with */
jit_context_t context;
jit_function_t next;
jit_function_t prev;
/* Containing function in a nested context */
jit_function_t nested_parent;
/* Metadata that survives once the builder is discarded */
jit_meta_t meta;
/* The signature for this function */
jit_type_t signature;
/* The builder information for this function */
jit_builder_t builder;
/* Debug information for this function */
jit_varint_data_t bytecode_offset;
/* Cookie value for this function */
void *cookie;
/* Flag bits for this function */
unsigned is_recompilable : 1;
unsigned is_optimized : 1;
unsigned no_throw : 1;
unsigned no_return : 1;
unsigned has_try : 1;
unsigned optimization_level : 8;
/* Flag set once the function is compiled */
int volatile is_compiled;
/* The entry point for the function's compiled code */
void * volatile entry_point;
/* The function to call to perform on-demand compilation */
jit_on_demand_func on_demand;
#ifndef JIT_BACKEND_INTERP
# ifdef jit_redirector_size
/* Buffer that contains the redirector for this function.
Redirectors are used to support on-demand compilation */
unsigned char *redirector;
# endif
/* Buffer that contains the indirector for this function.
The indirector jumps to the address that is currently
stored in the entry_point field. Indirectors are used
to support recompilation and on-demand compilation. */
unsigned char *indirector;
#endif
};
/*
* Ensure that there is a builder associated with a function.
*/
int _jit_function_ensure_builder(jit_function_t func);
/*
* Free the builder associated with a function.
*/
void _jit_function_free_builder(jit_function_t func);
/*
* 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);
( run in 0.395 second using v1.01-cache-2.11-cpan-119454b85a5 )