remove unused mut fns

This commit is contained in:
dzaima 2025-05-25 18:54:46 +03:00
parent 7dc5aa9090
commit 3abd77fed8
3 changed files with 2 additions and 20 deletions

View File

@ -488,7 +488,7 @@ B select_replace(u32 chr, B w, B x, B rep, usz wia, usz cam, usz csz) { // consu
for (usz i = 0; i < wia; i++) { for (usz i = 0; i < wia; i++) {
READ_W(cw, i); READ_W(cw, i);
EQ(for (usz j = 0; j < csz; j++), !compatible(DIRECTARR_GETU(r, cw*csz + j), GetU(rep, i*csz + j))); EQ(for (usz j = 0; j < csz; j++), !compatible(DIRECTARR_GETU(r, cw*csz + j), GetU(rep, i*csz + j)));
DIRECTARR_REPLACE_RANGE(r, cw*csz, rep, i*csz, csz); DIRECTARR_REPLACE_RANGE(r, cw*csz, rep, i*csz, csz); // TODO use cf_*
} }
} }
goto dec_ret_rb; goto dec_ret_rb;

View File

@ -43,21 +43,6 @@ static void* harr_tyarr_ptr(Arr* t, u8 el) {
return el==el_B? (void*)harrv_ptr(t) : tyarrv_ptr((TyArr*)t); return el==el_B? (void*)harrv_ptr(t) : tyarrv_ptr((TyArr*)t);
} }
INIT_GLOBAL u8 reuseElType[t_COUNT];
void mut_init_copy(Mut* m, B x, u8 el) {
assert(m->fns == &mutFns[el_MAX]);
if (reusable(x) && reuseElType[TY(x)]==el && TY(x)!=t_fillarr) { // reuseElType is currently primarily used for toEltypeArr; currently just leaving this special-cased until it's decided what to do with this
m->fns = &mutFns[el];
Arr* a = m->val = a(REUSE(x));
m->a = harr_tyarr_ptr(a, el);
} else {
mut_to(m, el);
mut_copy(m, 0, x, 0, IA(x));
arr_shCopy(m->val, x);
decG(x);
}
}
static Arr* (* const cpyFns[])(B) = { static Arr* (* const cpyFns[])(B) = {
[el_bit] = cpyBitArr, [el_bit] = cpyBitArr,
[el_i8] = cpyI8Arr, [el_c8] = cpyC8Arr, [el_i8] = cpyI8Arr, [el_c8] = cpyC8Arr,
@ -800,6 +785,7 @@ NOINLINE void apd_widen(ApdMut* m, B x, ApdFn* const* fns) {
INIT_GLOBAL u8 reuseElType[t_COUNT];
static NOINLINE DirectArr toFillArr(B x, B fill) { static NOINLINE DirectArr toFillArr(B x, B fill) {
usz ia = IA(x); usz ia = IA(x);
Arr* r = arr_shCopy(m_fillarrp(ia), x); Arr* r = arr_shCopy(m_fillarrp(ia), x);

View File

@ -80,13 +80,9 @@ void mut_pfree(Mut* m, usz n);
// consumes x; sets m[ms] to x // consumes x; sets m[ms] to x
static void mut_set(Mut* m, usz ms, B x) { m->fns->m_set(m, ms, x); } static void mut_set(Mut* m, usz ms, B x) { m->fns->m_set(m, ms, x); }
// clears the object (decrements its refcount) at position ms // clears the object (decrements its refcount) at position ms
static void mut_rm(Mut* m, usz ms) { if (m->fns->elType == el_B) dec(((B*)m->a)[ms]); } static void mut_rm(Mut* m, usz ms) { if (m->fns->elType == el_B) dec(((B*)m->a)[ms]); }
// gets object at position ms, without increasing refcount
static B mut_getU(Mut* m, usz ms) { return m->fns->m_getU(m->a, ms); }
// doesn't consume; fills m[ms…ms+l] with x // doesn't consume; fills m[ms…ms+l] with x
static void mut_fill(Mut* m, usz ms, B x, usz l) { m->fns->m_fill(m, ms, x, l); } static void mut_fill(Mut* m, usz ms, B x, usz l) { m->fns->m_fill(m, ms, x, l); }