cvsuser 03/01/29 10:34:03
Modified: . MANIFEST core.ops sub.c
Log:
1) coroutine.t (which should be put in t/pmc/) exposes some errors in our
coroutine code.
2) coroutine.patch fixes those errors by saving and restoring more of the
coroutine's context. More specifically the user_stack, control_stack and
pad_stack.
3) document.patch (some of this this was submitted before but not applied)
adds documentation for the push_pad op to core.ops, which I somehow missed.
It also brings pdd06_pasm.pod up to date. I do not like maintaining
documentation in more than one place, so in pdd06_pasm.pod I put a terse
(but correct) description along with a reference to the generated
documentation in docs/core_ops.pod. Is that suitable???
-- Jonathan Sillito [PATCH #20592]
Revision Changes Path
1.307 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.306
retrieving revision 1.307
diff -u -w -r1.306 -r1.307
--- MANIFEST 28 Jan 2003 10:16:29 -0000 1.306
+++ MANIFEST 29 Jan 2003 18:34:02 -0000 1.307
@@ -1743,6 +1743,7 @@
t/op/types.t
t/pmc/array.t
t/pmc/boolean.t
+t/pmc/coroutine.t
t/pmc/eval.t
t/pmc/intlist.t
t/pmc/multiarray.t
1.250 +4 -0 parrot/core.ops
Index: core.ops
===================================================================
RCS file: /cvs/public/parrot/core.ops,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -w -r1.249 -r1.250
--- core.ops 22 Jan 2003 15:56:56 -0000 1.249
+++ core.ops 29 Jan 2003 18:34:02 -0000 1.250
@@ -3863,6 +3863,10 @@
through $2 - 1, inclusive, are copied from the current static
nesting.
+=item B<push_pad>(in PMC)
+
+Push the scratchpad in $1 onto the lexical scope stack.
+
=item B<pop_pad>()
Pop the current lexical scope pad off the stack
1.18 +12 -3 parrot/sub.c
Index: sub.c
===================================================================
RCS file: /cvs/public/parrot/sub.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -w -r1.17 -r1.18
--- sub.c 21 Jan 2003 02:56:27 -0000 1.17
+++ sub.c 29 Jan 2003 18:34:02 -0000 1.18
@@ -1,7 +1,7 @@
/* sub.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: sub.c,v 1.17 2003/01/21 02:56:27 josh Exp $
+ * $Id: sub.c,v 1.18 2003/01/29 18:34:02 sfink Exp $
* Overview:
* Sub-routines, co-routines and other fun stuff...
* Data Structure and Algorithms:
@@ -43,13 +43,20 @@
new_coroutine(struct Parrot_Interp *interp, opcode_t *address)
{
/* Using system memory until I figure out GC issues */
+ PMC * pad = NULL;
struct Parrot_Coroutine *newco =
mem_sys_allocate(sizeof(struct Parrot_Coroutine));
- newco->init = address;
newco->resume = NULL;
newco->ctx.user_stack = new_stack(interp);
newco->ctx.control_stack = new_stack(interp);
- newco->lex_pad = scratchpad_get_current(interp);
+ newco->ctx.pad_stack = new_stack(interp);
+
+ pad = scratchpad_get_current(interp);
+
+ if (pad) {
+ stack_push(interp, &newco->ctx.pad_stack, pad,
+ STACK_ENTRY_PMC, STACK_CLEANUP_NULL);
+ }
return newco;
}
@@ -165,6 +172,8 @@
sizeof(struct Parrot_Lexicals));
if (base) {
+ /* XXX JPS: I guess this is copying the front, when it should
+ be copying the end of the parent (base) */
memcpy(pad_pmc->data, base->data, depth *
sizeof(struct Parrot_Lexicals));
}