summaryrefslogtreecommitdiff
path: root/processor
diff options
context:
space:
mode:
authorXuefer <xuefer@gmail.com>2013-11-13 04:01:47 +0000
committerXuefer <xuefer@gmail.com>2013-11-13 04:01:47 +0000
commitfab2b53da67e06509db47c0f7f87edd6f0f868d1 (patch)
tree3ca46064de2acffb17137b43a0398018c0a8a47f /processor
parente317146c8bc808bfcbe0f695b11c5ea0000e75be (diff)
downloadxcache-fab2b53da67e06509db47c0f7f87edd6f0f868d1.tar.gz
xcache-fab2b53da67e06509db47c0f7f87edd6f0f868d1.zip
relocate: rename marcos to relocate
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1471 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
Diffstat (limited to 'processor')
-rw-r--r--processor/hashtable.m428
-rw-r--r--processor/main.m429
-rw-r--r--processor/processor.m418
-rw-r--r--processor/string.m42
-rw-r--r--processor/struct.m410
5 files changed, 42 insertions, 45 deletions
diff --git a/processor/hashtable.m4 b/processor/hashtable.m4
index 444efc4..93a0820 100644
--- a/processor/hashtable.m4
+++ b/processor/hashtable.m4
@@ -47,7 +47,7 @@ define(`DEF_HASH_TABLE_FUNC', `DEF_STRUCT_P_FUNC(`HashTable', `$1', `
', ` dnl IFDASM else
dnl }}}
Bucket *srcBucket;
- IFFIXPOINTER(`Bucket *next;')
+ IFRELOCATE(`Bucket *next;')
IFRELOCATE(`Bucket *dstBucket = NULL;')
IFCOPY(`Bucket *dstBucket = NULL, *first = NULL, *last = NULL;')
dnl only used for copy
@@ -74,7 +74,7 @@ define(`DEF_HASH_TABLE_FUNC', `DEF_STRUCT_P_FUNC(`HashTable', `$1', `
CALLOC(`DST(`arBuckets')', Bucket*, SRC(`nTableSize'))
DONE(arBuckets)
DISABLECHECK(`
- for (srcBucket = SRCPTR_EX(`Bucket', SRC(`pListHead')); srcBucket != NULL; srcBucket = SRCPTR_EX(`Bucket', `srcBucket->pListNext')) {
+ for (srcBucket = UNRELOCATED_EX(`Bucket', SRC(`pListHead')); srcBucket != NULL; srcBucket = UNRELOCATED_EX(`Bucket', `srcBucket->pListNext')) {
IFCALCCOPY(`bucketSize = BUCKET_SIZE(srcBucket);')
ALLOC(dstBucket, char, bucketSize, , Bucket)
IFCOPY(`
@@ -110,7 +110,7 @@ define(`DEF_HASH_TABLE_FUNC', `DEF_STRUCT_P_FUNC(`HashTable', `$1', `
IFRELOCATE(`srcBucket->pData = &srcBucket->pDataPtr;')
dnl $6 = ` ' to skip alloc, skip pointer fix
STRUCT_P_EX(`$2', dstBucket->pData, (($2*)srcBucket->pData), `', `$3', ` ')
- FIXPOINTER_EX(`$2', dstBucket->pData)
+ RELOCATE_EX(`$2', dstBucket->pData)
}
else {
STRUCT_P_EX(`$2', dstBucket->pData, (($2*)srcBucket->pData), `', `$3')
@@ -144,34 +144,34 @@ define(`DEF_HASH_TABLE_FUNC', `DEF_STRUCT_P_FUNC(`HashTable', `$1', `
IFCOPY(`DST(`pListHead') = first;') DONE(pListHead)
IFCOPY(`DST(`pListTail') = dstBucket;') DONE(pListTail)
- IFFIXPOINTER(`
+ IFRELOCATE(`
for (n = 0; n < SRC(`nTableSize'); ++n) {
if (SRC(`arBuckets[n]')) {
- next = DSTPTR_EX(`Bucket', `DST(`arBuckets[n]')');
+ next = UNRELOCATED_EX(`Bucket', `DST(`arBuckets[n]')');
do {
dstBucket = next;
- next = DSTPTR_EX(`Bucket', `next->pNext');
+ next = UNRELOCATED_EX(`Bucket', `next->pNext');
if (dstBucket->pListLast) {
- FIXPOINTER_EX(Bucket, dstBucket->pListLast)
+ RELOCATE_EX(Bucket, dstBucket->pListLast)
}
if (dstBucket->pListNext) {
- FIXPOINTER_EX(Bucket, dstBucket->pListNext)
+ RELOCATE_EX(Bucket, dstBucket->pListNext)
}
if (dstBucket->pNext) {
- FIXPOINTER_EX(Bucket, dstBucket->pNext)
+ RELOCATE_EX(Bucket, dstBucket->pNext)
}
if (dstBucket->pLast) {
- FIXPOINTER_EX(Bucket, dstBucket->pLast)
+ RELOCATE_EX(Bucket, dstBucket->pLast)
}
} while (next);
- FIXPOINTER(Bucket, arBuckets[n])
+ RELOCATE(Bucket, arBuckets[n])
}
}
')
- FIXPOINTER(Bucket, pListHead)
- FIXPOINTER(Bucket, pListTail)
- FIXPOINTER(Bucket *, arBuckets)
+ RELOCATE(Bucket, pListHead)
+ RELOCATE(Bucket, pListTail)
+ RELOCATE(Bucket *, arBuckets)
#ifdef ZEND_ENGINE_2_4
}
else { /* if (SRC(`nTableMask')) */
diff --git a/processor/main.m4 b/processor/main.m4
index b41f2bb..c26d7e9 100644
--- a/processor/main.m4
+++ b/processor/main.m4
@@ -24,11 +24,8 @@ define(`DST', `ifelse(`$1', `', `dst', `dst->$1')')
dnl ============
define(`INDENT', `xc_dprint_indent(indent);')
dnl }}}
-dnl {{{ SRCPTR_EX(1:type, 2:elm)
-define(`SRCPTR_EX', `DSTPTR_EX(`$1', `$2')')
-dnl }}}
-dnl {{{ DSTPTR_EX(1:type, 2:elm)
-define(`DSTPTR_EX', `$2')
+dnl {{{ UNRELOCATED_EX(1:type, 2:elm)
+define(`UNRELOCATED_EX', `$2')
dnl }}}
dnl {{{ ALLOC(1:dst, 2:type, 3:count=1, 4:clean=false, 5:realtype=$2)
define(`ALLOC', `
@@ -135,11 +132,11 @@ dnl }}}
dnl {{{ EXPORT_PROCESSOR(1:type, 2:processor)
define(`EXPORT_PROCESSOR', `define(`EXPORT_$1_$2', 1)')
dnl }}}
-dnl {{{ FIXPOINTER(1:type, 2:ele)
-define(`FIXPOINTER', `FIXPOINTER_EX(`$1', `DST(`$2')')')
+dnl {{{ RELOCATE(1:type, 2:ele)
+define(`RELOCATE', `RELOCATE_EX(`$1', `DST(`$2')')')
dnl }}}
-dnl {{{ FIXPOINTER_EX(1:type, 2:dst)
-define(`FIXPOINTER_EX', `')
+dnl {{{ RELOCATE_EX(1:type, 2:dst)
+define(`RELOCATE_EX', `')
dnl }}}
dnl {{{ IFNOTMEMCPY
define(`IFNOTMEMCPY', `ifdef(`USEMEMCPY', `', `$1')')
@@ -241,7 +238,7 @@ define(`IFRESTORE', `ifelse(PROCESSOR_TYPE, `restore', `$1', `$2')')
define(`IFCOPY', `IFSTORE(`$1', `IFRESTORE(`$1', `$2')')')
define(`IFCALCCOPY', `IFCALC(`$1', `IFCOPY(`$1', `$2')')')
define(`IFRELOCATE', `ifelse(PROCESSOR_TYPE, `relocate', `$1', `$2')')
-define(`IFFIXPOINTER', `IFSTORE(`$1', `IFRELOCATE(`$1', `$2')')')
+define(`IFRELOCATE', `IFSTORE(`$1', `IFRELOCATE(`$1', `$2')')')
define(`IFDPRINT', `ifelse(PROCESSOR_TYPE, `dprint', `$1', `$2')')
define(`IFDASM', `ifelse(PROCESSOR_TYPE, `dasm', `$1', `$2')')
dnl }}}
@@ -259,19 +256,19 @@ include(srcdir`/processor/head.m4')
REDEF(`PROCESSOR_TYPE', `calc') include(srcdir`/processor/processor.m4')
-pushdef(`FIXPOINTER_EX', `$2 = ptradd($1 *, notnullable($2), processor->relocatediff);')
+pushdef(`RELOCATE_EX', `$2 = ptradd($1 *, notnullable($2), processor->relocatediff);')
REDEF(`PROCESSOR_TYPE', `store') include(srcdir`/processor/processor.m4')
-popdef(`FIXPOINTER_EX')
+popdef(`RELOCATE_EX')
REDEF(`PROCESSOR_TYPE', `restore') include(srcdir`/processor/processor.m4')
-pushdef(`DSTPTR_EX', `ptradd($1 *, notnullable($2), ptrdiff)')
-pushdef(`FIXPOINTER_EX', `$2 = ptradd($1 *, notnullable($2), relocatediff);')
+pushdef(`UNRELOCATED_EX', `ptradd($1 *, notnullable($2), ptrdiff)')
+pushdef(`RELOCATE_EX', `$2 = ptradd($1 *, notnullable($2), relocatediff);')
pushdef(`SRC', defn(`DST'))
REDEF(`PROCESSOR_TYPE', `relocate') include(srcdir`/processor/processor.m4')
popdef(`SRC')
-popdef(`FIXPOINTER_EX')
-popdef(`DSTPTR_EX')
+popdef(`RELOCATE_EX')
+popdef(`UNRELOCATED_EX')
#ifdef HAVE_XCACHE_DPRINT
REDEF(`PROCESSOR_TYPE', `dprint') include(srcdir`/processor/processor.m4')
diff --git a/processor/processor.m4 b/processor/processor.m4
index ffc371e..e483d78 100644
--- a/processor/processor.m4
+++ b/processor/processor.m4
@@ -193,7 +193,7 @@ DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
zval_ptr pzv = (zval_ptr)-1;
', `
zval_ptr pzv = DST()[0];
- FIXPOINTER_EX(zval, pzv)
+ RELOCATE_EX(zval, pzv)
')
if (zend_hash_add(&processor->zvalptrs, (char *) &SRC()[0], sizeof(SRC()[0]), (void *) &pzv, sizeof(pzv), NULL) == SUCCESS) { /* first add, go on */
dnl fprintf(stderr, "mark[%p] = %p\n", SRC()[0], pzv);
@@ -208,7 +208,7 @@ DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
')
IFDPRINT(`INDENT()`'fprintf(stderr, "[%p] ", (void *) SRC()[0]);')
STRUCT_P_EX(zval, DST()[0], SRC()[0], `[0]', `', ` ')
- FIXPOINTER_EX(zval, DST()[0])
+ RELOCATE_EX(zval, DST()[0])
} while (0);
')
DONE_SIZE(sizeof(zval_ptr))
@@ -334,7 +334,7 @@ DEF_STRUCT_P_FUNC(`zend_trait_alias_ptr', , `dnl {{{
', `
ALLOC(DST()[0], zend_trait_alias)
STRUCT_P_EX(zend_trait_alias, DST()[0], SRC()[0], `[0]', `', ` ')
- FIXPOINTER_EX(zend_trait_alias, DST()[0])
+ RELOCATE_EX(zend_trait_alias, DST()[0])
')
DONE_SIZE(sizeof(zend_trait_alias))
')
@@ -347,7 +347,7 @@ DEF_STRUCT_P_FUNC(`zend_trait_precedence_ptr', , `dnl {{{
', `
ALLOC(DST()[0], zend_trait_precedence)
STRUCT_P_EX(zend_trait_precedence, DST()[0], SRC()[0], `[0]', `', ` ')
- FIXPOINTER_EX(zend_trait_precedence, DST()[0])
+ RELOCATE_EX(zend_trait_precedence, DST()[0])
')
DONE_SIZE(sizeof(zend_trait_precedence))
')
@@ -672,7 +672,7 @@ DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{
Z_OP(DST(`op1')).jmp_addr = processor->active_op_array_dst->opcodes + (Z_OP(SRC(`op1')).jmp_addr - processor->active_op_array_src->opcodes);
assert(Z_OP(DST(`op1')).jmp_addr >= processor->active_op_array_dst->opcodes);
assert(Z_OP(DST(`op1')).jmp_addr - processor->active_op_array_dst->opcodes < processor->active_op_array_dst->last);
- FIXPOINTER_EX(zend_op, `Z_OP(DST(`op1')).jmp_addr')
+ RELOCATE_EX(zend_op, `Z_OP(DST(`op1')).jmp_addr')
break;
case ZEND_JMPZ:
@@ -690,7 +690,7 @@ DEF_STRUCT_P_FUNC(`zend_op', , `dnl {{{
Z_OP(DST(`op2')).jmp_addr = processor->active_op_array_dst->opcodes + (Z_OP(SRC(`op2')).jmp_addr - processor->active_op_array_src->opcodes);
assert(Z_OP(DST(`op2')).jmp_addr >= processor->active_op_array_dst->opcodes);
assert(Z_OP(DST(`op2')).jmp_addr - processor->active_op_array_dst->opcodes < processor->active_op_array_dst->last);
- FIXPOINTER_EX(zend_op, `Z_OP(DST(`op2')).jmp_addr')
+ RELOCATE_EX(zend_op, `Z_OP(DST(`op2')).jmp_addr')
break;
default:
@@ -882,12 +882,12 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
dnl SETNULL(u_twin)
#endif
- IFSTORE(`pushdef(`FIXPOINTER_EX')')
+ IFSTORE(`pushdef(`RELOCATE_EX')')
STRUCT_P(zend_uint, refcount)
IFSTORE(`
- popdef(`FIXPOINTER_EX')
+ popdef(`RELOCATE_EX')
DST(`refcount[0]') = 1;
- FIXPOINTER(zend_uint, refcount)
+ RELOCATE(zend_uint, refcount)
')
#ifdef ZEND_ENGINE_2_4
diff --git a/processor/string.m4 b/processor/string.m4
index c7e210b..6653912 100644
--- a/processor/string.m4
+++ b/processor/string.m4
@@ -63,7 +63,7 @@ define(`PROC_STRING_N_EX', `
IFRESTORE(`
DSTPTR = ifdef(`REALPTRTYPE', `(REALPTRTYPE() *)') STRDUP() (SRCPTR, ($3) - 1);
')
- FIXPOINTER_EX(ifdef(`REALPTRTYPE', `REALPTRTYPE()', `PTRTYPE'), DSTPTR)
+ RELOCATE_EX(ifdef(`REALPTRTYPE', `REALPTRTYPE()', `PTRTYPE'), DSTPTR)
IFDASM(`
ifelse(STRTYPE,zstr_uchar, `
add_assoc_unicodel_ex(dst, XCACHE_STRS("$4"), ZSTR_U($2), $3-1, 1);
diff --git a/processor/struct.m4 b/processor/struct.m4
index 1924484..cc6293e 100644
--- a/processor/struct.m4
+++ b/processor/struct.m4
@@ -148,7 +148,7 @@ ifdef(`DASM_STRUCT_DIRECT', `', `
IFSTORE( `processor, $6 $2, $6 $3')
IFRESTORE(`processor, $6 $2, $6 $3')
IFRELOCATE(`
- ifelse(`$6', `', `DSTPTR_EX(`$1', `$3')', `$6 $3')
+ ifelse(`$6', `', `UNRELOCATED_EX(`$1', `$3')', `$6 $3')
, ptrdiff
, relocatediff
')
@@ -162,7 +162,7 @@ ifdef(`DASM_STRUCT_DIRECT', `', `
')
')
popdef(`FUNC_NAME')
- ifelse(`$6', , `FIXPOINTER_EX(`$1', `$2')')
+ ifelse(`$6', , `RELOCATE_EX(`$1', `$2')')
')
dnl }}}
dnl {{{ STRUCT_P(1:type, 2:elm, 3:name=type)
@@ -232,16 +232,16 @@ define(`STRUCT_ARRAY', `
++LOOPCOUNTER) {
DISABLECHECK(`
pushdef(`ALLOC')
- pushdef(`FIXPOINTER_EX')
+ pushdef(`RELOCATE_EX')
STRUCT_P_EX(`$3', (DST(`$4') + LOOPCOUNTER), (SRC(`$4') + LOOPCOUNTER), `', `$5')
- popdef(`FIXPOINTER_EX')
+ popdef(`RELOCATE_EX')
popdef(`ALLOC')
')
}
dnl the end marker
ifelse(`$2', `', `IFCOPY(`DST(`$4[LOOPCOUNTER]') = NULL;')')
')dnl IFDASM
- FIXPOINTER(`$3', `$4')
+ RELOCATE(`$3', `$4')
DONE(`$4')
popdef(`FUNC_NAME')
popdef(`LOOPCOUNTER')