NAME ^

compilers/imcc/pbc.c

DESCRIPTION ^

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

Functions ^

static void imcc_globals_destroy

RT #48260: Not yet documented!!!

static int add_const_table

Adds an empty item to constant table, returning its position.

static int add_const_table_pmc

Adds a PMC to the const table, returning its position.

static int add_const_table_key

Adds a key to the const table, returning its position.

int e_pbc_open

RT #48260: Not yet documented!!!

static int old_blocks

get size/line of bytecode in ops till now

opcode_t *make_jit_info

RT #48260: Not yet documented!!!

static void make_new_sub

allocate a new globals.cs->subs structure

static int get_old_size

get size/line of bytecode in ops till now

static void store_sub_size

RT #48260: Not yet documented!!!

static void store_fixup

RT #48260: Not yet documented!!!

static void store_key_const

RT #48260: Not yet documented!!!

static int get_codesize

store globals for later fixup return size in ops

static subs_t *find_global_label

get a global label, return the pc (absolute)

static void fixup_globals

fix global stuff

STRING *IMCC_string_from_reg

RT #48260: Not yet documented!!!

static int add_const_str

add constant string to constant_table

static int add_const_num

RT #48260: Not yet documented!!!

static PMC *mk_multi_sig

RT #48260: Not yet documented!!!

static PMC *create_lexinfo

RT #48260: Not yet documented!!!

static PMC *find_outer

RT #48260: Not yet documented!!!

static int add_const_pmc_sub

RT #48260: Not yet documented!!!

static int add_const_key

add constant key to constant_table

static const char *slice_deb

RT #48260: Not yet documented!!!

static opcode_t build_key

color is a Parrot register number or a constant table index

for the rest, please consult PDD08_KEYS(1)

additionally, I build a string representation of the key, which gets cached in the globals.keys

INTVAL IMCC_int_from_reg

RT #48260: Not yet documented!!!

static void make_pmc_const

RT #48260: Not yet documented!!!

static void add_1_const

RT #48260: Not yet documented!!!

static void constant_folding

store a constants idx for later reuse

int e_pbc_new_sub

RT #48260: Not yet documented!!!

int e_pbc_end_sub

RT #48260: Not yet documented!!!

static void verify_signature

 - check if any get_ argument contains constants
 - fill in type bits for argument types and constants, if missing
int e_pbc_emit

now let the fun begin, actually emit code for one ins

int e_pbc_close

RT #48260: Not yet documented!!!


parrot