parrotcode: compilers/imcc/pbc.c | |
Contents | Compilers |
compilers/imcc/pbc.c
emit imcc instructions into Parrot interpreter
the e_pbc_emit function is called per instruction
Notes:
I'm using existing data structures here (SymReg*) to store various global items (currently only PMC constants). The index in the constant table is in SymReg* ->color data member. This looks odd, but the register number from imc.c:allocate is also there for variables, so it's a little bit consistent at least.
So when reading color here it's either a constant table index or a Parrot register number, depending on data type.
TODO memory clean up
-lt
static void imcc_globals_destroy(SHIM_INTERP, SHIM(int ex), SHIM(void *param))
int e_pbc_open(PARROT_INTERP, SHIM(void *param))
PARROT_WARN_UNUSED_RESULT static int old_blocks(void)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL opcode_t *make_jit_info(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
static void make_new_sub(NOTNULL(IMC_Unit *unit))
PARROT_WARN_UNUSED_RESULT static int get_old_size(PARROT_INTERP, NOTNULL(int *ins_line))
static void store_sub_size(size_t size, size_t ins_line)
static void store_fixup(PARROT_INTERP, NOTNULL(SymReg *r), int pc, int offset)
static void store_key_const(ARGIN(const char *str), int idx)
PARROT_WARN_UNUSED_RESULT static int get_codesize(PARROT_INTERP, NOTNULL(IMC_Unit *unit), NOTNULL(int *src_lines))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static subs_t *find_global_label(ARGIN(const char *name), ARGIN(const subs_t *sym), NOTNULL(int *pc))
static void fixup_globals(PARROT_INTERP)
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL STRING *IMCC_string_from_reg(PARROT_INTERP, ARGIN(const SymReg *r))
PARROT_WARN_UNUSED_RESULT static int add_const_str(PARROT_INTERP, ARGIN(const SymReg *r))
PARROT_WARN_UNUSED_RESULT static int add_const_num(PARROT_INTERP, ARGIN_NULLOK(const char *buf))
PARROT_CANNOT_RETURN_NULL PARROT_MALLOC static PMC *mk_multi_sig(PARROT_INTERP, NOTNULL(SymReg *r))
PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static PMC *create_lexinfo(PARROT_INTERP, NOTNULL(IMC_Unit *unit), NOTNULL(PMC *sub), int need_lex)
PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL static PMC *find_outer(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
static int add_const_pmc_sub(PARROT_INTERP, NOTNULL(SymReg *r), int offs, int end)
static int add_const_key(PARROT_INTERP, NOTNULL(opcode_t key[]), int size, ARGIN(const char *s_key))
PARROT_CONST_FUNCTION PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static const char *slice_deb(int bits)
static opcode_t build_key(PARROT_INTERP, NOTNULL(SymReg *key_reg))
INTVAL IMCC_int_from_reg(PARROT_INTERP, ARGIN(const SymReg *r))
static void make_pmc_const(PARROT_INTERP, NOTNULL(SymReg *r))
static void add_1_const(PARROT_INTERP, NOTNULL(SymReg *r))
static void constant_folding(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
int e_pbc_new_sub(SHIM_INTERP, SHIM(void *param), NOTNULL(IMC_Unit *unit))
int e_pbc_end_sub(PARROT_INTERP, SHIM(void *param), NOTNULL(IMC_Unit *unit))
static void verify_signature(PARROT_INTERP, ARGIN(const Instruction *ins), NOTNULL(opcode_t *pc))
- check if any get_ argument contains constants
- fill in type bits for argument types and constants, if missing
int e_pbc_emit(PARROT_INTERP, SHIM(void *param), NOTNULL(IMC_Unit *unit), ARGIN(const Instruction *ins))
int e_pbc_close(PARROT_INTERP, SHIM(void *param))
|