parrotcode: Register handling routines | |
Contents | C |
src/register.c - Register handling routines
Parrot has 4 register sets, one for each of its basic types. The amount of registers in each set varies depending on the use counts of the respective subroutine and is determined by the PASM/PIR compiler in the register allocation pass (imcc/reg_alloc.c).
There is one register stack to support the saveall
and restoreall
opcodes.
The former copies all registers to a newly allocated storage and points the register base pointers to this storage.
In Parrot_pop_regs
the register base pointers are restored to the previous values and the allocated register memory is discarded.
static void new_context_mem(Interp *, context_mem *ctx_mem)
void destroy_context(Interp *)
void create_initial_context(Interp *)
void parrot_gc_context(Interp *)
parrot_context_t *Parrot_alloc_context(Interp *, INTVAL *n_regs_used)
n_regs_used
is not copied; just the pointer is stored.
The function returns the new context.parrot_context_t *Parrot_push_context(Interp *, INTVAL *n_regs_used)
caller_ctx
,
suitable to use with Parrot_pop_context
.parrot_context_t *Parrot_dup_context(Interp *, parrot_context_t*)
void Parrot_set_context_threshold(Interp *, parrot_context_t *ctxp)
void Parrot_free_context(Interp *, parrot_context_t *ctxp, int re_use)
re_use
is true,
this function is called by a return continuation invoke,
else from the destructor of a continuation.void Parrot_pop_context(Interp *)
Parrot_push_context
and restore the previous context.void setup_register_stacks(Interp *)
void Parrot_push_regs(Interp *)
void Parrot_pop_regs(Interp *)
void mark_register_stack(Parrot_Interp interp, Stack_Chunk_t *stack)
include/parrot/register.h and src/stack_common.c
|