From 5c7c5a69cf12b04ed4d75cd67bb7b3a48893c737 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 21 Feb 2016 20:13:05 +0900 Subject: [PATCH] remove debug code --- etc/mkloader.pl | 4 -- extlib/benz/eval.c | 15 +---- extlib/benz/include/picrin/config.h | 9 --- extlib/benz/include/picrin/extra.h | 5 -- extlib/benz/include/picrin/private/vm.h | 22 +++---- extlib/benz/include/picrin/setup.h | 8 --- extlib/benz/macro.c | 12 ---- extlib/benz/proc.c | 83 +------------------------ 8 files changed, 15 insertions(+), 143 deletions(-) diff --git a/etc/mkloader.pl b/etc/mkloader.pl index be2d7414..f2c2566f 100755 --- a/etc/mkloader.pl +++ b/etc/mkloader.pl @@ -60,10 +60,6 @@ EOL } print < -# define GC_STRESS 0 -# define VM_DEBUG 1 -# define GC_DEBUG 0 -# define GC_DEBUG_DETAIL 0 -#endif - /* check compatibility */ #if __STDC_VERSION__ >= 199901L diff --git a/extlib/benz/macro.c b/extlib/benz/macro.c index 52a2bad2..b1e710d5 100644 --- a/extlib/benz/macro.c +++ b/extlib/benz/macro.c @@ -334,23 +334,11 @@ pic_expand(pic_state *pic, pic_value expr, pic_value env) { pic_value v, deferred; -#if DEBUG - puts("before expand:"); - pic_debug(pic, expr); - puts(""); -#endif - deferred = pic_list(pic, 1, pic_nil_value(pic)); v = expand(pic, expr, env, deferred); expand_deferred(pic, deferred, env); -#if DEBUG - puts("after expand:"); - pic_debug(pic, v); - puts(""); -#endif - return v; } diff --git a/extlib/benz/proc.c b/extlib/benz/proc.c index 59c44fe7..d0b168ea 100644 --- a/extlib/benz/proc.c +++ b/extlib/benz/proc.c @@ -292,15 +292,9 @@ pic_vm_tear_off(pic_state *pic) } } -#if VM_DEBUG -# define OPCODE_EXEC_HOOK pic_dump_code(c) -#else -# define OPCODE_EXEC_HOOK ((void)0) -#endif - #if PIC_DIRECT_THREADED_VM # define VM_LOOP JUMP; -# define CASE(x) L_##x: OPCODE_EXEC_HOOK; +# define CASE(x) L_##x: # define NEXT pic->ip++; JUMP; # define JUMP c = *pic->ip; goto *oplabels[c.insn]; # define VM_LOOP_END @@ -318,69 +312,6 @@ pic_vm_tear_off(pic_state *pic) #define PUSHCI() (++pic->ci) #define POPCI() (pic->ci--) -#if VM_DEBUG -# define VM_BOOT_PRINT \ - do { \ - puts("### booting VM... ###"); \ - stbase = pic->sp; \ - cibase = pic->ci; \ - } while (0) -#else -# define VM_BOOT_PRINT -#endif - -#if VM_DEBUG -# define VM_END_PRINT \ - do { \ - puts("**VM END STATE**"); \ - printf("stbase\t= %p\nsp\t= %p\n", (void *)stbase, (void *)pic->sp); \ - printf("cibase\t= %p\nci\t= %p\n", (void *)cibase, (void *)pic->ci); \ - if (stbase < pic->sp - 1) { \ - pic_value *sp; \ - printf("* stack trace:"); \ - for (sp = stbase; pic->sp != sp; ++sp) { \ - pic_debug(pic, *sp); \ - puts(""); \ - } \ - } \ - if (stbase > pic->sp - 1) { \ - puts("*** stack underflow!"); \ - } \ - } while (0) -#else -# define VM_END_PRINT -#endif - -#if VM_DEBUG -# define VM_CALL_PRINT \ - do { \ - short i; \ - puts("\n== calling proc..."); \ - printf(" proc = "); \ - pic_debug(pic, pic_obj_value(proc)); \ - puts(""); \ - printf(" argv = ("); \ - for (i = 1; i < c.u.i; ++i) { \ - if (i > 1) \ - printf(" "); \ - pic_debug(pic, pic->sp[-c.u.i + i]); \ - } \ - puts(")"); \ - if (! pic_proc_func_p(proc)) { \ - printf(" irep = %p\n", proc->u.i.irep); \ - printf(" name = %s\n", pic_str(pic, pic_sym_name(pic, pic_proc_name(proc)))); \ - pic_dump_irep(proc->u.i.irep); \ - } \ - else { \ - printf(" cfunc = %p\n", (void *)proc->u.f.func); \ - printf(" name = %s\n", pic_str(pic, pic_sym_name(pic, pic_proc_name(proc)))); \ - } \ - puts("== end\n"); \ - } while (0) -#else -# define VM_CALL_PRINT -#endif - /* for arithmetic instructions */ pic_value pic_add(pic_state *, pic_value, pic_value); pic_value pic_sub(pic_state *, pic_value, pic_value); @@ -414,19 +345,12 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv) }; #endif -#if VM_DEBUG - pic_value *stbase; - pic_callinfo *cibase; -#endif - PUSH(proc); for (i = 0; i < argc; ++i) { PUSH(argv[i]); } - VM_BOOT_PRINT; - /* boot! */ boot[0].insn = OP_CALL; boot[0].a = argc + 1; @@ -568,8 +492,6 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv) } proc = pic_proc_ptr(pic, x); - VM_CALL_PRINT; - if (pic->sp >= pic->stend) { pic_panic(pic, "VM stack overflow"); } @@ -841,9 +763,6 @@ pic_apply(pic_state *pic, pic_value proc, int argc, pic_value *argv) } CASE(OP_STOP) { - - VM_END_PRINT; - return pic_protect(pic, POP()); } } VM_LOOP_END;