From 09fe162b73f171256d3fe0327741c727f013602e Mon Sep 17 00:00:00 2001 From: dzaima Date: Sat, 12 Mar 2022 03:02:21 +0200 Subject: [PATCH] DONT_FREE fix, more gdb utils --- src/core/stuff.c | 6 ++++-- src/load.c | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/stuff.c b/src/core/stuff.c index 4b7a00fd..e21dd1a5 100644 --- a/src/core/stuff.c +++ b/src/core/stuff.c @@ -636,8 +636,7 @@ B any_squeeze(B x) { assert(isArr(x)); if (FL_HAS(x,fl_squoze)) return x; if (a(x)->ia==0) return FL_SET(x, fl_squoze); // TODO return a version of the smallest type - SGetU(x) - B x0 = GetU(x, 0); + B x0 = IGetU(x, 0); if (isNum(x0)) return num_squeeze(x); else if (isC32(x0)) return chr_squeeze(x); return FL_SET(x, fl_squoze); @@ -748,13 +747,16 @@ NOINLINE void print_allocStats() { } // for gdb +B info_c2(B, B, B); Value* g_v(B x) { return v(x); } Arr* g_a(B x) { return a(x); } B g_t (void* x) { return tag(x,OBJ_TAG); } B g_ta(void* x) { return tag(x,ARR_TAG); } B g_tf(void* x) { return tag(x,FUN_TAG); } void g_p(B x) { print(x); putchar(10); fflush(stdout); } +void g_i(B x) { B r = info_c2(x, m_f64(1), inc(x)); print(r); dec(r); putchar(10); fflush(stdout); } void g_pv(void* x) { print(tag(x,OBJ_TAG)); putchar(10); fflush(stdout); } +void g_iv(void* x) { B xo = tag(x, OBJ_TAG); B r = info_c2(xo, m_f64(1), inc(xo)); print(r); dec(r); putchar(10); fflush(stdout); } void g_pst() { vm_pstLive(); } #ifdef DEBUG diff --git a/src/load.c b/src/load.c index ce882c34..0d03fd15 100644 --- a/src/load.c +++ b/src/load.c @@ -531,12 +531,14 @@ B def_m2_ix(Md2D* t, B w, B x) { return def_fn_ix(tag(t,FUN_TAG), w, x); } #ifdef DONT_FREE static B empty_get(Arr* x, usz n) { x->type = x->flags; + if (x->type==t_empty) err("getting from empty without old type data"); B r = TIv(x,get)(x, n); x->type = t_empty; return r; } static B empty_getU(Arr* x, usz n) { x->type = x->flags; + if (x->type==t_empty) err("getting from empty without old type data"); B r = TIv(x,getU)(x, n); x->type = t_empty; return r;