more incG

This commit is contained in:
dzaima 2022-06-26 23:48:30 +03:00
parent 59f0aaa732
commit fadde40f78
17 changed files with 89 additions and 88 deletions

View File

@ -132,22 +132,22 @@ B listVariations_c2(B t, B w, B x) {
}
noSpec:;
B r = emptyHVec();
if(abit) { r=vec_addN(r,inc(v_Ab )); if(c_incr) { r=vec_addN(r,inc(v_AbInc )); } }
if(ai8 ) { r=vec_addN(r,inc(v_Ai8 ));r=vec_addN(r,inc(v_Si8 )); if(c_incr) { r=vec_addN(r,inc(v_Ai8Inc ));r=vec_addN(r,inc(v_Si8Inc )); } }
if(ai16) { r=vec_addN(r,inc(v_Ai16));r=vec_addN(r,inc(v_Si16)); if(c_incr) { r=vec_addN(r,inc(v_Ai16Inc));r=vec_addN(r,inc(v_Si16Inc)); } }
if(ai32) { r=vec_addN(r,inc(v_Ai32));r=vec_addN(r,inc(v_Si32)); if(c_incr) { r=vec_addN(r,inc(v_Ai32Inc));r=vec_addN(r,inc(v_Si32Inc)); } }
if(ac8 ) { r=vec_addN(r,inc(v_Ac8 ));r=vec_addN(r,inc(v_Sc8 )); if(c_incr) { r=vec_addN(r,inc(v_Ac8Inc ));r=vec_addN(r,inc(v_Sc8Inc )); } }
if(ac16) { r=vec_addN(r,inc(v_Ac16));r=vec_addN(r,inc(v_Sc16)); if(c_incr) { r=vec_addN(r,inc(v_Ac16Inc));r=vec_addN(r,inc(v_Sc16Inc)); } }
if(ac32) { r=vec_addN(r,inc(v_Ac32));r=vec_addN(r,inc(v_Sc32)); if(c_incr) { r=vec_addN(r,inc(v_Ac32Inc));r=vec_addN(r,inc(v_Sc32Inc)); } }
if(af64) { r=vec_addN(r,inc(v_Af64));r=vec_addN(r,inc(v_Sf64)); if(c_incr) { r=vec_addN(r,inc(v_Af64Inc));r=vec_addN(r,inc(v_Sf64Inc)); } }
if(ah) { r=vec_addN(r,inc(v_Ah ));r=vec_addN(r,inc(v_Sh )); if(c_incr) { r=vec_addN(r,inc(v_AhInc ));r=vec_addN(r,inc(v_ShInc )); } }
{ r=vec_addN(r,inc(v_Af ));r=vec_addN(r,inc(v_Sf )); if(c_incr) { r=vec_addN(r,inc(v_AfInc ));r=vec_addN(r,inc(v_SfInc )); } }
if(abit) { r=vec_addN(r,incG(v_Ab )); if(c_incr) { r=vec_addN(r,incG(v_AbInc )); } }
if(ai8 ) { r=vec_addN(r,incG(v_Ai8 ));r=vec_addN(r,incG(v_Si8 )); if(c_incr) { r=vec_addN(r,incG(v_Ai8Inc ));r=vec_addN(r,incG(v_Si8Inc )); } }
if(ai16) { r=vec_addN(r,incG(v_Ai16));r=vec_addN(r,incG(v_Si16)); if(c_incr) { r=vec_addN(r,incG(v_Ai16Inc));r=vec_addN(r,incG(v_Si16Inc)); } }
if(ai32) { r=vec_addN(r,incG(v_Ai32));r=vec_addN(r,incG(v_Si32)); if(c_incr) { r=vec_addN(r,incG(v_Ai32Inc));r=vec_addN(r,incG(v_Si32Inc)); } }
if(ac8 ) { r=vec_addN(r,incG(v_Ac8 ));r=vec_addN(r,incG(v_Sc8 )); if(c_incr) { r=vec_addN(r,incG(v_Ac8Inc ));r=vec_addN(r,incG(v_Sc8Inc )); } }
if(ac16) { r=vec_addN(r,incG(v_Ac16));r=vec_addN(r,incG(v_Sc16)); if(c_incr) { r=vec_addN(r,incG(v_Ac16Inc));r=vec_addN(r,incG(v_Sc16Inc)); } }
if(ac32) { r=vec_addN(r,incG(v_Ac32));r=vec_addN(r,incG(v_Sc32)); if(c_incr) { r=vec_addN(r,incG(v_Ac32Inc));r=vec_addN(r,incG(v_Sc32Inc)); } }
if(af64) { r=vec_addN(r,incG(v_Af64));r=vec_addN(r,incG(v_Sf64)); if(c_incr) { r=vec_addN(r,incG(v_Af64Inc));r=vec_addN(r,incG(v_Sf64Inc)); } }
if(ah) { r=vec_addN(r,incG(v_Ah ));r=vec_addN(r,incG(v_Sh )); if(c_incr) { r=vec_addN(r,incG(v_AhInc ));r=vec_addN(r,incG(v_ShInc )); } }
{ r=vec_addN(r,incG(v_Af ));r=vec_addN(r,incG(v_Sf )); if(c_incr) { r=vec_addN(r,incG(v_AfInc ));r=vec_addN(r,incG(v_SfInc )); } }
decG(x);
dec(xf);
return r;
}
B listVariations_c1(B t, B x) {
return listVariations_c2(t, inc(listVariations_def), x);
return listVariations_c2(t, incG(listVariations_def), x);
}
static bool u8_get(u8** cv, u8* cE, const char* x) {
u8* c = *cv;
@ -183,15 +183,15 @@ B variation_c2(B t, B w, B x) {
if (*wp == 'A' || *wp == 'S') {
bool slice = *wp == 'S';
wp++;
if (u8_get(&wp, wpE, "b" )) res = taga(cpyBitArr(inc(x)));
else if (u8_get(&wp, wpE, "i8" )) res = taga(cpyI8Arr(inc(x)));
else if (u8_get(&wp, wpE, "i16")) res = taga(cpyI16Arr(inc(x)));
else if (u8_get(&wp, wpE, "i32")) res = taga(cpyI32Arr(inc(x)));
else if (u8_get(&wp, wpE, "c8" )) res = taga(cpyC8Arr(inc(x)));
else if (u8_get(&wp, wpE, "c16")) res = taga(cpyC16Arr(inc(x)));
else if (u8_get(&wp, wpE, "c32")) res = taga(cpyC32Arr(inc(x)));
else if (u8_get(&wp, wpE, "f64")) res = taga(cpyF64Arr(inc(x)));
else if (u8_get(&wp, wpE, "h" )) res = taga(cpyHArr(inc(x)));
if (u8_get(&wp, wpE, "b" )) res = taga(cpyBitArr(incG(x)));
else if (u8_get(&wp, wpE, "i8" )) res = taga(cpyI8Arr (incG(x)));
else if (u8_get(&wp, wpE, "i16")) res = taga(cpyI16Arr(incG(x)));
else if (u8_get(&wp, wpE, "i32")) res = taga(cpyI32Arr(incG(x)));
else if (u8_get(&wp, wpE, "c8" )) res = taga(cpyC8Arr (incG(x)));
else if (u8_get(&wp, wpE, "c16")) res = taga(cpyC16Arr(incG(x)));
else if (u8_get(&wp, wpE, "c32")) res = taga(cpyC32Arr(incG(x)));
else if (u8_get(&wp, wpE, "f64")) res = taga(cpyF64Arr(incG(x)));
else if (u8_get(&wp, wpE, "h" )) res = taga(cpyHArr (incG(x)));
else if (u8_get(&wp, wpE, "f")) {
Arr* t = m_fillarrp(xia);
fillarr_setFill(t, getFillQ(x));
@ -200,7 +200,7 @@ B variation_c2(B t, B w, B x) {
B* xp = arr_bptr(x);
if (xp==NULL) {
h = cpyHArr(inc(x));
h = cpyHArr(incG(x));
xp = h->a;
}
@ -221,7 +221,7 @@ B variation_c2(B t, B w, B x) {
if (!variation_refs.u) {
variation_refs = emptyHVec();
}
variation_refs = vec_addN(variation_refs, inc(res));
variation_refs = vec_addN(variation_refs, incG(res));
}
if (wp!=wpE) thrM("•internal.Variation: Bad 𝕨");
} else thrM("•internal.Variation: Bad start of 𝕨");
@ -305,11 +305,11 @@ B getInternalNS() {
#undef F
listVariations_def = m_ascii0("if");
gc_addFn(variation_gcRoot);
#define F(X) inc(bi_##X),
#define F(X) incG(bi_##X),
Body* d = m_nnsDesc("type","eltype","refc","squeeze","ispure","info","listvariations","variation","clearrefs","unshare","deepsqueeze","heapdump","eequal","temp");
internalNS = m_nns(d,F(itype)F(elType)F(refc)F(squeeze)F(isPure)F(info)F(listVariations)F(variation)F(clearRefs)F(unshare)F(deepSqueeze)F(heapDump)F(eequal)F(internalTemp));
#undef F
gc_add(internalNS);
}
return inc(internalNS);
return incG(internalNS);
}

View File

@ -26,8 +26,8 @@ B undo_c2(Md1D* d, B w, B x) { B f = d->f;
return r;
}
B setInvReg_c1 (B t, B x) { rt_invFnReg = x; rt_invFnRegFn = c(Fun,x)->c1; return inc(bi_nativeInvReg); }
B setInvSwap_c1(B t, B x) { rt_invFnSwap = x; rt_invFnSwapFn = c(Fun,x)->c1; return inc(bi_nativeInvSwap); }
B setInvReg_c1 (B t, B x) { rt_invFnReg = x; rt_invFnRegFn = c(Fun,x)->c1; return incG(bi_nativeInvReg); }
B setInvSwap_c1(B t, B x) { rt_invFnSwap = x; rt_invFnSwapFn = c(Fun,x)->c1; return incG(bi_nativeInvSwap); }
B nativeInvReg_c1(B t, B x) {
if (isFun(x)) return m_nfn(fn_invRegDesc, x);
return c1(rt_invFnReg, x);

View File

@ -62,12 +62,12 @@ B tbl_c2(Md1D* d, B w, B x) { B f = d->f;
if (!EACH_FILLS && isFun(f) && isPervasiveDy(f) && TI(w,arrD1)) {
BBB2B fc2 = c(Fun,f)->c2;
if (TI(x,arrD1) && xia<80 && wia>130) {
Arr* wd = arr_shVec(TI(w,slice)(inc(w), 0, wia));
r = fc2(f, slash_c2(f, m_i32(xia), taga(wd)), shape_c2(f, m_f64(ria), inc(x)));
Arr* wd = arr_shVec(TI(w,slice)(incG(w), 0, wia));
r = fc2(f, slash_c2(f, m_i32(xia), taga(wd)), shape_c2(f, m_f64(ria), incG(x)));
} else {
SGet(w)
M_HARR(r, wia)
for (usz wi = 0; wi < wia; wi++) HARR_ADD(r, wi, fc2(f, Get(w,wi), inc(x)));
for (usz wi = 0; wi < wia; wi++) HARR_ADD(r, wi, fc2(f, Get(w,wi), incG(x)));
r = bqn_merge(HARR_FV(r));
}
if (rnk(r)>1) {
@ -404,7 +404,7 @@ static B m1c2(B t, B f, B w, B x) { // consumes w,x
} \
} else if (X##_cr!=0) X##_csz*= a(X)->sh[1];
#define SLICE(X, S) ({ Arr* r_ = X##_slc(inc(X), S, X##_csz); arr_shSetI(r_, X##_cr, X##_csh); taga(r_); })
#define SLICE(X, S) ({ Arr* r_ = X##_slc(incG(X), S, X##_csz); arr_shSetI(r_, X##_cr, X##_csh); taga(r_); })
#define E_SLICES(X) if (X##_cr>1) ptr_dec(X##_csh); decG(X);

View File

@ -17,7 +17,7 @@ B select_c1(B t, B x) {
if (xr==0) thrM("⊏: Argument cannot be rank 0");
if (a(x)->sh[0]==0) thrF("⊏: Argument shape cannot start with 0 (%H ≡ ≢𝕩)", x);
usz ia = shProd(a(x)->sh, 1, xr);
Arr* r = TI(x,slice)(inc(x), 0, ia);
Arr* r = TI(x,slice)(incG(x), 0, ia);
usz* sh = arr_shAlloc(r, xr-1);
if (sh) shcpy(sh, a(x)->sh+1, xr-1);
decG(x);

View File

@ -61,9 +61,9 @@ FORCE_INLINE B m_vec2Base(B a, B b, bool fills) {
}
if (fills) {
if (isAtm(a) || isAtm(b)) goto noFills;
B af = asFill(inc(a));
B af = asFill(incG(a));
if (noFill(af)) goto noFills;
B bf = asFill(inc(b));
B bf = asFill(incG(b));
if (noFill(bf)) { dec(af); goto noFills; }
if (!fillEqual(af,bf)) { dec(bf); dec(af); goto noFills; }
dec(bf);
@ -701,7 +701,7 @@ FORCE_INLINE B affixes(B x, i32 post) {
}
dec(x);
}
B rf = inc(HARR_O(r).a[post? cam : 0]);
B rf = incG(HARR_O(r).a[post? cam : 0]);
return withFill(HARR_FV(r), rf);
}
@ -1304,7 +1304,7 @@ static B takedrop_ucw(i64 wi, B o, u64 am, B x, size_t xr) {
usz tk = csz*am; // taken element count
usz lv = xia-tk; // elements left alone
Arr* arg = TI(x,slice)(inc(x), wi<0? lv : 0, tk);
Arr* arg = TI(x,slice)(incG(x), wi<0? lv : 0, tk);
usz* ash = arr_shAlloc(arg, xr);
if (ash) { ash[0] = am; shcpy(ash+1, a(x)->sh+1, xr-1); }

View File

@ -507,7 +507,7 @@ B makeRand_c1(B t, B x) {
if (rand_ns==NULL) rand_init();
B r = m_nns(rand_ns, b(x.u>>32), b(x.u&0xFFFFFFFF), m_nfn(rand_rangeDesc, bi_N), m_nfn(rand_dealDesc, bi_N), m_nfn(rand_subsetDesc, bi_N));
Scope* sc = c(NS,r)->sc;
for (i32 i = 2; i < 5; i++) nfn_swapObj(sc->vars[i], inc(r));
for (i32 i = 2; i < 5; i++) nfn_swapObj(sc->vars[i], incG(r));
return r;
}
static B randNS;
@ -582,7 +582,7 @@ B fchars_c1(B d, B x) {
B fchars_c2(B d, B w, B x) {
if (!isArr(x)) thrM("•FChars: Non-array 𝕩");
B p = path_rel(nfn_objU(d), w);
path_wChars(inc(p), x);
path_wChars(incG(p), x);
dec(x);
return p;
}
@ -598,7 +598,7 @@ B fbytes_c1(B d, B x) {
B fbytes_c2(B d, B w, B x) {
if (!isArr(x)) thrM("•FBytes: Non-array 𝕩");
B p = path_rel(nfn_objU(d), w);
path_wBytes(inc(p), x);
path_wBytes(incG(p), x);
dec(x);
return p;
}
@ -620,7 +620,7 @@ B flines_c2(B d, B w, B x) {
}
dec(x);
B p = path_rel(nfn_objU(d), w);
path_wChars(inc(p), s);
path_wChars(incG(p), s);
decG(s);
return p;
}
@ -662,7 +662,7 @@ B import_c1(B d, B x) {
importKeyList = vec_addN(importKeyList, path);
importValList = vec_addN(importValList, bi_N);
B r = bqn_execFile(inc(path), emptySVec());
B r = bqn_execFile(incG(path), emptySVec());
harr_ptr(importValList)[prevLen] = inc(r);
setPrevImport(path, prevLen);
@ -894,8 +894,8 @@ B sh_c2(B t, B w, B x) {
while (poll(&ps[0], plen - iDone, -1) > 0) {
shDbg("next poll; revents: out:%d err:%d in:%d\n", ps[0].revents, ps[1].revents, ps[2].revents);
bool any = false;
if (ps[out_i].revents & POLLIN) while(true) { i64 len = read(p_out[0], &oBuf[0], bufsz); shDbg("read stdout "N64d"\n",len); if(len<=0) break; else any=true; *oBufIA = len; s_out = vec_join(s_out, inc(oBufObj)); }
if (ps[err_i].revents & POLLIN) while(true) { i64 len = read(p_err[0], &oBuf[0], bufsz); shDbg("read stderr "N64d"\n",len); if(len<=0) break; else any=true; *oBufIA = len; s_err = vec_join(s_err, inc(oBufObj)); }
if (ps[out_i].revents & POLLIN) while(true) { i64 len = read(p_out[0], &oBuf[0], bufsz); shDbg("read stdout "N64d"\n",len); if(len<=0) break; else any=true; *oBufIA = len; s_out = vec_join(s_out, incG(oBufObj)); }
if (ps[err_i].revents & POLLIN) while(true) { i64 len = read(p_err[0], &oBuf[0], bufsz); shDbg("read stderr "N64d"\n",len); if(len<=0) break; else any=true; *oBufIA = len; s_err = vec_join(s_err, incG(oBufObj)); }
if (!iDone && ps[in_i].revents & POLLOUT) {
shDbg("writing "N64u"\n", iLen-iOff);
ssize_t ww = write(p_in[1], iBuf+iOff, iLen-iOff);
@ -986,13 +986,13 @@ B tErrRaw_c1(B t, B x) {
static B termNS;
B getTermNS() {
if (termNS.u == 0) {
#define F(X) inc(bi_##X),
#define F(X) incG(bi_##X),
Body* d = m_nnsDesc("flush", "rawmode", "charb", "charn", "outraw", "errraw");
termNS = m_nns(d,F(tFlush)F(tRawMode)F(tCharB)F(tCharN)F(tOutRaw)F(tErrRaw));
#undef F
gc_add(termNS);
}
return inc(termNS);
return incG(termNS);
}
@ -1106,13 +1106,13 @@ B bitcast_im(Md1D* d, B x) { B f = d->f;
static B bitNS;
B getBitNS() {
if (bitNS.u == 0) {
#define F(X) inc(bi_bit##X),
#define F(X) incG(bi_bit##X),
Body* d = m_nnsDesc("cast");
bitNS = m_nns(d, F(cast));
#undef F
gc_add(bitNS);
}
return inc(bitNS);
return incG(bitNS);
}
B getInternalNS(void);
@ -1147,7 +1147,7 @@ B sys_c1(B t, B x) {
fileNS = m_nns(file_nsGen, q_N(path)? m_c32(0) : inc(path), F(fileAt), F(fList), F(fBytes), F(fChars), F(fLines), F(fType), F(fExists), inc(bi_fName), F(fMapBytes), F(createdir), F(rename), F(remove));
#undef F
}
cr = inc(fileNS);
cr = incG(fileNS);
}
else if (eqStr(c, U"wdpath")) {
if (!wdpath.u) wdpath = path_abs(inc(cdPath));

View File

@ -12,7 +12,7 @@ B toCells(B x) {
usz p = 0;
if (rnk(x)==2) {
for (usz i = 0; i < cam; i++) {
HARR_ADD(r, i, taga(arr_shVec(slice(inc(x), p, csz))));
HARR_ADD(r, i, taga(arr_shVec(slice(incG(x), p, csz))));
p+= csz;
}
} else {
@ -21,7 +21,7 @@ B toCells(B x) {
usz* xsh = a(x)->sh;
shcpy(csh->a, xsh+1, cr);
for (usz i = 0; i < cam; i++) {
Arr* s = slice(inc(x), p, csz); arr_shSetI(s, cr, csh);
Arr* s = slice(incG(x), p, csz); arr_shSetI(s, cr, csh);
HARR_ADD(r, i, taga(s));
p+= csz;
}
@ -47,7 +47,7 @@ B toKCells(B x, ur k) {
M_HARR(r, cam);
usz p = 0;
for (usz i = 0; i < cam; i++) {
Arr* s = slice(inc(x), p, csz); arr_shSetI(s, cr, csh);
Arr* s = slice(incG(x), p, csz); arr_shSetI(s, cr, csh);
HARR_ADD(r, i, taga(s));
p+= csz;
}

View File

@ -59,7 +59,7 @@ static B rtUnder_c1(B f, B g, B x) { // consumes x
return r;
}
static B rtUnder_cw(B f, B g, B w, B x) { // consumes w,x
B fn = m2_d(incG(rt_under), inc(f), m2_d(inc(bi_before), w, inc(g)));
B fn = m2_d(incG(rt_under), inc(f), m2_d(incG(bi_before), w, inc(g)));
B r = c1(fn, x);
decG(fn);
return r;

View File

@ -67,13 +67,13 @@ BQNV bqn_pick(BQNV a, size_t pos) {
}
// TODO copy directly with some mut.h thing
void bqn_readI8Arr (BQNV a, i8* buf) { B c = toI8Any (inc(getB(a))); memcpy(buf, i8any_ptr (c), a(c)->ia * 1); dec(c); }
void bqn_readI16Arr(BQNV a, i16* buf) { B c = toI16Any(inc(getB(a))); memcpy(buf, i16any_ptr(c), a(c)->ia * 2); dec(c); }
void bqn_readI32Arr(BQNV a, i32* buf) { B c = toI32Any(inc(getB(a))); memcpy(buf, i32any_ptr(c), a(c)->ia * 4); dec(c); }
void bqn_readF64Arr(BQNV a, f64* buf) { B c = toF64Any(inc(getB(a))); memcpy(buf, f64any_ptr(c), a(c)->ia * 8); dec(c); }
void bqn_readC8Arr (BQNV a, u8* buf) { B c = toC8Any (inc(getB(a))); memcpy(buf, c8any_ptr (c), a(c)->ia * 1); dec(c); }
void bqn_readC16Arr(BQNV a, u16* buf) { B c = toC16Any(inc(getB(a))); memcpy(buf, c16any_ptr(c), a(c)->ia * 2); dec(c); }
void bqn_readC32Arr(BQNV a, u32* buf) { B c = toC32Any(inc(getB(a))); memcpy(buf, c32any_ptr(c), a(c)->ia * 4); dec(c); }
void bqn_readI8Arr (BQNV a, i8* buf) { B c = toI8Any (incG(getB(a))); memcpy(buf, i8any_ptr (c), a(c)->ia * 1); dec(c); }
void bqn_readI16Arr(BQNV a, i16* buf) { B c = toI16Any(incG(getB(a))); memcpy(buf, i16any_ptr(c), a(c)->ia * 2); dec(c); }
void bqn_readI32Arr(BQNV a, i32* buf) { B c = toI32Any(incG(getB(a))); memcpy(buf, i32any_ptr(c), a(c)->ia * 4); dec(c); }
void bqn_readF64Arr(BQNV a, f64* buf) { B c = toF64Any(incG(getB(a))); memcpy(buf, f64any_ptr(c), a(c)->ia * 8); dec(c); }
void bqn_readC8Arr (BQNV a, u8* buf) { B c = toC8Any (incG(getB(a))); memcpy(buf, c8any_ptr (c), a(c)->ia * 1); dec(c); }
void bqn_readC16Arr(BQNV a, u16* buf) { B c = toC16Any(incG(getB(a))); memcpy(buf, c16any_ptr(c), a(c)->ia * 2); dec(c); }
void bqn_readC32Arr(BQNV a, u32* buf) { B c = toC32Any(incG(getB(a))); memcpy(buf, c32any_ptr(c), a(c)->ia * 4); dec(c); }
void bqn_readObjArr(BQNV a, BQNV* buf) { B b = getB(a);
usz ia = a(b)->ia;
B* p = arr_bptr(b);

View File

@ -571,6 +571,7 @@ static inline void decG(B x) {
if(!--vx->refc) value_free(vx);
}
static inline B incG(B x) { // inc for guaranteed heap-allocated objects
assert(isVal(x));
v(VALIDATE(x))->refc++;
return x;
}

View File

@ -216,7 +216,7 @@ void cbqn_runLine0(char* ln, i64 read) {
code = utf8Decode0(ln);
output = 1;
}
Block* block = bqn_compSc(code, inc(replPath), emptySVec(), gsc, true);
Block* block = bqn_compSc(code, incG(replPath), emptySVec(), gsc, true);
ptr_dec(gsc->body);
gsc->body = ptr_inc(block->bodies[0]);
@ -376,7 +376,7 @@ int main(int argc, char* argv[]) {
usz ia = a(lines)->ia;
SGet(lines)
for (u64 i = 0; i < ia; i++) {
dec(gsc_exec_inline(Get(lines, i), inc(replPath), emptySVec()));
dec(gsc_exec_inline(Get(lines, i), incG(replPath), emptySVec()));
}
break;
}

View File

@ -25,7 +25,7 @@ B m_nfn(NFnDesc* desc, B obj) {
return tag(r,FUN_TAG);
}
B nfn_name(B x) { VTY(x, t_nfn);
return inc(c(NFnDesc,IGetU(nfn_list,c(NFn,x)->id))->name);
return incG(c(NFnDesc,IGetU(nfn_list,c(NFn,x)->id))->name);
}
DEF_FREE(nfn) { dec(((NFn*)x)->obj); }

View File

@ -135,7 +135,7 @@ B wm1_c1(Md1D* d, B x) { B f = d->f; WMd1* t = (WMd1*)d->m1;
u64 s = nsTime();
#endif
B om = t->v;
B fn = m1_d(inc(om), inc(f));
B fn = m1_d(incG(om), inc(f));
B r = c1(fn, x);
dec(fn);
#if RT_PERF
@ -152,7 +152,7 @@ B wm1_c2(Md1D* d, B w, B x) { B f = d->f; WMd1* t = (WMd1*)d->m1;
u64 s = nsTime();
#endif
B om = t->v;
B fn = m1_d(inc(om), inc(f));
B fn = m1_d(incG(om), inc(f));
B r = c2(fn, w, x);
dec(fn);
#if RT_PERF
@ -170,7 +170,7 @@ B wm2_c1(Md2D* d, B x) { B f = d->f; B g = d->g; WMd2* t = (WMd2*)d->m2;
u64 s = nsTime();
#endif
B om = t->v;
B fn = m2_d(inc(om), inc(f), inc(g));
B fn = m2_d(incG(om), inc(f), inc(g));
B r = c1(fn, x);
dec(fn);
#if RT_PERF
@ -187,7 +187,7 @@ B wm2_c2(Md2D* d, B w, B x) { B f = d->f; B g = d->g; WMd2* t = (WMd2*)d->m2;
u64 s = nsTime();
#endif
B om = t->v;
B fn = m2_d(inc(om), inc(f), inc(g));
B fn = m2_d(incG(om), inc(f), inc(g));
B r = c2(fn, w, x);
dec(fn);
#if RT_PERF

View File

@ -75,7 +75,7 @@ B eachm_fn(BB2B f, B fo, B x) { // TODO definitely rewrite this. Probably still
} else if (TI(x,elType)==el_i32) {
i32* xp = i32any_ptr(x);
B r; i32* rp;
if (reuse && v(x)->type==t_i32arr) { r=inc(REUSE(x)); rp = xp; }
if (reuse && v(x)->type==t_i32arr) { r=incG(REUSE(x)); rp = xp; }
else r = m_i32arrc(&rp, x);
rp[i++] = o2iu(cr);
for (; i < ia; i++) {
@ -93,7 +93,7 @@ B eachm_fn(BB2B f, B fo, B x) { // TODO definitely rewrite this. Probably still
} else if (TI(x,elType)==el_f64) {
f64* xp = f64any_ptr(x);
B r; f64* rp;
if (reuse && v(x)->type==t_f64arr) { r=inc(REUSE(x)); rp = xp; }
if (reuse && v(x)->type==t_f64arr) { r=incG(REUSE(x)); rp = xp; }
else r = m_f64arrc(&rp, x);
rp[i++] = o2fu(cr);
for (; i < ia; i++) {

View File

@ -103,7 +103,7 @@ B path_rel(B base, B rel) { // consumes rel; assumes base is a char vector or bi
guaranteeStr(rel);
if (ria>0 && o2cu(GetU(rel, 0))=='/') return rel;
if (q_N(base)) thrM("Using relative path with no absolute base path known");
if (ria==0) { dec(rel); return inc(base); }
if (ria==0) { dec(rel); return incG(base); }
SGetU(base)
usz bia = a(base)->ia;
bool has = bia && o2cu(GetU(base, bia-1))=='/';

View File

@ -5,7 +5,7 @@
NOINLINE u64 bqn_hashArr(B x, const u64 secret[4]) { // TODO manual separation of atom & arr probably won't be worth it when there are actually sane typed array hashing things
usz xia = a(x)->ia;
if (xia==0) return ~secret[3]; // otherwise squeeze will care about fills
x = any_squeeze(inc(x));
x = any_squeeze(incG(x));
u8 xr = rnk(x);
u8 xe = TI(x,elType);
u64 shHash;

View File

@ -97,12 +97,12 @@ B listVars(Scope* sc) {
i32* varData = b->varData; usz bam = b->varAm;
for (u64 i = 0; i < am0; i++) {
i32 nameID = varData[i + bam];
r = vec_addN(r, inc(GetU(nameList, nameID)));
r = vec_addN(r, incG(GetU(nameList, nameID)));
}
}
if (sc->ext) {
ScopeExt* scExt = sc->ext; usz am = scExt->varAm; B* vars = scExt->vars;
for (u64 i = 0; i < am; i++) r = vec_addN(r, inc(vars[i+am]));
for (u64 i = 0; i < am; i++) r = vec_addN(r, incG(vars[i+am]));
}
return r;
}
@ -452,7 +452,7 @@ NOINLINE Block* compile(B bcq, B objs, B allBlocks, B allBodies, B indices, B to
comp->path = path;
B nameList;
if (q_N(tokenInfo)) {
nameList = inc(bi_emptyHVec);
nameList = emptyHVec();
} else {
B t = IGetU(tokenInfo,2);
nameList = IGet(t,0);
@ -507,7 +507,7 @@ FORCE_INLINE bool v_merge(Scope* pscs[], B s, B x, bool upd, bool hdr) {
dec(cx);
}
} else {
B cells = toCells(inc(x));
B cells = toCells(incG(x));
B* xp = harr_ptr(cells);
for (usz i = 0; i < oia; i++) {
if (!hdr) v_set (pscs, op[i], xp[i], upd, true);
@ -981,12 +981,12 @@ FORCE_INLINE B execBlock(Block* block, Body* body, Scope* psc, i32 ga, B* svar)
return r;
}
B funBl_c1(B t, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->bodies[0], b->sc, 3, (B[]){t, x, bi_N }); }
B funBl_c2(B t, B w, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->dyBody, b->sc, 3, (B[]){t, x, w }); }
B md1Bl_c1(Md1D* d, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->bodies[0], b->sc, 5, (B[]){tag(d,FUN_TAG), x, bi_N, inc(tag(d->m1,MD1_TAG)), inc(d->f) }); }
B md1Bl_c2(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->dyBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m1,MD1_TAG)), inc(d->f) }); }
B md2Bl_c1(Md2D* d, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->bodies[0], b->sc, 6, (B[]){tag(d,FUN_TAG), x, bi_N, inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); }
B md2Bl_c2(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->dyBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); }
B funBl_c1(B t, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->bodies[0], b->sc, 3, (B[]){t, x, bi_N }); }
B funBl_c2(B t, B w, B x) { FunBlock* b=c(FunBlock, t); ptr_inc(b); return execBlock(b->bl, b->bl->dyBody, b->sc, 3, (B[]){t, x, w }); }
B md1Bl_c1(Md1D* d, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->bodies[0], b->sc, 5, (B[]){tag(d,FUN_TAG), x, bi_N, tag(ptr_inc(d->m1),MD1_TAG), inc(d->f) }); }
B md1Bl_c2(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; ptr_inc(d); return execBlock(b->bl, b->bl->dyBody, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , tag(ptr_inc(d->m1),MD1_TAG), inc(d->f) }); }
B md2Bl_c1(Md2D* d, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->bodies[0], b->sc, 6, (B[]){tag(d,FUN_TAG), x, bi_N, tag(ptr_inc(d->m2),MD2_TAG), inc(d->f), inc(d->g)}); }
B md2Bl_c2(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; ptr_inc(d); return execBlock(b->bl, b->bl->dyBody, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , tag(ptr_inc(d->m2),MD2_TAG), inc(d->f), inc(d->g)}); }
NORETURN NOINLINE static void noInv(Body* bo, Scope* psc, i8 type, i8 inv) {
pushEnv(m_scope(bo, psc, 0, 0, (B[]){}), bo->bc);
@ -995,12 +995,12 @@ NORETURN NOINLINE static void noInv(Body* bo, Scope* psc, i8 type, i8 inv) {
B funBl_im(B t, B x) { FunBlock* b=c(FunBlock, t); Body* bo=b->bl->invMBody; if (!bo->exists) noInv(bo,b->sc,0,0); ptr_inc(b); return execBlock(b->bl, bo, b->sc, 3, (B[]){t, x, bi_N}); }
B funBl_iw(B t, B w, B x) { FunBlock* b=c(FunBlock, t); Body* bo=b->bl->invWBody; if (!bo->exists) noInv(bo,b->sc,0,1); ptr_inc(b); return execBlock(b->bl, bo, b->sc, 3, (B[]){t, x, w }); }
B funBl_ix(B t, B w, B x) { FunBlock* b=c(FunBlock, t); Body* bo=b->bl->invXBody; if (!bo->exists) noInv(bo,b->sc,0,2); ptr_inc(b); return execBlock(b->bl, bo, b->sc, 3, (B[]){t, x, w }); }
B md1Bl_im(Md1D* d, B x) { Md1Block* b=(Md1Block*)d->m1; Body* bo=b->bl->invMBody; if (!bo->exists) noInv(bo,b->sc,1,0); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 5, (B[]){tag(d,FUN_TAG), x, bi_N, inc(tag(d->m1,MD1_TAG)), inc(d->f)}); }
B md1Bl_iw(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; Body* bo=b->bl->invWBody; if (!bo->exists) noInv(bo,b->sc,1,1); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m1,MD1_TAG)), inc(d->f)}); }
B md1Bl_ix(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; Body* bo=b->bl->invXBody; if (!bo->exists) noInv(bo,b->sc,1,2); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m1,MD1_TAG)), inc(d->f)}); }
B md2Bl_im(Md2D* d, B x) { Md2Block* b=(Md2Block*)d->m2; Body* bo=b->bl->invMBody; if (!bo->exists) noInv(bo,b->sc,2,0); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 6, (B[]){tag(d,FUN_TAG), x, bi_N, inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); }
B md2Bl_iw(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; Body* bo=b->bl->invWBody; if (!bo->exists) noInv(bo,b->sc,2,1); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); }
B md2Bl_ix(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; Body* bo=b->bl->invXBody; if (!bo->exists) noInv(bo,b->sc,2,2); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , inc(tag(d->m2,MD2_TAG)), inc(d->f), inc(d->g)}); }
B md1Bl_im(Md1D* d, B x) { Md1Block* b=(Md1Block*)d->m1; Body* bo=b->bl->invMBody; if (!bo->exists) noInv(bo,b->sc,1,0); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 5, (B[]){tag(d,FUN_TAG), x, bi_N, tag(ptr_inc(d->m1),MD1_TAG), inc(d->f)}); }
B md1Bl_iw(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; Body* bo=b->bl->invWBody; if (!bo->exists) noInv(bo,b->sc,1,1); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , tag(ptr_inc(d->m1),MD1_TAG), inc(d->f)}); }
B md1Bl_ix(Md1D* d, B w, B x) { Md1Block* b=(Md1Block*)d->m1; Body* bo=b->bl->invXBody; if (!bo->exists) noInv(bo,b->sc,1,2); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 5, (B[]){tag(d,FUN_TAG), x, w , tag(ptr_inc(d->m1),MD1_TAG), inc(d->f)}); }
B md2Bl_im(Md2D* d, B x) { Md2Block* b=(Md2Block*)d->m2; Body* bo=b->bl->invMBody; if (!bo->exists) noInv(bo,b->sc,2,0); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 6, (B[]){tag(d,FUN_TAG), x, bi_N, tag(ptr_inc(d->m2),MD2_TAG), inc(d->f), inc(d->g)}); }
B md2Bl_iw(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; Body* bo=b->bl->invWBody; if (!bo->exists) noInv(bo,b->sc,2,1); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , tag(ptr_inc(d->m2),MD2_TAG), inc(d->f), inc(d->g)}); }
B md2Bl_ix(Md2D* d, B w, B x) { Md2Block* b=(Md2Block*)d->m2; Body* bo=b->bl->invXBody; if (!bo->exists) noInv(bo,b->sc,2,2); ptr_inc(d); return execBlock(b->bl, bo, b->sc, 6, (B[]){tag(d,FUN_TAG), x, w , tag(ptr_inc(d->m2),MD2_TAG), inc(d->f), inc(d->g)}); }
B md1Bl_d(B m, B f ) { Md1Block* c = c(Md1Block,m); Block* bl=c(Md1Block, m)->bl; return c->bl->imm? execBlock(bl, bl->bodies[0], c(Md1Block, m)->sc, 2, (B[]){m, f }) : m_md1D((Md1*)c,f ); }
B md2Bl_d(B m, B f, B g) { Md2Block* c = c(Md2Block,m); Block* bl=c(Md2Block, m)->bl; return c->bl->imm? execBlock(bl, bl->bodies[0], c(Md2Block, m)->sc, 3, (B[]){m, f, g}) : m_md2D((Md2*)c,f,g); }
@ -1292,7 +1292,7 @@ NOINLINE B vm_fmtPoint(B src, B prepend, B path, usz cs, usz ce) { // consumes p
SGetU(s)
while (padStart>0 && o2cu(GetU(s,padStart-1))!='\n') padStart--;
AJOIN(taga(arr_shVec(TI(src,slice)(inc(src),srcS, srcE-srcS))));
AJOIN(taga(arr_shVec(TI(src,slice)(incG(src),srcS, srcE-srcS))));
cs-= srcS;
ce-= srcS;
ACHR('\n');
@ -1522,7 +1522,7 @@ void profiler_displayResults() {
u32 c = o2cu(GetU(src, i));
curr+= m[i];
if (c=='\n' || i==sia-1) {
Arr* sl = arr_shVec(TI(src,slice)(inc(src), pi, i-pi+(c=='\n'?0:1)));
Arr* sl = arr_shVec(TI(src,slice)(incG(src), pi, i-pi+(c=='\n'?0:1)));
if (curr==0) printf("");
else printf("%6d│", curr);
printRaw(taga(sl));
@ -1630,5 +1630,5 @@ NOINLINE NORETURN void thrM(char* s) {
}
NOINLINE NORETURN void thrOOM() {
if (oomMessage.u==0) err("out-of-memory encountered before out-of-memory error message object was initialized");
thr(inc(oomMessage));
thr(incG(oomMessage));
}