Alien-LibJIT

 view release on metacpan or  search on metacpan

libjit/jit/jit-internal.h  view on Meta::CPAN

	   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);

/*
 * 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
{



( run in 1.537 second using v1.01-cache-2.11-cpan-5b529ec07f3 )