NAME ^

src/sub.c - Subroutines

DESCRIPTION ^

Sub-routines, continuations, co-routines and other fun stuff...

Functions ^

void save_context(Interp *interp, struct Parrot_Context *ctx)

Save the current "context" of interpreter.

void restore_context(Interp *interp, struct Parrot_Context *ctx)

Set context of interpreter from a context buffer.

void mark_context(Interp *interpreter, struct Parrot_Context *ctx)

Marks the context *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)

The final 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)

Swap **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)

Swaps the context.

struct Parrot_sub *new_sub(Interp *interp)

Returns a new Parrot_sub.

struct Parrot_sub *new_closure(Interp *interp)

Returns a new Parrot_sub with its own sctatchpad.

XXX: Need to document semantics in detail.

struct Parrot_cont *new_continuation(Interp *interp)

Returns a new Parrot_cont with its own copy of the current context.

struct Parrot_cont *new_ret_continuation(Interp *interp)

Returns a new Parrot_cont with its own copy of the current context.

struct Parrot_coro *new_coroutine(Interp *interp)

Returns a new Parrot_coro.

XXX: Need to document semantics in detail.

PMC *new_ret_continuation_pmc(Interp *interp, opcode_t *address)

Returns a new RetContinuation PMC.

SEE ALSO ^

include/parrot/sub.h.

HISTORY ^

Initial version by Melvin on 2002/06/6.


parrot