Skip to content

Commit

Permalink
Update Continuation to use CallContext
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/branches/context_unify@42122 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
bacek committed Oct 26, 2009
1 parent 4d6743d commit cff28c9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/pmc/continuation.pmc
Expand Up @@ -48,7 +48,6 @@ pmclass Continuation auto_attrs {
ATTR PackFile_ByteCode *seg; /* bytecode segment */
ATTR opcode_t *address; /* start of bytecode, addr to continue */
ATTR PMC *to_ctx; /* pointer to dest context */
ATTR PMC *to_call_object; /* pointer to CallSignature */
/* a Continuation keeps the from_ctx alive */
ATTR PMC *from_ctx; /* sub, this cont is returning from */
ATTR int runloop_id; /* id of the creating runloop. */
Expand All @@ -67,7 +66,6 @@ Initializes the continuation.
Parrot_Continuation_attributes * const attrs = PARROT_CONTINUATION(SELF);

attrs->to_ctx = CURRENT_CONTEXT(interp);
attrs->to_call_object = Parrot_pcc_get_signature(INTERP, attrs->to_ctx);
attrs->from_ctx = CURRENT_CONTEXT(interp);
attrs->runloop_id = 0;
attrs->seg = interp->code;
Expand All @@ -91,7 +89,6 @@ Initializes the continuation.
Parrot_Continuation_attributes * const theirs = PARROT_CONTINUATION(values);

attrs->to_ctx = theirs->to_ctx;
attrs->to_call_object = Parrot_pcc_get_signature(INTERP, attrs->to_ctx);
attrs->from_ctx = CURRENT_CONTEXT(interp);
attrs->runloop_id = 0;
attrs->seg = theirs->seg;
Expand Down Expand Up @@ -129,7 +126,6 @@ Marks the continuation as live.
return;

Parrot_gc_mark_PMC_alive(INTERP, cc->to_ctx);
Parrot_gc_mark_PMC_alive(INTERP, cc->to_call_object);
Parrot_gc_mark_PMC_alive(INTERP, cc->from_ctx);
}

Expand Down Expand Up @@ -234,26 +230,24 @@ destination to continue execution.
PMC *from_ctx = CURRENT_CONTEXT(interp);
PMC *to_ctx = cc->to_ctx;
opcode_t *pc = cc->address;
PMC *call_obj = cc->to_call_object;
PMC *from_obj = Parrot_pcc_get_signature(interp, from_ctx);
UNUSED(next)

Parrot_continuation_check(interp, SELF);
Parrot_continuation_rewind_environment(interp, SELF);

if (!PMC_IS_NULL(from_obj)) {
STRING *string_sig = VTABLE_get_string(INTERP, from_obj);
if (1 /* !PMC_IS_NULL(from_obj) */) {
STRING *string_sig = VTABLE_get_string(INTERP, from_ctx);
/* If there is no string - there is no args */
if (string_sig) {
PMC *raw_sig, *invalid_sig;
Parrot_pcc_parse_signature_string(INTERP, string_sig, &raw_sig, &invalid_sig);

/* Build results signature for continuation */
if (*pc == PARROT_OP_get_results_pc)
call_obj = Parrot_pcc_build_sig_object_returns_from_op(INTERP, call_obj,
Parrot_pcc_build_sig_object_returns_from_op(INTERP, to_ctx,
Parrot_pcc_get_pmc_constant(INTERP, to_ctx, pc[1]), pc);

Parrot_pcc_fill_returns_from_continuation(interp, call_obj, raw_sig, from_obj);
Parrot_pcc_fill_returns_from_continuation(interp, to_ctx, raw_sig, from_ctx);
}
}

Expand Down

0 comments on commit cff28c9

Please sign in to comment.