OOM fuzz testing base

This commit is contained in:
dzaima 2022-06-04 01:19:17 +03:00
parent 1e2b734f5d
commit 8ad7b6149f
2 changed files with 12 additions and 3 deletions

View File

@ -10,7 +10,7 @@ B md2BI_ucw(Md2* t, B o, B f, B g, B w, B x) { return ((BMd2*)t)->ucw(t, o, f, g
B val_c1(Md2D* d, B x) { return c1(d->f, x); }
B val_c2(Md2D* d, B w, B x) { return c2(d->g, w,x); }
#if CATCH_ERRORS
#if CATCH_ERRORS && !BI_CATCH_DISABLED
extern B lastErrMsg; // sysfn.c
B fillBy_c1(Md2D* d, B x) {

View File

@ -254,7 +254,16 @@ static BBB2B c2fn(B f) {
extern u32** actrs;
#endif
#endif
static inline void onAlloc(usz sz, u8 type) {
#ifdef OOM_TEST
extern i64 oomTestLeft;
NOINLINE NORETURN void thrOOMTest(void);
#endif
FORCE_INLINE void onAlloc(usz sz, u8 type) {
#ifdef OOM_TEST
if (--oomTestLeft==0) thrOOMTest();
#endif
#ifdef ALLOC_STAT
if (!ctr_a) {
#ifdef ALLOC_SIZES
@ -272,7 +281,7 @@ static inline void onAlloc(usz sz, u8 type) {
talloc+= sz;
#endif
}
static inline void onFree(Value* x) {
FORCE_INLINE void onFree(Value* x) {
#ifdef ALLOC_STAT
ctr_f[x->type]++;
#endif