parrotcode: Subroutines | |
Contents | C |
src/sub.c - Subroutines
Sub-routines, continuations, co-routines and other fun stuff...
void save_context(Interp *interp, struct Parrot_Context *ctx)
void restore_context(Interp *interp, struct Parrot_Context *ctx)
void mark_context(Interp *interpreter, struct Parrot_Context *ctx)
*ctx
.static void prepend_stack( struct Stack_Chunk **interp_stack, struct Stack_Chunk **ctx_stack, struct Stack_Chunk *saved_stack, struct Stack_Chunk *saved_base)
ctx_stack
= interp_stack
+ saved_stack
,
which gets swapped with the interp_stack
during the prepend.static void restore_stack( struct Stack_Chunk **interp_stack, struct Stack_Chunk **ctx_stack, struct Stack_Chunk **saved_stack, struct Stack_Chunk *saved_base)
**interp_stack
and **ctx_stack
and save the coroutine only parts of the stack in **saved_stack
,
so effectively undoing prepend_stack()
.void swap_context(Interp *interp, struct PMC *sub)
struct Parrot_sub *new_sub(Interp *interp)
Parrot_sub
.struct Parrot_sub *new_closure(Interp *interp)
Parrot_sub
with its own sctatchpad.struct Parrot_cont *new_continuation(Interp *interp)
Parrot_cont
with its own copy of the current context.struct Parrot_cont *new_ret_continuation(Interp *interp)
Parrot_cont
with its own copy of the current context.struct Parrot_coro *new_coroutine(Interp *interp)
Parrot_coro
.PMC *new_ret_continuation_pmc(Interp *interp, opcode_t *address)
RetContinuation
PMC.include/parrot/sub.h.
Initial version by Melvin on 2002/06/6.
|