Skip to content
Browse files

Fix for TT #1029. The return continuation was being mangled in the PI…

…R compreg function, then we weren't able to account for it in the NCI.invoke VTABLE. cache the old value before we call the function, then sanity check the new return continuation value to see if we should update the cache. All tests pass.
  • Loading branch information...
1 parent 851d079 commit 8b188dbbc7d5ecc0cf4425ad24b01ca0ba330152 @Whiteknight Whiteknight committed Jan 5, 2011
Showing with 19 additions and 6 deletions.
  1. +1 −2 compilers/pct/src/PCT/HLLCompiler.pir
  2. +5 −3 src/call/args.c
  3. +13 −1 src/pmc/nci.pmc
View
3 compilers/pct/src/PCT/HLLCompiler.pir
@@ -554,8 +554,7 @@ Transform PAST C<source> into POST.
.param pmc adverbs :slurpy :named
$P0 = compreg 'PIR'
- $P1 = $P0(source)
- .return ($P1)
+ .tailcall $P0(source)
.end
View
8 src/call/args.c
@@ -1532,12 +1532,14 @@ Parrot_pcc_merge_signature_for_tailcall(PARROT_INTERP,
return;
else {
/* Broke encapuslation. Direct poking into CallContext is much faster */
- PMC * return_flags;
+ PMC * temp;
/* Store raw signature */
- GETATTR_CallContext_return_flags(interp, parent, return_flags);
- SETATTR_CallContext_return_flags(interp, tailcall, return_flags);
+ GETATTR_CallContext_return_flags(interp, parent, temp);
+ SETATTR_CallContext_return_flags(interp, tailcall, temp);
+ GETATTR_CallContext_current_cont(interp, parent, temp);
+ SETATTR_CallContext_current_cont(interp, tailcall, temp);
}
}
View
14 src/pmc/nci.pmc
@@ -255,8 +255,20 @@ class, the PMC arguments are shifted down.
GET_ATTR_fb_info(INTERP, SELF, fb_info);
- func(INTERP, SELF, fb_info);
cont = INTERP->current_cont;
+ func(INTERP, SELF, fb_info);
+
+ /* We've cached the old value of the return continuation. The function
+ might change this, but that is not likely. IF the function does
+ change the return continuation value to something valid, we can use
+ it. */
+ {
+ PMC * const new_cont = INTERP->current_cont;
+ if (new_cont != cont) {
+ if (new_cont != NEED_CONTINUATION)
+ cont = new_cont;
+ }
+ }
/*
* If the NCI function was tailcalled, the return result

0 comments on commit 8b188db

Please sign in to comment.
Something went wrong with that request. Please try again.