In the spirit of getting real continuations working Just Right, this
modifies IMCC's PCC implementation to emit the updatecc *after* the
pushtop, so that the redundant pushtop isn't necessary when returning
with a real continuation.

I'm also thinking that updatecc should cow_copy_context, not
save_context.  Right?

Luke

Index: imcc/pcc.c
===================================================================
RCS file: /cvs/public/parrot/imcc/pcc.c,v
retrieving revision 1.39
diff -u -r1.39 pcc.c
--- imcc/pcc.c  16 Dec 2003 08:53:34 -0000      1.39
+++ imcc/pcc.c  14 Jan 2004 06:09:31 -0000
@@ -997,13 +997,13 @@
     /*
      * if we reuse the continuation, update it
      */
+    ins = insINS(interp, unit, ins, "savetop", regs, 0);
     if (!sub->pcc_sub->nci)
         if (!need_cc)
             ins = insINS(interp, unit, ins, "updatecc", regs, 0);
     /*
      * emit a savetop for now
      */
-    ins = insINS(interp, unit, ins, "savetop", regs, 0);
     ins = insINS(interp, unit, ins, need_cc ? "invokecc" : "invoke", regs, 0);
     ins->type |= ITPCCSUB;
     /*

Reply via email to