CFLAGS += -DGWION_BUILTIN
-all: options-show ${PRG}
+all: options-show prg
-${PRG}: ${GWLIBS} src/main.o
+prg: ${GWLIBS} src/main.o
@$(info link ${PRG})
@${CC} src/main.o -o ${PRG} ${LDFLAGS} ${LIBS}
afl: gwion-fuzz
gwion-fuzz:
- @touch src/parse/{scan*.c,check.c} src/emit/emit.c src/main.c
+ @touch src/parse/{scan*.c,check.c} src/emit/emit.c src/main.c src/vm/vm.c
@+PRG=gwion-fuzz CC=afl-clang-fast CFLAGS=-D__FUZZING__ ${MAKE}
- @touch src/parse/{scan*.c,check.c} src/emit/emit.c src/main.c
+ @touch src/parse/{scan*.c,check.c} src/emit/emit.c src/main.c src/vm/vm.c
clean_core:
@rm -f core.* *vgcore.*
#include "compile.h"
static void afl_run(const Gwion gwion) {
+ const Env env = gwion->env;
__AFL_INIT();
-// while (__AFL_LOOP(128)) {
- while (__AFL_LOOP(32)) {
- push_global(gwion, "[afl]");
+ while (__AFL_LOOP(128)) {
+ const Nspc nspc = env->global_nspc;
+ env->curr = env->global_nspc = new_nspc(gwion->mp, "[afl]");
+ env->global_nspc->parent = nspc;
FILE *f = fdopen(0, "r");
if (compile_file(gwion, "afl", f)) gwion_run(gwion);
- pop_global(gwion);
+ free_nspc(env->global_nspc, env->gwion);
+ env->curr = env->global_nspc = nspc;
}
}