You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// normal case where we are creating the result box. Must incorp the result. Can't see an advantage is storing the virtual temporarily, and that would require testing for UNINCORP block
261
261
realizeifvirtual(z); razaptstackend(z); // Since we are moving the result into a recursive box, we must ra() it. This plus rifv plus pristine flagging (above) =INCORPRA. We trouble to see if we can shorten tstack, since that is likely
262
262
*zzboxp=z; // install the new box. zzboxp is ALWAYS a pointer to a box when force-boxed result
263
-
}else{
263
+
}else{
264
264
// The result of this verb will be opened next, so we can take some liberties with it. We don't need to realize any virtual block EXCEPT one that we might
265
265
// be reusing in this loop. The user flags those UNINCORPABLE. Rather than realize it we just make a virtual clone, since realizing might be expensive.
266
266
// That is, if z is one of the virtual blocks we use to track subarrays, we mustn't incorporate it, so we clone it. These subarrays can be inputs to functions
@@ -273,21 +273,20 @@ do{
273
273
// box code all over assumes that contents are never inplaceable, and since we go through here only when we are going through box code next, we honor that
274
274
ACIPNO(z); *zzboxp=z; // install the new box. zzboxp is ALWAYS a pointer to a box when force-boxed result
275
275
if(unlikely((ZZFLAGWORD&ZZFLAGCOUNTITEMS)!=0)){
276
-
// if the result will be razed next, we will count the items and store that in AM. We will also ensure that the result boxes' contents have the same type
276
+
// the result will be razed next. We will count the items and store that in AM. We will also ensure that the result boxes' contents have the same type
277
277
// and item-shape. If one does not, we turn off special raze processing. It is safe to take over the AM field in this case, because we know this is WILLBEOPENED and
278
278
// (1) will never assemble or epilog; (2) will feed directly into a verb that will discard it without doing any usecount modification
279
-
Idiff; // Will be set to 0 if we are unable to report the # items
279
+
Idiff; // Will be set to non0 if we are unable to report the # items
280
280
#ifPYXES
281
281
// If the returned result is a pyx, we can't look into it to get its type/len. We could see if the pyx has been resolved, but we don't
282
-
if(unlikely(diff=(AT(z)&PYX))){ZZFLAGWORD&=~ZZFLAGCOUNTITEMS; // if the result is a pyx, which can't be inspected, skip it, which makes the item count invalid
283
-
}else{
284
-
#else
285
-
{
282
+
if(likely((diff=(AT(z)&PYX))==0)) // if the result is a pyx, which can't be inspected, set diff to non0 (which makes the item count invalid) and skip the shape test
286
283
#endif
284
+
{ // this brace may be part of the previous line!
285
+
// not a pyx - we can count the items
287
286
#if !ZZSTARTATEND// going forwards
288
-
Aresult0=AAV(zz)[0]; // fetch pointer to the first
287
+
Aresult0=AAV(zz)[0]; // fetch pointer to the first
289
288
#else
290
-
Aresult0=AAV(zz)[AN(zz)-1]; // fetch pointer to first value stored, which is in the last position
289
+
Aresult0=AAV(zz)[AN(zz)-1]; // fetch pointer to first value stored, which is in the last position
291
290
#endif
292
291
// see if the items of the new match the old, and increment the number of items
293
292
I*zs=AS(z); I*ress=AS(result0); Izr=AR(z); Iresr=AR(result0); //fetch info
@@ -296,7 +295,7 @@ do{
296
295
Initems=zs[0]; nitems=(zr==0)?1:nitems; zzcounteditems+=nitems; // add new items to count in zz. zs[0] will never segfault, even if z is empty
297
296
#endif
298
297
}
299
-
ZZFLAGWORD^=(diff!=0)<<ZZFLAGCOUNTITEMSX; // turn off bit if we can't say the items are homogeneous
298
+
ZZFLAGWORD^=(diff!=0)<<ZZFLAGCOUNTITEMSX; // turn off bit (which must be set now) if we can't say the items are homogeneous
300
299
}
301
300
// Note: by checking COUNTITEMS inside WILLBEOPENED we suppress support for COUNTITEMS in \. which sets WILLBEOPENEDNEVER. It would be safe to
302
301
// count then, because no virtual contents would be allowed. But we are not sure that the EPILOG is safe, and this path is now off to the side
@@ -316,8 +315,9 @@ do{
316
315
// Processing the first cell. Allocate the result area now that we know the shape/type of the result.
317
316
// Get the rank/type to allocate for the presumed result
0 commit comments