Author: leo
Date: Fri Nov 11 02:58:20 2005
New Revision: 9899

Modified:
   trunk/classes/exception_handler.pmc
   trunk/src/dod.c
   trunk/src/exceptions.c
   trunk/src/hash.c
Log:
Fix a nasty GC bug visible in tcl/t/cmd_array #14, #22, ...

* resumable exceptions did create another returncontinuation
* when mark was called and the subroutine left normally
  bogus (dead, recycled) context was marked

See also the comment in src/exceptions.c

--
* fix one unitialised warning
* assert not marking dead objects


Modified: trunk/classes/exception_handler.pmc
==============================================================================
--- trunk/classes/exception_handler.pmc (original)
+++ trunk/classes/exception_handler.pmc Fri Nov 11 02:58:20 2005
@@ -66,6 +66,11 @@ Initializes the exception handler.
             PMC_cont_ASSIGN(SELF, NULL);
         }
     }
+    PMC* clone  () {
+        PMC *result = SUPER();
+        PObj_custom_mark_CLEAR(result);
+        return result;
+    }
 }
 
 /*

Modified: trunk/src/dod.c
==============================================================================
--- trunk/src/dod.c     (original)
+++ trunk/src/dod.c     Fri Nov 11 02:58:20 2005
@@ -470,6 +470,7 @@ Parrot_dod_trace_children(Interp *interp
             }
             else {
                 /* All that's left is the custom */
+                assert(!PObj_on_free_list_TEST(current));
                 VTABLE_mark(interpreter, current);
             }
         }

Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c      (original)
+++ trunk/src/exceptions.c      Fri Nov 11 02:58:20 2005
@@ -393,10 +393,21 @@ throw_exception(Interp * interpreter, PM
     if (!handler)
         return NULL;
     /* create return continuation with current context */
+#if 0
+    /*
+     * XXX Besides that resumable exceptions are a but doubtful,
+     *     this is wrong: when the subroutine is left via it's
+     *     own RetContinuation the call frame is immediately
+     *     recycled, but this RetContinuation still points to it
+     *     and, when mark() is called, nice crashes are occuring
+     *     Sell also languages/tcl/t/cmd_array*.t (_14, _22 and more).
+     *     Either create a full Continuation or don't.
+     */
     if (dest) {
         VTABLE_set_pmc_keyed_int(interpreter, exception, 4,
                 new_ret_continuation_pmc(interpreter, dest));
     }
+#endif
     /* put the handler aka continuation ctx in the interpreter */
     address = VTABLE_invoke(interpreter, handler, NULL);
     /* XXX preserve P5 register */

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c    (original)
+++ trunk/src/hash.c    Fri Nov 11 02:58:20 2005
@@ -597,6 +597,7 @@ new_hash_x(Interp *interpreter, Hash **h
         hash_comp_fn compare, hash_hash_key_fn keyhash)
 {
     Hash *hash = mem_sys_allocate(sizeof(Hash));
+    hash->container = NULL;
     *hptr = hash;
     init_hash(interpreter, hash, val_type, hkey_type,
             compare, keyhash);

Reply via email to