diff --git a/coverager.c b/coverager.c index 3f238a8..846340b 100644 --- a/coverager.c +++ b/coverager.c @@ -1,3 +1,7 @@ +#if 0 +#define XCACHE_DEBUG +#endif + #include #include "xcache.h" #include "ext/standard/flock_compat.h" @@ -18,10 +22,6 @@ typedef HashTable *coverager_t; static char *xc_coveragedump_dir = NULL; static zend_compile_file_t *old_compile_file = NULL; -#if 0 -#define DEBUG -#endif - /* dumper */ static void xc_destroy_coverage(void *pDest) /* {{{ */ { diff --git a/mem.c b/mem.c index 5f2f0c6..48ca406 100644 --- a/mem.c +++ b/mem.c @@ -1,10 +1,16 @@ #ifdef TEST #include #include +# define XCACHE_DEBUG #else #include #endif +#ifdef XCACHE_DEBUG +# define ALLOC_DEBUG_BLOCK_CHECK +#endif + + #include #include #include @@ -14,13 +20,6 @@ #include "align.h" #include "utils.h" -#ifdef TEST -# define DEBUG -#endif -#ifdef DEBUG -# define ALLOC_DEBUG_BLOCK_CHECK -#endif - #if 0 #undef ALLOC_DEBUG_BLOCK_CHECK #endif diff --git a/optimizer.c b/optimizer.c index 2893e96..f4f4873 100644 --- a/optimizer.c +++ b/optimizer.c @@ -1,5 +1,5 @@ #if 0 -# define DEBUG +# define XCACHE_DEBUG #endif #include "utils.h" @@ -8,7 +8,7 @@ #include "stack.h" #include "xcache_globals.h" -#ifdef DEBUG +#ifdef XCACHE_DEBUG # include "processor.h" # include "const_string.h" # include "ext/standard/php_var.h" @@ -180,7 +180,7 @@ static int op_get_flowinfo(op_flowinfo_t *fi, zend_op *opline) /* {{{ */ return SUCCESS; } /* }}} */ -#ifdef DEBUG +#ifdef XCACHE_DEBUG static void op_snprint(char *buf, int size, znode *op) /* {{{ */ { switch (op->op_type) { @@ -277,7 +277,7 @@ static void bb_destroy(bb_t *bb) /* {{{ */ efree(bb); } /* }}} */ -#ifdef DEBUG +#ifdef XCACHE_DEBUG static void bb_print(bb_t *bb, zend_op *opcodes) /* {{{ */ { int line = bb->opcodes - opcodes; @@ -319,7 +319,7 @@ static void bbs_destroy(bbs_t *bbs) /* {{{ */ xc_stack_destroy(bbs); } /* }}} */ -#ifdef DEBUG +#ifdef XCACHE_DEBUG static void bbs_print(bbs_t *bbs, zend_op *opcodes) /* {{{ */ { int i; @@ -407,7 +407,7 @@ static int bbs_build_from(bbs_t *bbs, zend_op_array *op_array, int count) /* {{{ catchbbids[j] = bbids[e->catch_op]; } } -#ifdef DEBUG +#ifdef XCACHE_DEBUG for (i = 0; i < count; i ++) { TRACE("catchbbids[%d] = %d", i, catchbbids[i]); } @@ -521,7 +521,7 @@ static int xc_optimize_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */ return 0; } -#ifdef DEBUG +#ifdef XCACHE_DEBUG # if 0 TRACE("optimize file: %s", op_array->filename); xc_dprint_zend_op_array(op_array, 0 TSRMLS_CC); @@ -533,7 +533,7 @@ static int xc_optimize_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */ bbs_init(&bbs); if (bbs_build_from(&bbs, op_array, op_array->last) == SUCCESS) { int i; -#ifdef DEBUG +#ifdef XCACHE_DEBUG bbs_print(&bbs, op_array->opcodes); #endif /* TODO: calc opnum after basic block move */ @@ -546,7 +546,7 @@ static int xc_optimize_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */ bbs_destroy(&bbs); } -#ifdef DEBUG +#ifdef XCACHE_DEBUG # if 0 TRACE("%s", "after compiles"); xc_dprint_zend_op_array(op_array, 0 TSRMLS_CC); diff --git a/utils.h b/utils.h index cb9c50f..69e90ae 100644 --- a/utils.h +++ b/utils.h @@ -1,7 +1,7 @@ #include "php.h" #include "xcache.h" -#ifdef DEBUG +#ifdef XCACHE_DEBUG # define IFDEBUG(x) (x) int xc_vtrace(const char *fmt, va_list args); int xc_trace(const char *fmt, ...) ZEND_ATTRIBUTE_PTR_FORMAT(printf, 1, 2); @@ -24,7 +24,7 @@ static inline int TRACE(const char *fmt, ...) # undef NDEBUG # undef inline # define inline -#else /* DEBUG */ +#else /* XCACHE_DEBUG */ # ifdef ZEND_WIN32 static inline int TRACE_DUMMY(const char *fmt, ...) @@ -40,7 +40,7 @@ static inline int TRACE_DUMMY(const char *fmt, ...) # ifndef NDEBUG # define NDEBUG # endif -#endif /* DEBUG */ +#endif /* XCACHE_DEBUG */ #include typedef struct { diff --git a/xcache.c b/xcache.c index 4405312..86f7405 100644 --- a/xcache.c +++ b/xcache.c @@ -1,6 +1,6 @@ #if 0 -#define DEBUG +#define XCACHE_DEBUG #endif #if 0 @@ -1028,7 +1028,7 @@ static int xc_entry_init_key_php_md5(xc_entry_data_php_t *php, xc_entry_t *xce T hv = xc_php_hash_md5(php TSRMLS_CC); php->cache = xce->cache; php->hvalue = (hv & php->cache->hphp->mask); -#ifdef DEBUG +#ifdef XCACHE_DEBUG { char md5str[33]; make_digest(md5str, (unsigned char *) php->md5);