Fixed for next beta.

Since you guys are such avid debuggers (thank goodness!) I will take you through what was going on:

Raul's insertion of {{y}} was inspired.  To see whether special code was implicated, I removed the {{y}} and replaced it with @] .  Since special code is detected from fixed sequences, this would also bypass any special code.  But the failure persisted with @] .

The case I was working on at this point was

(i. 3 3 3)  ([:*/&:>>.&#{.!.1&.>;)&$ i. 2 2   NB. fails
3 3 3  ([:*/&:>>.&#{.!.1&.>;) 2 2  NB. works

What {{y}} would do that @] doesn't is remove the inplaceability flag.  JE aggressively attempts to perform operations in place, and to reuse blocks as early as possible: both to reduce cache footprint.  To do this, JE flags blocks that have not been assigned or boxed so that it can reuse the blocks.  To see whether this was involved, I tested

(>: 2 2 2)  ([:*/&:>>.&#{.!.1&.>;) (>: 1 1)  NB. fails

2 2 was not inplaceable, but (>: 1 1), the result of a verb execution, is.  And this failed, implicating the inplacing support.

With a failure in hand, the problem is quickly cut down to:

(3 3 3) (3: f&.> ;) (>: 1 1)  NB.  fails

(depending on f, this would fail or crash with stack overflow).

At this point I resorted to the debugger, which showed that the result of ; was malformed.  After inspecting the code for (x ; y) I saw the problem.  (f&.>) sets a flag, WILLOPEN, as a promise to (x ; y) that (f&.>) will immediately open the result of (x ; y) and will deal only with contents of the boxes, not the boxes themselves.  This allows (x ; y) to leave virtual blocks in its result.  It also affects the way (x ; y) processes y, and that was the bug: that path neglected to remove the inplaceability of y.  That caused y to be later freed and reallocated while (f&.>) was working on it, with disastrous results.

Thanks for the good report and the aid in debugging.

Henry Rich




On 10/1/2021 5:07 AM, Raul Miller wrote:
I can reproduce this issue.

Furthermore, while trying to understand it, I found a workaround.

    A  ([:*/&:>>.&#{.!.1&.>;)&$B
|domain error

    A  ([:*/&:>>.&#{.!.1&.>;)&{{y}}&$B
6 6

The success of this workaround suggests an issue with special code.

Thanks,



--
This email has been checked for viruses by AVG.
https://www.avg.com

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

Reply via email to