src/register.c - Register handling routines


Parrot has 4 register sets, one for each of its basic types. There are 32 registers in each set.

Each register set has a register frame stack for saving and restoring its contents. Note that, whereas the push{i,n,s,p} opcodes push all 32 registers on to the stack, in the C implementation a register frame is actually only half the register set. The opcode calls the the Parrot_push_{i,n,s,p}() function twice, once for each half of the set.

Functions ^

Note that the API header for this file is include/parrot/regfuncs.h not include/parrot/register.h - that contains the various registers and register frame stacks.

void setup_register_stacks(Parrot_Interp, struct Parrot_Context *)

Sets up the register stacks.

void mark_register_stack(Parrot_Interp interpreter, Stack_Chunk_t *stack)

Marks the INT or NUM register stack as live.

void mark_pmc_register_stack(Parrot_Interp interpreter, Stack_Chunk_t *stack)

Marks the PMC register stack as live.

void mark_reg_stack(Inter*, Stack_Chunk_t *chunk)

Marks one chunk of the register frame stack. Previous chunks are marked by marking the continuation of this frame.

mark_reg_stack(Parrot_Interp interpreter, Stack_Chunk_t* chunk)
    UINTVAL j;
    PObj *obj;

    struct parrot_regs_t *regs = (struct parrot_regs_t *)STACK_DATAP(chunk);

    pobject_lives(interpreter, (PObj*)chunk);

    for (j = 0; j < NUM_REGISTERS; j++) {
        obj = (PObj*) BP_REG_PMC(regs, j);
        if (obj)
            pobject_lives(interpreter, obj);
        obj = (PObj*) BP_REG_STR(regs, j);
        if (obj)
            pobject_lives(interpreter, obj);

void mark_string_register_stack(Parrot_Interp interpreter, Stack_Chunk_t *stack)

Mark the contents of the string register stack as live.

void Parrot_push_on_stack(void *thing, INTVAL size, INTVAL type)

Unimplemented at present.

void Parrot_pop_off_stack(void *thing, INTVAL type)

Unimplemented at present.


include/parrot/register.h, include/parrot/regfuncs.h, and src/stack_common.c