summaryrefslogtreecommitdiff
path: root/processor
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2013-11-13 08:20:22 +0000
committerXuefer <xuefer@gmail.com>2013-11-13 08:20:22 +0000
commit99c25466e4ceb8a100d0f185a766dbe925cddb4b (patch)
tree6c3e0222404e1753d79b1275e4ebaf58f4a28640 /processor
parent7c5c7c2161d2113225ab41a7379d3aa917cb6d30 (diff)
downloadxcache-99c25466e4ceb8a100d0f185a766dbe925cddb4b.tar.gz
xcache-99c25466e4ceb8a100d0f185a766dbe925cddb4b.zip
processor: code clean up
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1475 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'processor')
-rw-r--r--processor/main.m423
-rw-r--r--processor/struct.m44
2 files changed, 19 insertions, 8 deletions
diff --git a/processor/main.m4 b/processor/main.m4
index 1a9e98f..70b22eb 100644
--- a/processor/main.m4
+++ b/processor/main.m4
@@ -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 */
diff --git a/processor/struct.m4 b/processor/struct.m4
index fb2d7d1..f3076a4 100644
--- a/processor/struct.m4
+++ b/processor/struct.m4
@@ -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