| parrotcode: Subroutines | |
| Contents | C |

src/sub.c - Subroutines

Subroutines, 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.
interp_stack and ctx_stack are already swapped here.static void restore_stack( struct Stack_Chunk **interp_stack, struct Stack_Chunk **ctx_stack, struct Stack_Chunk **saved_stack, struct Stack_Chunk *saved_base)prepend_stack().
interp_stack and ctx_stack are already swapped here.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.void mark_retc_cache(Interp *)void add_to_retc_cache(Interp *interpreter, PMC *pmc)pmc to the cache and turn off custom marking,
so that its context isn't marked.PMC_cont(pmc) remains allocated. while (pmc) {
pobject_lives(interpreter, (PObj*)pmc);
pmc = PREV_RETC(pmc);
}
}
if (mc->retc_cache)
PREV_RETC(mc->retc_cache) = mc->retc_cache;
PREV_RETC(pmc) = NULL;
mc->retc_cache = pmc;
/* XXX expensive w. ARENA_DOD_FLAGS */
PObj_custom_mark_CLEAR(pmc);
}
PMC *new_ret_continuation_pmc(Interp *interp, opcode_t *address)RetContinuation PMC. Uses one from the cache, if possible; otherwise, creates a new one.void copy_regs(Interp *, struct parrot_regs_t *caller_regs)caller_regs to interpreter. void invalidate_retc_context(Interp *, struct Parrot_Context *ctx)
include/parrot/sub.h.

Initial version by Melvin on 2002/06/6.
|
|
|