move thrF to a full function

0.3% more instrs with it never being called what
This commit is contained in:
dzaima 2021-07-20 02:55:07 +03:00
parent 78cd23907e
commit c2c64f9654
3 changed files with 25 additions and 10 deletions

View File

@ -55,9 +55,6 @@ void decShR(Value* x) {
}
B bi_emptyHVec, bi_emptyIVec, bi_emptyCVec, bi_emptySVec;
NOINLINE B emptyCVecR() {
return emptyCVec();
}
NOINLINE TStack* ts_e(TStack* o, u32 elsz, u64 am) { u64 size = o->size;
u64 alsz = mm_round(fsizeof(TStack, data, u8, (size+am)*elsz));
@ -159,9 +156,7 @@ NOINLINE void printRaw(B x) {
}
}
}
NOINLINE B append_fmt(B s, char* p, ...) {
va_list a;
va_start(a, p);
NOINLINE B do_fmt(B s, char* p, va_list a) {
char buf[30];
char c;
char* lp = p;
@ -258,9 +253,29 @@ NOINLINE B append_fmt(B s, char* p, ...) {
lp = p;
}
if (lp!=p) AJOIN(fromUTF8(lp, p-lp));
va_end(a);
return s;
}
NOINLINE B append_fmt(B s, char* p, ...) {
va_list a;
va_start(a, p);
B r = do_fmt(s, p, a);
va_end(a);
return r;
}
NOINLINE B make_fmt(char* p, ...) {
va_list a;
va_start(a, p);
B r = do_fmt(emptyCVec(), p, a);
va_end(a);
return r;
}
NOINLINE void thrF(char* p, ...) {
va_list a;
va_start(a, p);
B r = do_fmt(emptyCVec(), p, a);
va_end(a);
thr(r);
}
#define CMP(W,X) ({ AUTO wt = (W); AUTO xt = (X); (wt>xt?1:0)-(wt<xt?1:0); })
NOINLINE i32 compareR(B w, B x) {

View File

@ -100,13 +100,14 @@ static bool isNumEl(u8 elt) { return elt==el_i32 | elt==el_f64; }
B m_str8l(char* s);
B fromUTF8l(char* x);
B append_fmt(B s, char* p, ...);
B make_fmt(char* p, ...);
#define AJOIN(X) s = vec_join(s,X) // consumes X
#define AOBJ(X) s = vec_add(s,X) // consumes X
#define ACHR(X) AOBJ(m_c32(X))
#define A8(X) AJOIN(m_str8l(X))
#define AU(X) AJOIN(fromUTF8l(X))
#define AFMT(...) s = append_fmt(s, __VA_ARGS__)
NOINLINE B append_fmt(B s, char* p, ...);
// function stuff

View File

@ -234,7 +234,6 @@ extern B bi_emptyHVec, bi_emptyIVec, bi_emptyCVec, bi_emptySVec;
#define emptyIVec() ({ B t = bi_emptyIVec; ptr_inc(v(t)); t; })
#define emptyCVec() ({ B t = bi_emptyCVec; ptr_inc(v(t)); t; })
#define emptySVec() ({ B t = bi_emptySVec; ptr_inc(v(t)); t; })
NOINLINE B emptyCVecR();
static void dec(B x);
static B inc(B x);
static void ptr_dec(void* x);
@ -260,7 +259,7 @@ B bqn_repr(B x); // consumes
NOINLINE NORETURN void thr(B b);
NOINLINE NORETURN void thrM(char* s);
#define thrF(...) thr(append_fmt(emptyCVecR(), __VA_ARGS__))
NOINLINE NORETURN void thrF(char* s, ...);
NOINLINE NORETURN void thrOOM();
jmp_buf* prepareCatch();
#if CATCH_ERRORS