Reference counts are not done very well in what you call JE.  That is the
simple and actual reason.  If you know a better way and it pass rigorous
tests then I urge you to proceed.


On Wed, Jul 27, 2016 at 10:33 AM, Henry Rich <henryhr...@gmail.com> wrote:

> The JE spends a lot of time twiddling usecounts and I am trying to
> understand why.
>
> One especially perplexing case is in jtbox(), which handles (<y).  This
> short program does not do PROLOG/EPILOG.  In the case of boxing with
> infinite rank, the code GA()s the result, Performs rat(w) on the input,
> stores w into the result, and returns.
>
> rat(w)???  Why?
>
> rat(w) is   {ra(w); tpush(w)}
>
> But there's no EPILOG.  Adding one to the usecount followed by later
> taking the 1 away at tpop() time isn't going to change when w is freed.
> Why the rat()?
>
> That's my question.
>
> My guess is that AC(w)>1 is used as a flag into the partitioning adverbs.
> Those adverbs seem to check to see whether AC(w) has become > 1, and if so,
> they avoid reusing the same buffer area.  The rat() here means 'the result
> contains a reference to the input & the input must therefore not be reused.'
>
> Acting on that guess, I changed jtbox to use rat1() instead of rat(), with
> rat1() defined to twiddle the top-level usecount only.  All testcases
> passed with this change.
>
> But you don't test programs to correctness, you analyze them to
> correctness.  That's tough with something as large as the JE. Does anyone
> know of a DIFFERENT reason for the use of rat() in these and similar verbs?
>
> Henry
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to