1
0
Fork 0

processor: code clean up

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1475 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
Xuefer 2013-11-13 08:20:22 +00:00
parent 7c5c7c2161
commit 99c25466e4
2 changed files with 19 additions and 8 deletions

View File

@ -241,8 +241,8 @@ define(`IFCALCSTORE', `IFSTORE(`$1', `IFCALC(`$1', `$2')')')
define(`IFRESTORE', `ifelse(PROCESSOR_TYPE, `restore', `$1', `$2')')
define(`IFCOPY', `IFSTORE(`$1', `IFRESTORE(`$1', `$2')')')
define(`IFCALCCOPY', `IFCALC(`$1', `IFCOPY(`$1', `$2')')')
define(`IFRELOCATEONLY', `ifelse(PROCESSOR_TYPE, `relocate', `$1', `$2')')
define(`IFRELOCATE', `IFSTORE(`$1', `IFRELOCATEONLY(`$1', `$2')')')
define(`PROCRELOCATE', `ifelse(PROCESSOR_TYPE, `relocate', `$1', `$2')')
define(`IFRELOCATE', `ifelse(defn(`RELOCATE_EX'), `', `$2', `$1')')
define(`IFDPRINT', `ifelse(PROCESSOR_TYPE, `dprint', `$1', `$2')')
define(`IFDASM', `ifelse(PROCESSOR_TYPE, `dasm', `$1', `$2')')
dnl }}}
@ -258,25 +258,36 @@ include(__dir__`/struct.m4')
include(__dir__`/process.m4')
include(__dir__`/head.m4')
REDEF(`PROCESSOR_TYPE', `calc') include(__dir__`/processor.m4')
dnl ==== calc ====
REDEF(`PROCESSOR_TYPE', `calc')
include(__dir__`/processor.m4')
dnl ==== store ====
pushdef(`RELOCATE_EX', `$2 = ptradd($1 *, notnullable($2), processor->relocatediff);')
REDEF(`PROCESSOR_TYPE', `store') include(__dir__`/processor.m4')
REDEF(`PROCESSOR_TYPE', `store')
include(__dir__`/processor.m4')
popdef(`RELOCATE_EX')
REDEF(`PROCESSOR_TYPE', `restore') include(__dir__`/processor.m4')
dnl ==== restore ====
REDEF(`PROCESSOR_TYPE', `restore')
include(__dir__`/processor.m4')
dnl ==== relocate ====
pushdef(`PTR_FROM_VIRTUAL_EX', `ptradd($1 *, notnullable($2), ptrdiff)')
pushdef(`RELOCATE_EX', `$2 = ptradd($1 *, notnullable($2), relocatediff);')
pushdef(`SRC', defn(`DST'))
REDEF(`PROCESSOR_TYPE', `relocate') include(__dir__`/processor.m4')
REDEF(`PROCESSOR_TYPE', `relocate')
include(__dir__`/processor.m4')
popdef(`SRC')
popdef(`RELOCATE_EX')
popdef(`PTR_FROM_VIRTUAL_EX')
dnl ==== dprint ====
#ifdef HAVE_XCACHE_DPRINT
REDEF(`PROCESSOR_TYPE', `dprint') include(__dir__`/processor.m4')
#endif /* HAVE_XCACHE_DPRINT */
dnl ==== dasm ====
#ifdef HAVE_XCACHE_DISASSEMBLER
REDEF(`PROCESSOR_TYPE', `dasm') include(__dir__`/processor.m4')
#endif /* HAVE_XCACHE_DISASSEMBLER */

View File

@ -14,7 +14,7 @@ define(`DECL_STRUCT_P_FUNC', `translit(
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')
IFRELOCATEONLY(`$1 *const dst, ptrdiff_t ptrdiff, ptrdiff_t relocatediff')
PROCRELOCATE(`$1 *const dst, ptrdiff_t ptrdiff, ptrdiff_t relocatediff')
IFDASM(`xc_dasm_t *dasm, zval *dst, const $1 * const src')
TSRMLS_DC
)ifelse(`$3', `', `;')
@ -147,7 +147,7 @@ ifdef(`DASM_STRUCT_DIRECT', `', `
IFCALC( `processor, $6 $3')
IFSTORE( `processor, $6 $2, $6 $3')
IFRESTORE(`processor, $6 $2, $6 $3')
IFRELOCATEONLY(`
PROCRELOCATE(`
ifelse(`$6', `', `PTR_FROM_VIRTUAL_EX(`$1', `$3')', `$6 $3')
, ptrdiff
, relocatediff