What I take from Roger's post is that we (you) need to rewrite the loops
that contain gc, preferably to the second form I gave.
In other words, replace gc(w,old) with gcexcept(something,w,old)
where gcexcept does ra(something) followed by tpopexcept(old,w)
and
tpopexcept(old,w) is like tpop, except that if it encounters w it
doesn't free it, but instead remembers the fact and then pushes w back
onto the stack after all the pops have been performed.
If you would like a hand on this project, I am between bug fixes now.
Henry
On 5/21/2016 4:59 PM, Roger Hui 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).
If you look at
http://www.jsoftware.com/pipermail/source/2016-May/000723.html there was a
response to Henry' question:
* how J-like sequences, such as (' ' , }. y), are written in the C code
F1(blankfirst){R over(sc(' '),behead(w));}
Now what's being executed in the for loop can be a function such as
blankfirst(). Such functions do not free arrays that are used in doing
their nefarious work, leaving it to the caller to do that. In a for loop,
these arrays can accumulate until you exit the for loop, until you
eventually return to a caller (or caller of a caller) that WOULD do the
freeing. The gc(w,old) was put there to avoid that happening, to avoid
having the stuff accumulating.
This was the original reason why it was done that way. I have no comment
on new better ways consistent with the changes y'all have made, or new
better ways to better exploit the changes.
On Thu, May 19, 2016 at 2:36 AM, Roger Hui <rogerhui.can...@gmail.com>
wrote:
(and question for Roger)
I am heavily engaged at the moment and will not be able to answer for a
few days.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm