add nogc message to thrF

This commit is contained in:
dzaima 2023-05-19 17:32:14 +03:00
parent a03fab044d
commit d930e7f975
5 changed files with 6 additions and 7 deletions

View File

@ -351,6 +351,7 @@ NOINLINE void print_fmt(char* p, ...) {
decG(r);
}
NOINLINE void thrF(char* p, ...) {
NOGC_CHECK("throwing during noAlloc");
va_list a;
va_start(a, p);
B r = do_fmt(emptyCVec(), p, a);

View File

@ -327,7 +327,7 @@ typedef struct Arr {
#define UD assert(false)
extern bool cbqn_noAlloc;
NOINLINE void cbqn_NOGC_start(); // function to allow breakpointing
#define NOGC_CHECK if (cbqn_noAlloc && !gc_depth) fatal("allocating during noalloc");
#define NOGC_CHECK(M) do { if (cbqn_noAlloc && !gc_depth) fatal(M); } while (0)
#define NOGC_S cbqn_NOGC_start()
#define NOGC_E cbqn_noAlloc=false
#else
@ -337,7 +337,7 @@ typedef struct Arr {
#define UD __builtin_unreachable()
#define NOGC_S
#define NOGC_E
#define NOGC_CHECK
#define NOGC_CHECK(M)
#endif
#if WARN_SLOW
void warn_slow1(char* s, B x);

View File

@ -23,7 +23,7 @@ extern EmptyValue* mm_buckets[64];
#if !ALLOC_NOINLINE || ALLOC_IMPL || ALLOC_IMPL_MMX
ALLOC_FN void* mm_alloc(u64 sz, u8 type) {
assert(sz>=16);
NOGC_CHECK;
NOGC_CHECK("allocating during noalloc");
preAlloc(sz, type);
#if VERIFY_TAIL
i64 logAlloc = LOG2(sz + VERIFY_TAIL);

View File

@ -96,7 +96,7 @@ static void mut_copy(Mut* m, usz ms, B x, usz xs, usz l) { assert(isArr(x)); m->
// after that, the only valid operation on the Mut will be MUT_APPEND
// using this append system will no longer prevent allocations from being done during the lifetime of the Mut
#define MUT_APPEND_INIT(N) ux N##_ci = 0; NOGC_E;
#define MUT_APPEND(N, X, XS, L) ({ ux l_ = (L); NOGC_CHECK; \
#define MUT_APPEND(N, X, XS, L) ({ ux l_ = (L); NOGC_CHECK("MUT_APPEND during noalloc"); \
mut_copy(N, N##_ci, X, XS, l_); \
N##_ci+= l_; \
if (PTY(N->val) == t_harr) { NOGC_E; N->val->ia = N##_ci; } \

View File

@ -1677,9 +1677,7 @@ void before_exit(void);
NOINLINE NORETURN void throwImpl(bool rethrow) {
// printf("gStack %p-%p:\n", gStackStart, gStack); B* c = gStack;
// while (c>gStackStart) { printI(*--c); putchar('\n'); } printf("gStack printed\n");
#if DEBUG
if (cbqn_noAlloc && !gc_depth) fatal("throwing during noAlloc");
#endif
NOGC_CHECK("throwing during noAlloc");
if (!rethrow) envPrevHeight = envCurr-envStart + 1;
#if CATCH_ERRORS
if (cf>cfStart) { // something wants to catch errors