Browse Source

rename ptrmove to relocate, reduce export to only necessary onces

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1442 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
master
Xuefer 8 years ago
parent
commit
48a80d76ee
  1. 21
      processor/head.m4
  2. 44
      processor/main.m4
  3. 21
      processor/struct.m4

21
processor/head.m4

@ -114,7 +114,7 @@ struct _xc_processor_t {
IFAUTOCHECK(xc_stack_t allocsizes;)
};
/* }}} */
/* export: typedef struct _xc_ptrmove_t { ptrdiff_t src; ptrdiff_t ptrdiff; } xc_ptrmove_t; :export {{{ */
/* export: typedef struct _xc_relocate_t { ptrdiff_t src; ptrdiff_t dst; ptrdiff_t ptrdiff; } xc_relocate_t; :export {{{ */
/* }}} */
/* export: typedef struct _xc_dasm_t { const zend_op_array *active_op_array_src; } xc_dasm_t; :export {{{ */
/* }}} */
@ -512,16 +512,6 @@ xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php
return dst;
}
/* }}} */
/* export: xc_entry_var_t *xc_processor_restore_xc_entry_var_t(xc_entry_var_t *dst, const xc_entry_var_t *src TSRMLS_DC); :export {{{ */
xc_entry_var_t *xc_processor_restore_xc_entry_var_t(xc_entry_var_t *dst, const xc_entry_var_t *src TSRMLS_DC) {
xc_processor_t processor;
memset(&processor, 0, sizeof(processor));
xc_restore_xc_entry_var_t(&processor, dst, src TSRMLS_CC);
return dst;
}
/* }}} */
/* export: zval *xc_processor_restore_zval(zval *dst, const zval *src, zend_bool have_references TSRMLS_DC); :export {{{ */
zval *xc_processor_restore_zval(zval *dst, const zval *src, zend_bool have_references TSRMLS_DC) {
xc_processor_t processor;
@ -542,6 +532,15 @@ zval *xc_processor_restore_zval(zval *dst, const zval *src, zend_bool have_refer
return dst;
}
/* }}} */
define(`DEFINE_RELOCATE_API', `
/* export: void xc_processor_relocate_$1(int a TSRMLS_DC); :export {{{ */
void xc_processor_relocate_$1(int a TSRMLS_DC) {
}
/* }}} */
')
DEFINE_RELOCATE_API(`xc_entry_var_t')
DEFINE_RELOCATE_API(`xc_entry_php_t')
DEFINE_RELOCATE_API(`xc_entry_data_php_t')
/* export: void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC); :export {{{ */
#ifdef HAVE_XCACHE_DPRINT
void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC) {

44
processor/main.m4

@ -26,11 +26,11 @@ define(`INDENT', `xc_dprint_indent(indent);')
dnl }}}
dnl {{{ SRCPTR(1:type, 2:elm)
define(`SRCPTR', `SRCPTR_EX(`$1', `SRC(`$2')')')
define(`SRCPTR_EX', `IFPTRMOVE(`(($1 *) (((char *) $2) + ptrmove->src))', `$2')')
define(`SRCPTR_EX', `IFPTRMOVE(`(($1 *) (((char *) $2) + relocate->src))', `$2')')
dnl }}}
dnl {{{ SRCPTR(1:type, 2:elm)
dnl {{{ DSTPTR(1:type, 2:elm)
define(`DSTPTR', `DSTPTR_EX(`$1', `DST(`$2')')')
define(`DSTPTR_EX', `SRCPTR_EX($@)')
define(`DSTPTR_EX', `IFPTRMOVE(`(($1 *) (((char *) $2) + relocate->dst))', `$2')')
dnl }}}
dnl {{{ ALLOC(1:dst, 2:type, 3:count=1, 4:clean=false, 5:realtype=$2)
define(`ALLOC', `
@ -127,8 +127,8 @@ define(`DBG', `ifdef(`XCACHE_ENABLE_TEST', `
/* `$1' */
')')
dnl }}}
dnl {{{ EXPORT
define(`EXPORT', `define(`EXPORT_$1')')
dnl {{{ EXPORT(1:type, 2:processor)
define(`EXPORT', `define(`EXPORT_$1_$2', 1)')
dnl }}}
dnl {{{ FIXPOINTER(1:type, 2:ele)
define(`FIXPOINTER', `FIXPOINTER_EX(`$1', `DST(`$2')', `SRCPTR(`$1', `$2')')')
@ -136,7 +136,7 @@ dnl }}}
dnl {{{ FIXPOINTER_EX(1:type, 2:dst, 3:src)
define(`FIXPOINTER_EX', `
IFSTORE(`$2 = ($1 *) processor->shm->handlers->to_readonly(processor->shm, (void *)$2);')
IFPTRMOVE(`$2 = ($1 *) (((char *) $3) + ptrmove->ptrdiff);')
IFPTRMOVE(`$2 = ($1 *) (((char *) $3) + relocate->ptrdiff);')
')
dnl }}}
dnl {{{ IFNOTMEMCPY
@ -236,24 +236,30 @@ define(`IFCALC', `ifelse(PROCESSOR_TYPE, `calc', `$1', `$2')')
define(`IFSTORE', `ifelse(PROCESSOR_TYPE, `store', `$1', `$2')')
define(`IFCALCSTORE', `IFSTORE(`$1', `IFCALC(`$1', `$2')')')
define(`IFRESTORE', `ifelse(PROCESSOR_TYPE, `restore', `$1', `$2')')
define(`IFPTRMOVE', `ifelse(PROCESSOR_TYPE, `ptrmove', `$1', `$2')')
define(`IFPTRMOVE', `ifelse(PROCESSOR_TYPE, `relocate', `$1', `$2')')
define(`IFCOPY', `IFSTORE(`$1', `IFRESTORE(`$1', `$2')')')
define(`IFCALCCOPY', `IFCALC(`$1', `IFCOPY(`$1', `$2')')')
define(`IFDPRINT', `ifelse(PROCESSOR_TYPE, `dprint', `$1', `$2')')
define(`IFDASM', `ifelse(PROCESSOR_TYPE, `dasm', `$1', `$2')')
dnl }}}
EXPORT(`zend_op')
EXPORT(`zend_op_array')
EXPORT(`zend_function')
EXPORT(`HashTable_zend_function')
EXPORT(`zend_class_entry')
EXPORT(`xc_classinfo_t')
EXPORT(`xc_funcinfo_t')
EXPORT(`xc_entry_var_t')
EXPORT(`xc_entry_php_t')
EXPORT(`xc_entry_data_php_t')
EXPORT(`zval')
EXPORT(`dasm', `zend_op_array')
EXPORT(`dasm', `zend_function')
EXPORT(`dasm', `zend_class_entry')
EXPORT(`calc', `xc_entry_data_php_t')
EXPORT(`calc', `xc_entry_php_t')
EXPORT(`calc', `xc_entry_var_t')
EXPORT(`store', `xc_entry_data_php_t')
EXPORT(`store', `xc_entry_php_t')
EXPORT(`store', `xc_entry_var_t')
EXPORT(`restore', `xc_entry_data_php_t')
EXPORT(`restore', `xc_entry_php_t')
EXPORT(`dasm', `xc_entry_data_php_t')
EXPORT(`dprint', `xc_entry_php_t')
EXPORT(`restore', `zval')
EXPORT(`dprint', `zval')
include(srcdir`/processor/hashtable.m4')
include(srcdir`/processor/string.m4')
@ -264,7 +270,7 @@ include(srcdir`/processor/head.m4')
REDEF(`PROCESSOR_TYPE', `calc') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `store') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `restore') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `ptrmove') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `relocate') include(srcdir`/processor/processor.m4')
#ifdef HAVE_XCACHE_DPRINT
REDEF(`PROCESSOR_TYPE', `dprint') include(srcdir`/processor/processor.m4')

21
processor/struct.m4

@ -4,14 +4,17 @@ define(`pushdefFUNC_NAME', `
dnl {{{ DECL_STRUCT_P_FUNC(1:type, 2:name, 3:comma=;)
define(`DECL_STRUCT_P_FUNC', `translit(
pushdefFUNC_NAME(`$1', `$2')
define(`DEFINED_'ifelse(`$2', `', `$1', `$2'), `')
ifdef(`EXPORT_'ifelse(`$2', `', `$1', `$2'), `void', `static void inline')
pushdef(`type', `ifelse(`$2', `', `$1', `$2')')
define(`DEFINED_'type, `')
ifelse(ifdef(`EXPORT_'PROCESSOR_TYPE`_'type,1)ifdef(`EXPORT_'PROCESSOR_TYPE`_',1)ifdef(`EXPORT__'type,1), `', `static void inline',
`', `', `void')
popdef(`type')
FUNC_NAME`'(
IFDPRINT( `const $1 * const src, int indent')
IFCALC( `xc_processor_t *processor, const $1 * const src')
IFSTORE( `xc_processor_t *processor, $1 *dst, const $1 * const src')
IFRESTORE(`xc_processor_t *processor, $1 *dst, const $1 * const src')
IFPTRMOVE(`const xc_ptrmove_t *ptrmove, $1 * const dst, const $1 * const src')
IFPTRMOVE(`const xc_relocate_t *relocate, $1 * const dst, const $1 * const src')
IFDASM( `xc_dasm_t *dasm, zval *dst, const $1 * const src')
TSRMLS_DC
)ifelse(`$3', `', `;')
@ -23,10 +26,12 @@ dnl {{{ DEF_STRUCT_P_FUNC(1:type, 2:name, 3:body)
define(`DEF_STRUCT_P_FUNC', `
pushdefFUNC_NAME(`$1', `$2')
/* {`{'{ FUNC_NAME */
ifdef(`EXPORT_'ifelse(`$2', `', `$1', `$2'), `
/* export: DECL_STRUCT_P_FUNC(`$1', `$2') :export */
')
DECL_STRUCT_P_FUNC(`$1', `$2', 1)
pushdef(`type', `ifelse(`$2', `', `$1', `$2')')
define(`DEFINED_'type, `')
ifelse(ifdef(`EXPORT_'PROCESSOR_TYPE`_'type,1)ifdef(`EXPORT_'PROCESSOR_TYPE`_',1)ifdef(`EXPORT__'type,1), `', `',
`', `', `/* export: DECL_STRUCT_P_FUNC(`$1', `$2') :export */')
popdef(`type')
DECL_STRUCT_P_FUNC(`$1', `$2', ` ')
{
pushdef(`ELEMENTS_DONE')
IFAUTOCHECK(`
@ -143,7 +148,7 @@ ifdef(`DASM_STRUCT_DIRECT', `', `
IFSTORE( `processor, $6 $2, $6 $3')
IFRESTORE(`processor, $6 $2, $6 $3')
IFPTRMOVE(`
ptrmove
relocate
, ifelse(`$6', `', `DSTPTR_EX(`$1', `$2')', `$6 $2')
, ifelse(`$6', `', `SRCPTR_EX(`$1', `$3')', `$6 $3')
')

Loading…
Cancel
Save