store the current stack top in variable old.
  for(...) {
     add something to boxed array w.
    call gc(w,old), putting w in non-recursive form.
  }

What I was suggesting is:

   store the current stack top in variable old.
   ra(w);
   for(...) {
     add something to boxed array w.
     ra(something);  // putting something in non-recursive form.
     tpop(old);
  }
   tpush(w);

Now I suggest

   store the current stack top in variable old.
   for(...) {
     add something to boxed array w.
     ra(something);  // putting something in non-recursive form?
     tpopnotw(old,w);
  }

Where tpopnotw is like tpop but simply ignores stack entries that match w.

If this idea is sound, I think you might as well do it, because

* you will have to inspect each place gc() is used anyway
* assuming that the current code is there because the free was needed,
   this preserves that behavior.  It will be hard to be confident that
   this is not needed (you'd have to deploy and wait for user complaints -
   I wouldn't want to take that chance)
* No usecount will be modified or block freed that doesn't need to be
* it is necessary to increment the usecount of (something)

Henry










On 5/20/2016 10:06 AM, Marshall Lochbaum wrote:
> >A number of spots in the J source follow this pattern, or similar:
> >   store the current stack top in variable old.
> >   for(...) {
> >     add something to boxed array w.
> >     call gc(w,old), putting w in non-recursive form.
> >   }
> >
> >(A particular example is cp.c, lines 91--97, which performs (v^:l x)
> >where l is an integer list).

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to