parrotcode: Register handling routines | |
Contents | C |
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.
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 *)
void mark_register_stack(Parrot_Interp interpreter, Stack_Chunk_t *stack)
void mark_pmc_register_stack(Parrot_Interp interpreter, Stack_Chunk_t *stack)
void mark_reg_stack(Inter*, Stack_Chunk_t *chunk)
*/
void
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)
void Parrot_push_on_stack(void *thing, INTVAL size, INTVAL type)
void Parrot_pop_off_stack(void *thing, INTVAL type)
include/parrot/register.h, include/parrot/regfuncs.h, and src/stack_common.c
|