use decR less
This commit is contained in:
parent
1f5cfbe766
commit
749b098f1e
@ -54,8 +54,8 @@ B atan_c1(B t, B x) { if (isF64(x)) return m_f64( atan(x.f)); P1( atan); thrM("
|
||||
#undef P1
|
||||
|
||||
B lt_c1(B t, B x) { return m_unit(x); }
|
||||
B eq_c1(B t, B x) { B r = m_i32(isArr(x)? rnk(x) : 0); decR(x); return r; }
|
||||
B ne_c1(B t, B x) { B r = m_f64(isArr(x)&&rnk(x)? *a(x)->sh : 1); decR(x); return r; }
|
||||
B eq_c1(B t, B x) { B r = m_i32(isArr(x)? rnk(x) : 0); dec(x); return r; }
|
||||
B ne_c1(B t, B x) { B r = m_f64(isArr(x)&&rnk(x)? *a(x)->sh : 1); dec(x); return r; }
|
||||
|
||||
|
||||
static B mathNS;
|
||||
|
||||
@ -159,7 +159,7 @@ B shape_c2(B t, B w, B x) {
|
||||
}
|
||||
unit:
|
||||
|
||||
if (isF64(x)) { decR(xf);
|
||||
if (isF64(x)) { decA(xf);
|
||||
i32 n = (i32)x.f;
|
||||
if (n == x.f) {
|
||||
i32* rp; Arr* r = m_i32arrp(&rp, nia); arr_shSetU(r, nr, sh);
|
||||
@ -171,7 +171,7 @@ B shape_c2(B t, B w, B x) {
|
||||
return taga(r);
|
||||
}
|
||||
}
|
||||
if (isC32(x)) { decR(xf);
|
||||
if (isC32(x)) { decA(xf);
|
||||
u32* rp; Arr* r = m_c32arrp(&rp, nia); arr_shSetU(r, nr, sh);
|
||||
u32 c = o2cu(x);
|
||||
for (u64 i = 0; i < nia; i++) rp[i] = c;
|
||||
@ -536,7 +536,7 @@ B join_c1(B t, B x) {
|
||||
if (xia==0) {
|
||||
B xf = getFillE(x);
|
||||
if (isAtm(xf)) {
|
||||
decR(xf);
|
||||
decA(xf);
|
||||
if (!PROPER_FILLS) {
|
||||
B xfq = getFillR(x);
|
||||
bool no = noFill(xfq);
|
||||
|
||||
@ -24,6 +24,7 @@ NOINLINE B c2_rare(B f, B w, B x) { dec(w); dec(x);
|
||||
return inc(VALIDATE(f));
|
||||
}
|
||||
NOINLINE void value_freeR(Value* x) { value_free(x); }
|
||||
NOINLINE void decA_rare(B x) { dec(x); }
|
||||
void noop_visit(Value* x) { }
|
||||
NOINLINE B c1_invalid(B f, B x) { thrM("This function can't be called monadically"); }
|
||||
NOINLINE B c2_invalid(B f, B w, B x) { thrM("This function can't be called dyadically"); }
|
||||
|
||||
2
src/h.h
2
src/h.h
@ -421,6 +421,8 @@ static void decR(B x) {
|
||||
Value* vx = v(x);
|
||||
if(!--vx->refc) value_freeR(vx);
|
||||
}
|
||||
void decA_rare(B x);
|
||||
static void decA(B x) { if (RARE(isVal(x))) decA_rare(x); } // decrement what's likely an atom
|
||||
static B inc(B x) {
|
||||
if (isVal(VALIDATE(x))) v(x)->refc++;
|
||||
return x;
|
||||
|
||||
2
src/ns.c
2
src/ns.c
@ -107,7 +107,7 @@ B ns_nameList(NSDesc* d) {
|
||||
DEF_FREE(ns) {
|
||||
NS* c = (NS*)x;
|
||||
ptr_decR(c->desc);
|
||||
ptr_decR(c->sc);
|
||||
ptr_dec(c->sc);
|
||||
}
|
||||
static void ns_visit(Value* x) {
|
||||
NS* c = (NS*)x;
|
||||
|
||||
6
src/vm.c
6
src/vm.c
@ -805,9 +805,9 @@ DEF_FREE(block) {
|
||||
for (i32 i = 0; i < am; i++) ptr_decR(c->bodies[i]);
|
||||
}
|
||||
DEF_FREE(comp) { Comp* c = (Comp *)x; ptr_decR(c->objs); decR(c->bc); decR(c->src); decR(c->indices); decR(c->path); }
|
||||
DEF_FREE(funBl) { FunBlock* c = (FunBlock*)x; ptr_decR(c->sc); ptr_decR(c->bl); }
|
||||
DEF_FREE(md1Bl) { Md1Block* c = (Md1Block*)x; ptr_decR(c->sc); ptr_decR(c->bl); }
|
||||
DEF_FREE(md2Bl) { Md2Block* c = (Md2Block*)x; ptr_decR(c->sc); ptr_decR(c->bl); }
|
||||
DEF_FREE(funBl) { FunBlock* c = (FunBlock*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
||||
DEF_FREE(md1Bl) { Md1Block* c = (Md1Block*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
||||
DEF_FREE(md2Bl) { Md2Block* c = (Md2Block*)x; ptr_dec(c->sc); ptr_decR(c->bl); }
|
||||
DEF_FREE(alias) { dec(((FldAlias*)x)->obj); }
|
||||
DEF_FREE(bBlks) { BlBlocks* c = (BlBlocks*)x; u16 am = c->am; for (i32 i = 0; i < am; i++) ptr_dec(c->a[i]); }
|
||||
DEF_FREE(scExt) { ScopeExt* c = (ScopeExt*)x; u16 am = c->varAm*2; for (i32 i = 0; i < am; i++) dec(c->vars[i]); }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user