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)
opcode_t *make_jit_info(PARROT_INTERP, NOTNULL(IMC_Unit *unit))
static void make_new_sub(NOTNULL(IMC_Unit *unit))
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(NOTNULL(const char *str), int idx)
PARROT_WARN_UNUSED_RESULT static int get_codesize(PARROT_INTERP, NOTNULL(IMC_Unit *unit), NOTNULL(int *src_lines))
static subs_t *find_global_label(NOTNULL(const char *name), NOTNULL(const subs_t *sym), NOTNULL(int *pc))
static void fixup_globals(PARROT_INTERP)
STRING *IMCC_string_from_reg(PARROT_INTERP, NOTNULL(const SymReg *r))
static int add_const_str(PARROT_INTERP, NOTNULL(const SymReg *r))
static int add_const_num(PARROT_INTERP, const char *buf)
static PMC *mk_multi_sig(PARROT_INTERP, NOTNULL(SymReg *r))
static PMC *create_lexinfo(PARROT_INTERP, IMC_Unit *unit, PMC *sub, int need_lex)
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, NOTNULL(const char *s_key))
PARROT_CONST_FUNCTION 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, NOTNULL(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, NOTNULL(const Instruction *ins), 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), NOTNULL(const Instruction *ins))
int e_pbc_close(PARROT_INTERP, SHIM(void *param))
|