Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

only set a context *after* it has its registers allocated

  • Loading branch information...
commit 2ef966fbedf6254dbf2eb335ddb92cc9d1968de2 1 parent 64438ce
@plobsing plobsing authored
Showing with 7 additions and 5 deletions.
  1. +4 −3 src/pmc/coroutine.pmc
  2. +3 −2 src/pmc/sub.pmc
View
7 src/pmc/coroutine.pmc
@@ -186,13 +186,14 @@ Swaps the "context".
"tail call to coroutine not allowed");
/* first time set current sub, cont, object */
- if (PMC_IS_NULL(ctx))
+ if (PMC_IS_NULL(ctx)) {
ctx = Parrot_pmc_new(INTERP, enum_class_CallContext);
+ }
+ GET_ATTR_n_regs_used(INTERP, SELF, n_regs_used);
+ Parrot_pcc_allocate_registers(INTERP, ctx, n_regs_used);
Parrot_pcc_set_context(INTERP, ctx);
- GET_ATTR_n_regs_used(INTERP, SELF, n_regs_used);
- Parrot_pcc_allocate_registers(INTERP, ctx, n_regs_used);
Parrot_pcc_set_caller_ctx(INTERP, ctx, caller_ctx);
Parrot_pcc_init_context(INTERP, ctx, caller_ctx);
View
5 src/pmc/sub.pmc
@@ -423,12 +423,13 @@ Invokes the subroutine.
PARROT_ASSERT(!PMC_IS_NULL(ccont));
- if (PMC_IS_NULL(context))
+ if (PMC_IS_NULL(context)) {
context = Parrot_pmc_new(INTERP, enum_class_CallContext);
+ }
+ Parrot_pcc_allocate_registers(INTERP, context, sub->n_regs_used);
Parrot_pcc_set_context(INTERP, context);
Parrot_pcc_set_caller_ctx(INTERP, context, caller_ctx);
- Parrot_pcc_allocate_registers(INTERP, context, sub->n_regs_used);
/* Preserve object */
object = Parrot_pcc_get_object(INTERP, context);
Parrot_pcc_init_context(INTERP, context, caller_ctx);
Please sign in to comment.
Something went wrong with that request. Please try again.