Author: leo
Date: Wed Jul 13 07:07:59 2005
New Revision: 8613

Modified:
   branches/leo-ctx5/classes/continuation.pmc
   branches/leo-ctx5/io/io.c
   branches/leo-ctx5/src/dod.c
Log:
fix a GC bug during return argument passing
add (disabled) gc_debug hook in PIO_putps

Modified: branches/leo-ctx5/classes/continuation.pmc
==============================================================================
--- branches/leo-ctx5/classes/continuation.pmc  (original)
+++ branches/leo-ctx5/classes/continuation.pmc  Wed Jul 13 07:07:59 2005
@@ -218,23 +218,33 @@ destination to continue execution.
         struct parrot_regs_t *caller_regs;
         opcode_t *pc;
 
-        caller_regs = INTERP->ctx.bp;
-        INTERP->ctx = cc->ctx;
-        if (cc->ctx_copy)
-            memcpy(CONTEXT(INTERP->ctx), cc->ctx_copy,
-                    sizeof(struct Parrot_Context));
+        /* debug print before context is switched */
         if (Interp_trace_TEST(INTERP, PARROT_TRACE_SUB_CALL_FLAG)) {
-            PMC *sub = CONTEXT(INTERP->ctx)->current_sub;
+            PMC *sub = CONTEXT(cc->ctx)->current_sub;
 
             PIO_eprintf(INTERP, "# Back in sub '%Ss'\n",
                     Parrot_full_sub_name(INTERP, sub));
         }
+        caller_regs = INTERP->ctx.bp;
+        INTERP->ctx = cc->ctx;
+        if (cc->ctx_copy)
+            memcpy(CONTEXT(INTERP->ctx), cc->ctx_copy,
+                    sizeof(struct Parrot_Context));
         pc = cc->address;
         if (pc) {
             if (CONTEXT(INTERP->ctx)->current_results) {
+                /*
+                 * the register pointer is already switched back
+                 * to the caller, therefore the registers of the
+                 * sub we are returning from isn't marked, if
+                 * inside argument passing a DOD run is triggered
+                 * therefore we have to block DOD
+                 */
+                Parrot_block_DOD(INTERP);
                 parrot_pass_args(INTERP, cc->seg,
                         caller_regs,
                         PARROT_OP_get_results_pc);
+                Parrot_unblock_DOD(INTERP);
             }
             INTERP->current_returns = NULL;
         }

Modified: branches/leo-ctx5/io/io.c
==============================================================================
--- branches/leo-ctx5/io/io.c   (original)
+++ branches/leo-ctx5/io/io.c   Wed Jul 13 07:07:59 2005
@@ -1010,6 +1010,11 @@ PIO_putps(theINTERP, PMC *pmc, STRING *s
     ParrotIO *io = PMC_data0(pmc);
     assert((unsigned int)l != 0xdeadbeefU);
     assert(io != 0);
+#if ! DISABLE_GC_DEBUG
+    /* trigger GC for debug - but not during tests */
+    if (0 && GC_DEBUG(interpreter))
+        Parrot_do_dod_run(interpreter, DOD_trace_stack_FLAG);
+#endif
     return PIO_write_down(interpreter, l, io, s);
 }
 

Modified: branches/leo-ctx5/src/dod.c
==============================================================================
--- branches/leo-ctx5/src/dod.c (original)
+++ branches/leo-ctx5/src/dod.c Wed Jul 13 07:07:59 2005
@@ -835,7 +835,7 @@ Parrot_dod_sweep(Interp *interpreter,
                     /*
                      * invalidate the PMC
                      */
-                    PMC_struct_val(p) = (void*)0xdeadbeef;
+                    p->vtable = (void*)0xdeadbeef;
                     PMC_pmc_val(p) = (void*)0xdeadbeef;
                     p->pmc_ext = (void*)0xdeadbeef;
 #endif

Reply via email to