diff --git a/src/utils/mut.c b/src/utils/mut.c index 24199a8e..bd6b0859 100644 --- a/src/utils/mut.c +++ b/src/utils/mut.c @@ -99,11 +99,10 @@ B vec_join(B w, B x) { } -NOINLINE JoinFillslice fillslice_getJoin(B w, B x, usz ria) { +NOINLINE JoinFillslice fillslice_getJoin(B w, usz ria) { usz wia = IA(w); assert(TY(w)==t_fillslice); FillSlice* s = c(FillSlice,w); - if (!fillEqualsGetFill(s->fill, x)) goto no; Arr* p = s->p; if (p->refc!=1) goto no; @@ -113,6 +112,7 @@ NOINLINE JoinFillslice fillslice_getJoin(B w, B x, usz ria) { if (PIA(p)!=wia) goto no; usz wsz = mm_sizeUsable((Value*)p); if (!(p->type==t_fillarr? fsizeof(FillArr,a,B,ria)type==t_fillarr) { B* f = &((FillArr*)p)->fill; dec(*f); *f = bi_noFill; } ur sr = PRNK(s); if (sr<=1) { @@ -121,7 +121,6 @@ NOINLINE JoinFillslice fillslice_getJoin(B w, B x, usz ria) { usz* ssh = PSH(s); if (ssh != PSH(p)) arr_shReplace(p, sr, ptr_inc(shObjS(ssh))); } - B w2 = taga(ptr_inc(p)); value_free((Value*)s); return (JoinFillslice){w2, rp}; diff --git a/src/utils/mut.h b/src/utils/mut.h index 05de11c2..edd15527 100644 --- a/src/utils/mut.h +++ b/src/utils/mut.h @@ -153,10 +153,11 @@ SHOULD_INLINE void bit_cpy(u64* r, usz rs, u64* x, usz xs, usz l) { typedef struct { B w2; void* rp; } JoinFillslice; -JoinFillslice fillslice_getJoin(B w, B x, usz ria); // either returns NULL in rp, or consumes w +JoinFillslice fillslice_getJoin(B w, usz ria); // either returns NULL in rp, or consumes w -// if `consume==true`, consumes w,x and expects both args to be vectors -// else, doesn't consume x, and decrements refcount of w iif *reusedW (won't free because the result will be w) +// consume==true: consumes w,x and expects both args to be vectors +// consume==false: doesn't consume x, and decrements refcount of w iif *reusedW (won't free because the result will be w); result has arbitrary but valid shape +// returns possibly incorrect fills if arguments aren't equal class typed arrays FORCE_INLINE B arr_join_inline(B w, B x, bool consume, bool* reusedW) { assert(isArr(w) && isArr(x)); usz wia = IA(w); @@ -177,13 +178,13 @@ FORCE_INLINE B arr_join_inline(B w, B x, bool consume, bool* reusedW) { case t_c16arr: if (TYARR_SZ(C16,ria)=el_c8) goto yes; break; case t_c32arr: if (TYARR_SZ(C32,ria)=el_c8) goto yes; break; case t_fillslice: { - JoinFillslice t = fillslice_getJoin(w, x, ria); + JoinFillslice t = fillslice_getJoin(w, ria); if (t.rp==NULL) goto no; w = t.w2; rp = t.rp; goto yes; } - case t_fillarr: if (fsizeof(FillArr,a,B,ria)fill, x)) goto yes; } break; + case t_fillarr: if (fsizeof(FillArr,a,B,ria)fill); c(FillArr,w)->fill = bi_noFill; goto yes; } break; case t_harr: if (fsizeof(HArr, a,B,ria)