summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbjj <bjj>2001-07-31 06:33:22 (GMT)
committerbjj <bjj>2001-07-31 06:33:22 (GMT)
commit4ea54743254c50f4f59748fea4490550fecaadd1 (patch)
treeb27ff78c0c84111561921a349b3af9ff6e883ede
parent38010c6ab68bfd95dcb04952adaca609a9711926 (diff)
downloadmoo-4ea54743254c50f4f59748fea4490550fecaadd1.zip
moo-4ea54743254c50f4f59748fea4490550fecaadd1.tar.gz
moo-4ea54743254c50f4f59748fea4490550fecaadd1.tar.bz2
moo-4ea54743254c50f4f59748fea4490550fecaadd1.tar.xz
Fixed some bugs in the reporting of forked task sizes.
-rw-r--r--tasks.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/tasks.c b/tasks.c
index e08dd10..326aa1c 100644
--- a/tasks.c
+++ b/tasks.c
@@ -792,12 +792,16 @@ enqueue_ft(Program * program, activation a, Var * rt_env,
t->kind = TASK_FORKED;
t->t.forked.program = program;
- /* The next line was not present before 1.8.2. a.rt_env was never
- * accessed and was eventually overwritten by forked.rt_env in
- * do_forked_task(). Makes no sense to store it two places, but here
- * we are. Setting it in the activation simplifies forked_task_bytes()
+ /* The next two lines were not present before 1.8.2. a.rt_env/prog
+ * were never accessed and were eventually overwritten by
+ * forked.rt_env/program in do_forked_task(). Makes no sense to store
+ * it two places, but here we are.
+ * Setting it in the activation simplifies forked_task_bytes()
*/
a.rt_env = rt_env;
+ a.prog = program;
+ a.base_rt_stack = NULL;
+ a.top_rt_stack = NULL;
t->t.forked.a = a;
t->t.forked.rt_env = rt_env;
t->t.forked.f_index = f_index;
@@ -1432,8 +1436,10 @@ activation_bytes(activation *ap)
total += program_bytes(ap->prog);
for (i = 0; i < ap->prog->num_var_names; ++i)
total += value_bytes(ap->rt_env[i]);
- for (v = ap->top_rt_stack - 1; v >= ap->base_rt_stack; v--)
- total += value_bytes(*v);
+ if (ap->top_rt_stack) {
+ for (v = ap->top_rt_stack - 1; v >= ap->base_rt_stack; v--)
+ total += value_bytes(*v);
+ }
/* XXX ignore bi_func_data, it's an opaque type. */
total += value_bytes(ap->temp) - sizeof(Var);
total += strlen(ap->verb) + 1;
@@ -2007,6 +2013,9 @@ char rcsid_tasks[] = "$Id$";
/*
* $Log$
+ * Revision 1.9 2001/07/31 06:33:22 bjj
+ * Fixed some bugs in the reporting of forked task sizes.
+ *
* Revision 1.8 2001/07/27 23:06:20 bjj
* Run through indent, oops.
*