Browse Source

relocate: marco name PTR_FROM_VIRTUAL_EX

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1472 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
master
Xuefer 8 years ago
parent
commit
ba88593733
  1. 6
      processor/hashtable.m4
  2. 8
      processor/main.m4
  3. 2
      processor/struct.m4

6
processor/hashtable.m4

@ -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 = UNRELOCATED_EX(`Bucket', SRC(`pListHead')); srcBucket != NULL; srcBucket = UNRELOCATED_EX(`Bucket', `srcBucket->pListNext')) {
for (srcBucket = PTR_FROM_VIRTUAL_EX(`Bucket', SRC(`pListHead')); srcBucket != NULL; srcBucket = PTR_FROM_VIRTUAL_EX(`Bucket', `srcBucket->pListNext')) {
IFCALCCOPY(`bucketSize = BUCKET_SIZE(srcBucket);')
ALLOC(dstBucket, char, bucketSize, , Bucket)
IFCOPY(`
@ -147,10 +147,10 @@ define(`DEF_HASH_TABLE_FUNC', `DEF_STRUCT_P_FUNC(`HashTable', `$1', `
IFRELOCATE(`
for (n = 0; n < SRC(`nTableSize'); ++n) {
if (SRC(`arBuckets[n]')) {
next = UNRELOCATED_EX(`Bucket', `DST(`arBuckets[n]')');
next = PTR_FROM_VIRTUAL_EX(`Bucket', `DST(`arBuckets[n]')');
do {
dstBucket = next;
next = UNRELOCATED_EX(`Bucket', `next->pNext');
next = PTR_FROM_VIRTUAL_EX(`Bucket', `next->pNext');
if (dstBucket->pListLast) {
RELOCATE_EX(Bucket, dstBucket->pListLast)
}

8
processor/main.m4

@ -24,8 +24,8 @@ define(`DST', `ifelse(`$1', `', `dst', `dst->$1')')
dnl ============
define(`INDENT', `xc_dprint_indent(indent);')
dnl }}}
dnl {{{ UNRELOCATED_EX(1:type, 2:elm)
define(`UNRELOCATED_EX', `$2')
dnl {{{ PTR_FROM_VIRTUAL_EX(1:type, 2:elm)
define(`PTR_FROM_VIRTUAL_EX', `$2')
dnl }}}
dnl {{{ ALLOC(1:dst, 2:type, 3:count=1, 4:clean=false, 5:realtype=$2)
define(`ALLOC', `
@ -262,13 +262,13 @@ popdef(`RELOCATE_EX')
REDEF(`PROCESSOR_TYPE', `restore') include(srcdir`/processor/processor.m4')
pushdef(`UNRELOCATED_EX', `ptradd($1 *, notnullable($2), ptrdiff)')
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(srcdir`/processor/processor.m4')
popdef(`SRC')
popdef(`RELOCATE_EX')
popdef(`UNRELOCATED_EX')
popdef(`PTR_FROM_VIRTUAL_EX')
#ifdef HAVE_XCACHE_DPRINT
REDEF(`PROCESSOR_TYPE', `dprint') include(srcdir`/processor/processor.m4')

2
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', `', `UNRELOCATED_EX(`$1', `$3')', `$6 $3')
ifelse(`$6', `', `PTR_FROM_VIRTUAL_EX(`$1', `$3')', `$6 $3')
, ptrdiff
, relocatediff
')

Loading…
Cancel
Save