Author: tene
Date: Tue Dec  2 23:37:41 2008
New Revision: 33451

Modified:
   trunk/src/sub.c
   trunk/t/pmc/exception.t

Log:
[continuations]
* Fix logic for invalidating return continuations when we create a
  continuation.  I'm pretty sure that the previous code wouldn't have
  ever worked.
* Fix the location of pop_eh in the (previously failing) test for this.
* This (probably) resolves RT #56458

Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c     (original)
+++ trunk/src/sub.c     Tue Dec  2 23:37:41 2008
@@ -288,6 +288,7 @@
 invalidate_retc_context(PARROT_INTERP, ARGMOD(PMC *cont))
 {
     Parrot_Context *ctx = PMC_cont(cont)->from_ctx;
+    cont = ctx->current_cont;
 
     Parrot_set_context_threshold(interp, ctx);
     while (1) {
@@ -296,12 +297,12 @@
          * if one were created, everything up the chain would have been
          * invalidated earlier.
          */
-        if (cont->vtable != interp->vtables[enum_class_RetContinuation])
+        if (!cont || cont->vtable != 
interp->vtables[enum_class_RetContinuation])
             break;
         cont->vtable = interp->vtables[enum_class_Continuation];
         Parrot_context_ref(interp, ctx);
+        ctx  = ctx->caller_ctx;
         cont = ctx->current_cont;
-        ctx  = PMC_cont(cont)->from_ctx;
     }
 
 }

Modified: trunk/t/pmc/exception.t
==============================================================================
--- trunk/t/pmc/exception.t     (original)
+++ trunk/t/pmc/exception.t     Tue Dec  2 23:37:41 2008
@@ -595,9 +595,7 @@
 current inst/
 OUTPUT
 
-SKIP: {
-    skip("TODO test causes infinite loop in new exception implementation", 1);
-pir_output_is(<<'CODE', <<'OUTPUT', "taking a continuation promotes RetCs", 
todo => 'see RT #56458');
+pir_output_is(<<'CODE', <<'OUTPUT', "taking a continuation promotes RetCs");
 ## This test creates a continuation in a inner sub and re-invokes it later.  
The
 ## re-invocation signals an error, which is caught by an intermediate sub.
 ## Returning from the "test" sub the second time failed in r28794; invoking
@@ -626,10 +624,10 @@
     print "  calling foo\n"
     .local pmc cont
     cont = foo()
-    pop_eh
     print "  returning from test.\n"
     .return (cont)
 handle_errs:
+    pop_eh
     print "  test:  caught error\n"
     .return (cont)
 .end
@@ -658,7 +656,6 @@
 back from test
 done.
 OUTPUT
-}
 
 pir_error_output_like( <<'CODE', <<'OUTPUT', "throw - no handler" );
 .sub main :main

Reply via email to