Alien-LibJIT

 view release on metacpan or  search on metacpan

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

 * a register pair. Return the other register of the pair if it is
 * required and return -1 otherwise. */
#if defined(JIT_NATIVE_INT32) && !defined(JIT_BACKEND_INTERP)
# define jit_reg_get_pair(type,reg)	_jit_reg_get_pair(type, reg)
#else
# define jit_reg_get_pair(type,reg)	(-1)
#endif

/*
 * Manipulate register usage masks.  The backend may override these
 * definitions if it has more registers than can fit in a "jit_uint".
 */
#if !defined(jit_regused_init)

typedef jit_uint jit_regused_t;

#define	jit_regused_init		(0)
#define	jit_regused_init_used		(~0)

#define	jit_reg_is_used(mask,reg)	(((mask) & (((jit_uint)1) << (reg))) != 0)

#define	jit_reg_set_used(mask,reg)	((mask) |= (((jit_uint)1) << (reg)))

#define	jit_reg_clear_used(mask,reg)	((mask) &= ~(((jit_uint)1) << (reg)))

#endif /* !defined(jit_regused_init) */

/*
 * Information about a register's contents.
 */
#define	JIT_MAX_REG_VALUES		8
typedef struct jit_regcontents jit_regcontents_t;
struct jit_regcontents
{
	/* List of values that are currently stored in this register */
	jit_value_t		values[JIT_MAX_REG_VALUES];
	int			num_values;

	/* Current age of this register.  Older registers are reclaimed first */
	int			age;

	/* Flag that indicates if this register is holding the first
	   word of a double-word long value (32-bit platforms only) */
	char			is_long_start;

	/* Flag that indicates if this register is holding the second
	   word of a double-word long value (32-bit platforms only) */
	char			is_long_end;

	/* Flag that indicates if the register holds a valid value,
	   but there are no actual "jit_value_t" objects associated */
	char			used_for_temp;
};

/*
 * Code generation information.
 */
typedef struct jit_gencode *jit_gencode_t;
struct jit_gencode
{
	jit_context_t		context;	/* Context this position is attached to */
	unsigned char		*ptr;		/* Current code pointer */
	unsigned char		*mem_start;	/* Available space start */
	unsigned char		*mem_limit;	/* Available space limit */
	unsigned char		*code_start;	/* Real code start */
	unsigned char		*code_end;	/* Real code end */
	jit_regused_t		permanent;	/* Permanently allocated global regs */
	jit_regused_t		touched;	/* All registers that were touched */
	jit_regused_t		inhibit;	/* Temporarily inhibited registers */
	jit_regcontents_t	contents[JIT_NUM_REGS]; /* Contents of each register */
	int			current_age;	/* Current age value for registers */
#ifdef JIT_REG_STACK
	int			reg_stack_top;	/* Current register stack top */
#endif
#ifdef jit_extra_gen_state
	jit_extra_gen_state;			/* CPU-specific extra information */
#endif
	void			*epilog_fixup;	/* Fixup list for function epilogs */
	int			stack_changed;	/* Stack top changed since entry */
	jit_varint_encoder_t	offset_encoder;	/* Bytecode offset encoder */
};

/*
 * ELF machine type and ABI information.
 */
typedef struct jit_elf_info jit_elf_info_t;
struct jit_elf_info
{
	int			machine;
	int			abi;
	int			abi_version;
};

/*
 * External function defintions.
 */

/*
 * Determine if there is sufficient space in the code cache.
 * If not throws JIT_RESULT_CACHE_FULL exception.
 */
void _jit_gen_check_space(jit_gencode_t gen, int space);

/*
 * Allocate a memory chunk for data.
 */
void *_jit_gen_alloc(jit_gencode_t gen, unsigned long size);

void _jit_init_backend(void);
void _jit_gen_get_elf_info(jit_elf_info_t *info);
int _jit_create_entry_insns(jit_function_t func);
int _jit_create_call_setup_insns
	(jit_function_t func, jit_type_t signature,
	 jit_value_t *args, unsigned int num_args,
	 int is_nested, int nesting_level, jit_value_t *struct_return, int flags);
int _jit_setup_indirect_pointer(jit_function_t func, jit_value_t value);
int _jit_create_call_return_insns
	(jit_function_t func, jit_type_t signature,
	 jit_value_t *args, unsigned int num_args,
	 jit_value_t return_value, int is_nested);
int _jit_opcode_is_supported(int opcode);



( run in 0.675 second using v1.01-cache-2.11-cpan-e1769b4cff6 )