1
0
Fork 0

processor: dprint upgrade, added --enable-xcache-dprint

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@230 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
1.2
Xuefer 17 years ago
parent dff43a20c4
commit 99861b1d3c

@ -57,6 +57,12 @@ if test "$PHP_XCACHE" != "no"; then
fi
PHP_SUBST([XCACHE_ENABLE_TEST])
PHP_ARG_ENABLE(xcache-dprint, for XCache self test,
[ --enable-xcache-dprint XCache: Enable debug print functions - FOR DEVELOPERS ONLY!!], no, no)
if test "$PHP_XCACHE_DPRINT" != "no"; then
AC_DEFINE([HAVE_XCACHE_DPRINT], 1, [Define to enable XCache debug print functions])
fi
AC_PATH_PROGS([AWK], [gawk awk])
dnl clean locale for gawk 3.1.5 assertion bug
if echo | LANG=C "$AWK" -- '' > /dev/null 2>&1 ; then

@ -118,9 +118,14 @@ if (PHP_XCACHE != "no") {
else {
ADD_FLAG("XCACHE_ENABLE_TEST", "");
}
// }}}
XCACHE_PROC_SOURCES=glob(srcdir + "\\processor\\*.m4").join(' ');
ADD_FLAG("XCACHE_PROC_SOURCES", XCACHE_PROC_SOURCES);
// {{{ check for xcache-test
ARG_ENABLE("xcache-dprint", "XCache: Enable self debug print functions - FOR DEVELOPERS ONLY!!", "no");
if (PHP_XCACHE_TEST != "no") {
AC_DEFINE("HAVE_XCACHE_TEST", 1, "Define to enable XCache debug print functions");
}
// }}}
// {{{ check for opcode_spec_def.h
STDOUT.Write("Checking if you have opcode_spec_def.h for XCache ... ");

@ -118,6 +118,12 @@ define(`DEF_HASH_TABLE_FUNC', `
}
dst->arBuckets[n] = pnew;
')
IFDPRINT(`
INDENT()
fprintf(stderr, "$2:\"");
xc_dprint_str_len(BUCKET_KEY_S(b), BUCKET_KEY_SIZE(b));
fprintf(stderr, "\" %d:h=%lu", BUCKET_KEY_SIZE(b), b->h);
')
if (sizeof(void *) == sizeof($2)) {
IFCOPY(`pnew->pData = &pnew->pDataPtr;')
dnl no alloc

@ -76,7 +76,7 @@ struct _xc_processor_t {
IFASSERT(xc_stack_t allocsizes;)
};
/* }}} */
#ifdef XCACHE_HAVE_DPRINT
#ifdef HAVE_XCACHE_DPRINT
static void xc_dprint_indent(int indent) /* {{{ */
{
int i;
@ -84,8 +84,22 @@ static void xc_dprint_indent(int indent) /* {{{ */
fprintf(stderr, " ");
}
}
#endif
/* }}} */
static void xc_dprint_str_len(const char *str, int len) /* {{{ */
{
const unsigned char *p = str;
int i;
for (i = 0; i < len; i ++) {
if (p[i] < 32 || p[i] == 127) {
fprintf(stderr, "\\%03o", (unsigned int) p[i]);
}
else {
fputc(p[i], stderr);
}
}
}
/* }}} */
#endif
/* {{{ xc_zstrlen_char */
static inline int xc_zstrlen_char(zstr s)
{
@ -401,7 +415,7 @@ zval *xc_processor_restore_zval(zval *dst, const zval *src TSRMLS_DC) {
}
/* }}} */
/* export: void xc_dprint(xc_entry_t *src, int indent TSRMLS_DC); :export {{{ */
#ifdef XCACHE_HAVE_DPRINT
#ifdef HAVE_XCACHE_DPRINT
void xc_dprint(xc_entry_t *src, int indent TSRMLS_DC) {
IFDPRINT(`INDENT()`'fprintf(stderr, "xc_entry_t:src");')
xc_dprint_xc_entry_t(src, indent TSRMLS_CC);

@ -195,6 +195,7 @@ DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
IFCOPY(`
dnl fprintf(stderr, "copy from %p to %p\n", src[0], dst[0]);
')
IFDPRINT(`INDENT()`'fprintf(stderr, "[%p]", src[0]);')
STRUCT_P_EX(zval, dst[0], src[0], `[0]', `', ` ')
} while (0);
')
@ -746,6 +747,7 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_var_t', , `dnl {{{
}
}
')
IFDPRINT(`INDENT()`'fprintf(stderr, "zval:value");')
STRUCT_P_EX(zval_ptr, dst->value, src->value, `value', `', `&')
DONE(value)
')

@ -40,7 +40,9 @@ define(`PROC_STRING_N_EX', `
INIT_ZVAL(zv);
ZVAL_UNICODEL(&zv, (UChar *) ($2), $3 - 1, 1);
zend_make_printable_zval(&zv, &reszv, &usecopy);
fprintf(stderr, "string:%s:\t\"%s\" len=%d\n", "$1", reszv.value.str.val, $3 - 1);
fprintf(stderr, "string:%s:\t\"", "$1");
xc_dprint_str_len(Z_STRVAL(reszv), Z_STRLEN(reszv));
fprintf(stderr, "\" len=%d\n", $3 - 1);
if (usecopy) {
zval_dtor(&reszv);
}
@ -48,7 +50,9 @@ define(`PROC_STRING_N_EX', `
} while (0);
#endif
', `
fprintf(stderr, "string:%s:\t\"%s\" len=%d\n", "$1", SRCPTR, $3 - 1);
fprintf(stderr, "string:%s:\t\"", "$1");
xc_dprint_str_len(SRCPTR, $3 - 1);
fprintf(stderr, "\" len=%d\n", $3 - 1);
')
')
IFCALC(`xc_calc_string_n(processor, ISTYPE, SRCSTR, $3 IFASSERT(`, __LINE__'));')

@ -145,12 +145,12 @@ dnl {{{ STRUCT_P(1:type, 2:elm, 3:name=type)
define(`STRUCT_P', `
DBG(`$0($*)')
if (src->$2) {
STRUCT_P_EX(`$1', `dst->$2', `src->$2', `$2', `$3')
IFDPRINT(`INDENT()`'fprintf(stderr, "$1:$2");')
STRUCT_P_EX(`$1', `dst->$2', `src->$2', `$2', `$3')
}
else {
COPYNULL_EX(`dst->$2', `$2')
IFDPRINT(`INDENT()`'fprintf(stderr, "$1:$2:\tNULL\n");')
COPYNULL_EX(`dst->$2', `$2')
}
DONE(`$2')
')

@ -1,6 +1,7 @@
#if 0
#define DEBUG
#define SHOW_DPRINT
#endif
/* {{{ macros */
@ -1014,6 +1015,9 @@ static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) /
xc_foreach_early_binding_class(php.op_array, xc_cache_early_binding_class_cb, (void *) &php TSRMLS_CC);
xc_redo_pass_two(php.op_array TSRMLS_CC);
/* }}} */
#ifdef SHOW_DPRINT
xc_dprint(&xce, 0 TSRMLS_CC);
#endif
ENTER_LOCK_EX(cache) { /* {{{ store/add entry */
stored_xce = xc_entry_store_dmz(&xce TSRMLS_CC);
} LEAVE_LOCK_EX(cache);
@ -1074,6 +1078,9 @@ restore:
fprintf(stderr, "restoring\n");
#endif
xc_processor_restore_xc_entry_t(&xce, stored_xce, xc_readonly_protection TSRMLS_CC);
#ifdef SHOW_DPRINT
xc_dprint(&xce, 0 TSRMLS_CC);
#endif
catched = 0;
zend_try {

Loading…
Cancel
Save