Changeset 1444 in svn


Ignore:
Timestamp:
2013-11-06T19:24:29+01:00 (21 months ago)
Author:
Xuefer
Message:

relocate WIP

Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.frag.deps

    r1366 r1444  
    11$(XCACHE_INCLUDES_I) includes.lo $(builddir)/includes.lo: $(srcdir)/mod_cacher/xc_cache.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h
    22mod_assembler/xc_assembler.lo $(builddir)/mod_assembler/xc_assembler.lo:
    3 mod_cacher/xc_cacher.lo $(builddir)/mod_cacher/xc_cacher.lo: $(srcdir)/mod_cacher/xc_cache.h $(srcdir)/mod_cacher/xc_cacher.h $(srcdir)/util/xc_align.h $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h $(srcdir)/util/xc_vector.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_extension.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(XCACHE_PROC_H)
    4 mod_coverager/xc_coverager.lo $(builddir)/mod_coverager/xc_coverager.lo: $(srcdir)/mod_coverager/xc_coverager.h $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_extension.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h
     3mod_cacher/xc_cacher.lo $(builddir)/mod_cacher/xc_cacher.lo: $(XCACHE_PROC_H) $(srcdir)/mod_cacher/xc_cache.h $(srcdir)/mod_cacher/xc_cacher.h $(srcdir)/util/xc_align.h $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h $(srcdir)/util/xc_vector.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_extension.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache_globals.h
     4mod_coverager/xc_coverager.lo $(builddir)/mod_coverager/xc_coverager.lo: $(srcdir)/mod_coverager/xc_coverager.h $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_extension.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache_globals.h
    55mod_decoder/xc_decoder.lo $(builddir)/mod_decoder/xc_decoder.lo:
    6 mod_disassembler/xc_disassembler.lo $(builddir)/mod_disassembler/xc_disassembler.lo: $(srcdir)/mod_disassembler/xc_disassembler.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(XCACHE_PROC_H)
     6mod_disassembler/xc_disassembler.lo $(builddir)/mod_disassembler/xc_disassembler.lo: $(XCACHE_PROC_H) $(srcdir)/mod_disassembler/xc_disassembler.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h
    77mod_encoder/xc_encoder.lo $(builddir)/mod_encoder/xc_encoder.lo:
    8 mod_optimizer/xc_optimizer.lo $(builddir)/mod_optimizer/xc_optimizer.lo: $(srcdir)/mod_optimizer/xc_optimizer.h $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_const_string.h $(srcdir)/xcache/xc_extension.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_opcode_spec.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(XCACHE_PROC_H)
     8mod_optimizer/xc_optimizer.lo $(builddir)/mod_optimizer/xc_optimizer.lo: $(XCACHE_PROC_H) $(srcdir)/mod_optimizer/xc_optimizer.h $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_const_string.h $(srcdir)/xcache/xc_extension.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_opcode_spec.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache_globals.h
    99util/xc_stack.lo $(builddir)/util/xc_stack.lo: $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h
    1010util/xc_trace.lo $(builddir)/util/xc_trace.lo: $(srcdir)/util/xc_trace.h
    11 xcache.lo $(builddir)/xcache.lo: $(srcdir)/util/xc_foreachcoresig.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_const_string.h $(srcdir)/xcache/xc_extension.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_opcode_spec.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(XCACHE_PROC_H)
     11xcache.lo $(builddir)/xcache.lo: $(XCACHE_PROC_H) $(srcdir)/util/xc_foreachcoresig.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_const_string.h $(srcdir)/xcache/xc_extension.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_opcode_spec.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache_globals.h
     12xcache/xc_allocator.lo $(builddir)/xcache/xc_allocator.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_allocator.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h
    1213xcache/xc_allocator_bestfit.lo $(builddir)/xcache/xc_allocator_bestfit.lo: $(srcdir)/util/xc_align.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache/xc_allocator.h $(srcdir)/xcache/xc_shm.h
    13 xcache/xc_allocator.lo $(builddir)/xcache/xc_allocator.lo: $(srcdir)/xcache/xc_allocator.h $(srcdir)/xcache/xc_shm.h
    1414xcache/xc_compatibility.lo $(builddir)/xcache/xc_compatibility.lo: $(srcdir)/xcache/xc_compatibility.h
    1515xcache/xc_const_string.lo $(builddir)/xcache/xc_const_string.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_const_string.h $(srcdir)/xcache/xc_const_string_opcodes_php4.x.h $(srcdir)/xcache/xc_const_string_opcodes_php5.0.h $(srcdir)/xcache/xc_const_string_opcodes_php5.1.h $(srcdir)/xcache/xc_const_string_opcodes_php5.2.h $(srcdir)/xcache/xc_const_string_opcodes_php5.3.h $(srcdir)/xcache/xc_const_string_opcodes_php5.4.h $(srcdir)/xcache/xc_const_string_opcodes_php5.5.h $(srcdir)/xcache/xc_const_string_opcodes_php6.x.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h
     
    1818xcache/xc_malloc.lo $(builddir)/xcache/xc_malloc.lo: $(srcdir)/util/xc_align.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_allocator.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h
    1919xcache/xc_mutex.lo $(builddir)/xcache/xc_mutex.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h
    20 xcache/xc_opcode_spec.lo $(builddir)/xcache/xc_opcode_spec.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_const_string.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_opcode_spec_def.h $(srcdir)/xcache/xc_opcode_spec.h $(srcdir)/xcache/xc_shm.h
     20xcache/xc_opcode_spec.lo $(builddir)/xcache/xc_opcode_spec.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_const_string.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_opcode_spec.h $(srcdir)/xcache/xc_opcode_spec_def.h $(srcdir)/xcache/xc_shm.h
    2121xcache/xc_processor.lo $(builddir)/xcache/xc_processor.lo: $(XCACHE_PROC_C)
    22 xcache/xc_sandbox.lo $(builddir)/xcache/xc_sandbox.lo: $(srcdir)/util/xc_stack.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h
    23 xcache/xc_shm.lo $(builddir)/xcache/xc_shm.lo: $(srcdir)/xcache/xc_shm.h
     22xcache/xc_sandbox.lo $(builddir)/xcache/xc_sandbox.lo: $(srcdir)/util/xc_stack.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache_globals.h
     23xcache/xc_shm.lo $(builddir)/xcache/xc_shm.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h
    2424xcache/xc_shm_mmap.lo $(builddir)/xcache/xc_shm_mmap.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h
    25 xcache/xc_utils.lo $(builddir)/xcache/xc_utils.lo: $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache_globals.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_opcode_spec.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h
     25xcache/xc_utils.lo $(builddir)/xcache/xc_utils.lo: $(srcdir)/util/xc_stack.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_mutex.h $(srcdir)/xcache/xc_opcode_spec.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache_globals.h
  • trunk/mod_cacher/xc_cacher.c

    r1433 r1444  
    177177    php->refcount = 0;
    178178    stored_php = xc_processor_store_xc_entry_data_php_t(cache->shm, cache->allocator, php TSRMLS_CC);
     179#if 1
     180    {
     181        char *p = malloc(stored_php->size);
     182        fprintf(stderr, "%d\n", stored_php->size);
     183        memcpy(p, stored_php, stored_php->size);
     184        /*
     185        xc_processor_relocate_xc_entry_data_php_t(p, p, 0, stored_php TSRMLS_CC);
     186        */
     187    }
     188#endif
    179189    if (stored_php) {
    180190        xc_php_add_unlocked(cache->cached, stored_php);
  • trunk/processor/hashtable.m4

    r1440 r1444  
    7373        DONE(arBuckets)
    7474        DISABLECHECK(`
    75         for (srcBucket = SRCPTR(`Bucket', `pListHead'); srcBucket != NULL; srcBucket = SRCPTR_EX(`Bucket', `srcBucket->pListNext')) {
    76             IFPTRMOVE(`Bucket *dstBucket = srcBucket;')
     75        for (srcBucket = SRCPTR_EX(`Bucket', SRC(`pListHead')); srcBucket != NULL; srcBucket = SRCPTR_EX(`Bucket', `srcBucket->pListNext')) {
    7776            IFCALCCOPY(`bucketsize = BUCKET_SIZE(srcBucket);')
    7877            ALLOC(dstBucket, char, bucketsize, , Bucket)
     
    108107                dnl $6 = `' to skip alloc
    109108                STRUCT_P_EX(`$2', dstBucket->pData, (($2*)srcBucket->pData), `', `$3', ` ')
    110                 FIXPOINTER_EX(`$2', dstBucket->pData, srcBucket->pData)
     109                FIXPOINTER_EX(`$2', dstBucket->pData)
    111110            }
    112111            else {
     
    129128                prev = dstBucket;
    130129            ')
    131             FIXPOINTER_EX(`Bucket', `dstBucket', `srcBucket')
     130            FIXPOINTER_EX(`Bucket', `dstBucket')
    132131            IFCOPY(`
    133132                DST(`arBuckets[n]') = dstBucket;
  • trunk/processor/head.m4

    r1443 r1444  
    1111
    1212EXPORT(`#include "xcache.h"')
    13 #include "xcache.h"
    1413EXPORT(`#include "mod_cacher/xc_cache.h"')
    15 #include "mod_cacher/xc_cache.h"
    1614EXPORT(`#include "xcache/xc_shm.h"')
    17 #include "xcache/xc_shm.h"
    1815EXPORT(`#include "xcache/xc_allocator.h"')
    19 #include "xcache/xc_allocator.h"
     16#include "xc_processor.h"
    2017#include "xcache/xc_const_string.h"
    2118#include "xcache/xc_utils.h"
    2219#include "util/xc_align.h"
    23 #include "xc_processor.h"
    2420#include "xcache_globals.h"
    2521
     
    8783dnl }}}
    8884dnl {{{ _xc_processor_t
    89 EXPORT(`typedef struct _xc_processor_t xc_processor_t;')
    90 struct _xc_processor_t {
     85typedef struct _xc_processor_t {
    9186    char *p;
    9287    size_t size;
     
    114109    zend_bool readonly_protection; /* wheather it's present */
    115110IFAUTOCHECK(xc_stack_t allocsizes;)
    116 };
     111} xc_processor_t;
    117112dnl }}}
    118 EXPORT(`typedef struct _xc_relocate_t { ptrdiff_t src; ptrdiff_t dst; ptrdiff_t ptrdiff; } xc_relocate_t;')
     113typedef struct _xc_relocate_t { /* {{{ */
     114    ptrdiff_t dst;
     115    char *old_start;
     116    char *new_start;
     117} xc_relocate_t;
     118/* }}} */
    119119EXPORT(`typedef struct _xc_dasm_t { const zend_op_array *active_op_array_src; } xc_dasm_t;')
    120120/* {{{ memsetptr */
     
    394394')
    395395/* }}} */
    396 dnl ================ export API
    397 define(`DEFINE_STORE_API', `
    398 EXPORTED(`$1 *xc_processor_store_$1(xc_shm_t *shm, xc_allocator_t *allocator, $1 *src TSRMLS_DC)') dnl {{{
    399 {
    400     $1 *dst;
    401     xc_processor_t processor;
    402 
    403     memset(&processor, 0, sizeof(processor));
    404     processor.reference = 1;
    405     processor.shm = shm;
    406     processor.allocator = allocator;
    407 
    408     IFAUTOCHECK(`xc_stack_init(&processor.allocsizes);')
    409 
    410     /* calc size */ {
    411         zend_hash_init(&processor.strings, 0, NULL, NULL, 0);
    412         if (processor.reference) {
    413             zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0);
    414         }
    415 
    416         processor.size = 0;
    417         /* allocate */
    418         processor.size = ALIGN(processor.size + sizeof(src[0]));
    419 
    420         xc_calc_$1(&processor, src TSRMLS_CC);
    421         if (processor.reference) {
    422             zend_hash_destroy(&processor.zvalptrs);
    423         }
    424         zend_hash_destroy(&processor.strings);
    425     }
    426     ifelse(
    427         `$1', `xc_entry_data_php_t', `SRC(`size')',
    428         `', `', SRC(`entry.size')) = processor.size;
    429     ifelse(
    430         `$1', `xc_entry_var_t', `SRC(`have_references') = processor.have_references;',
    431         `$1', `xc_entry_data_php_t', `SRC(`have_references') = processor.have_references;'
    432     )
    433 
    434     IFAUTOCHECK(`xc_stack_reverse(&processor.allocsizes);')
    435     /* store {{{ */
    436     {
    437         IFAUTOCHECK(`char *oldp;')
    438         zend_hash_init(&processor.strings, 0, NULL, NULL, 0);
    439         if (processor.reference) {
    440             zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0);
    441         }
    442 
    443         /* allocator :) */
    444         processor.p = (char *) processor.allocator->vtable->malloc(processor.allocator, processor.size);
    445         if (processor.p == NULL) {
    446             dst = NULL;
    447             goto err_alloc;
    448         }
    449         IFAUTOCHECK(`oldp = processor.p;')
    450         assert(processor.p == (char *) ALIGN(processor.p));
    451 
    452         /* allocate */
    453         dst = ($1 *) processor.p;
    454         processor.p = (char *) ALIGN(processor.p + sizeof(dst[0]));
    455 
    456         xc_store_$1(&processor, dst, src TSRMLS_CC);
    457         IFAUTOCHECK(` {
    458             size_t unexpected = processor.p - oldp;
    459             size_t expected = processor.size;
    460             if (unexpected != processor.size) {
    461                 fprintf(stderr, "unexpected:%lu - expected:%lu = %ld != 0\n", (unsigned long) unexpected, (unsigned long) expected, (long) unexpected - expected);
    462                 abort();
    463             }
    464         }')
    465 err_alloc:
    466         if (processor.reference) {
    467             zend_hash_destroy(&processor.zvalptrs);
    468         }
    469         zend_hash_destroy(&processor.strings);
    470     }
    471     /* }}} */
    472 
    473     IFAUTOCHECK(`xc_stack_destroy(&processor.allocsizes);')
    474 
    475     return dst;
    476 }
    477 dnl }}}
    478 ')
    479 DEFINE_STORE_API(`xc_entry_var_t')
    480 DEFINE_STORE_API(`xc_entry_php_t')
    481 DEFINE_STORE_API(`xc_entry_data_php_t')
    482 EXPORTED(`xc_entry_php_t *xc_processor_restore_xc_entry_php_t(xc_entry_php_t *dst, const xc_entry_php_t *src TSRMLS_DC)') dnl {{{
    483 {
    484     xc_processor_t processor;
    485 
    486     memset(&processor, 0, sizeof(processor));
    487     xc_restore_xc_entry_php_t(&processor, dst, src TSRMLS_CC);
    488 
    489     return dst;
    490 }
    491 dnl }}}
    492 EXPORTED(`xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *entry_php, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC)') dnl {{{
    493 {
    494     xc_processor_t processor;
    495 
    496     memset(&processor, 0, sizeof(processor));
    497     processor.readonly_protection = readonly_protection;
    498     /* this function is used for php data only */
    499     if (SRC(`have_references')) {
    500         processor.reference = 1;
    501     }
    502     processor.entry_php_src = entry_php;
    503 
    504     if (processor.reference) {
    505         zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0);
    506     }
    507     xc_restore_xc_entry_data_php_t(&processor, dst, src TSRMLS_CC);
    508     if (processor.reference) {
    509         zend_hash_destroy(&processor.zvalptrs);
    510     }
    511     return dst;
    512 }
    513 dnl }}}
    514 EXPORTED(`zval *xc_processor_restore_zval(zval *dst, const zval *src, zend_bool have_references TSRMLS_DC)') dnl {{{
    515 {
    516     xc_processor_t processor;
    517 
    518     memset(&processor, 0, sizeof(processor));
    519     processor.reference = have_references;
    520 
    521     if (processor.reference) {
    522         zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0);
    523         dnl fprintf(stderr, "mark[%p] = %p\n", src, dst);
    524         zend_hash_add(&processor.zvalptrs, (char *)src, sizeof(src), (void*)&dst, sizeof(dst), NULL);
    525     }
    526     xc_restore_zval(&processor, dst, src TSRMLS_CC);
    527     if (processor.reference) {
    528         zend_hash_destroy(&processor.zvalptrs);
    529     }
    530 
    531     return dst;
    532 }
    533 dnl }}}
    534 define(`DEFINE_RELOCATE_API', `
    535 EXPORTED(`void xc_processor_relocate_$1(int a TSRMLS_DC)') dnl {{{
    536 {
    537 }
    538 dnl }}}
    539 ')
    540 DEFINE_RELOCATE_API(`xc_entry_var_t')
    541 DEFINE_RELOCATE_API(`xc_entry_php_t')
    542 DEFINE_RELOCATE_API(`xc_entry_data_php_t')
    543 #ifdef HAVE_XCACHE_DPRINT
    544 EXPORTED(`void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC)') dnl {{{
    545 {
    546     IFDPRINT(`INDENT()`'fprintf(stderr, "xc_entry_php_t:src");')
    547     xc_dprint_xc_entry_php_t(src, indent TSRMLS_CC);
    548 }
    549 #endif
    550 dnl }}}
  • trunk/processor/main.m4

    r1443 r1444  
    2525define(`INDENT', `xc_dprint_indent(indent);')
    2626dnl }}}
    27 dnl {{{ SRCPTR(1:type, 2:elm)
    28 define(`SRCPTR', `SRCPTR_EX(`$1', `SRC(`$2')')')
    29 define(`SRCPTR_EX', `IFPTRMOVE(`(($1 *) (((char *) $2) + relocate->src))', `$2')')
    30 dnl }}}
    31 dnl {{{ DSTPTR(1:type, 2:elm)
    32 define(`DSTPTR', `DSTPTR_EX(`$1', `DST(`$2')')')
    33 define(`DSTPTR_EX', `IFPTRMOVE(`(($1 *) (((char *) $2) + relocate->dst))', `$2')')
     27dnl {{{ SRCPTR_EX(1:type, 2:elm)
     28define(`SRCPTR_EX', `IFRELOCATE(`(($1 *) (((char *) $2) + 1))', `$2')')
    3429dnl }}}
    3530dnl {{{ ALLOC(1:dst, 2:type, 3:count=1, 4:clean=false, 5:realtype=$2)
     
    130125dnl {{{ EXPORT(1:code)
    131126define(`EXPORT', `/* export: $1 :export */')
    132 define(`EXPORTED', `EXPORT(`$1;')
     127define(`EXPORTED', `EXPORT(`$1')
     128$1')
     129define(`EXPORTED_FUNCTION', `EXPORT(`$1;')
    133130$1')
    134131dnl }}}
     
    137134dnl }}}
    138135dnl {{{ FIXPOINTER(1:type, 2:ele)
    139 define(`FIXPOINTER', `FIXPOINTER_EX(`$1', `DST(`$2')', `SRCPTR(`$1', `$2')')')
    140 dnl }}}
    141 dnl {{{ FIXPOINTER_EX(1:type, 2:dst, 3:src)
     136define(`FIXPOINTER', `FIXPOINTER_EX(`$1', `DST(`$2')')')
     137dnl }}}
     138dnl {{{ FIXPOINTER_EX(1:type, 2:dst)
    142139define(`FIXPOINTER_EX', `
    143140    IFSTORE(`$2 = ($1 *) processor->shm->handlers->to_readonly(processor->shm, (void *)$2);')
    144     IFPTRMOVE(`$2 = ($1 *) (((char *) $3) + relocate->ptrdiff);')
     141    IFRELOCATE(`patsubst($2, `dst', `src') = ($1 *) (((char *) patsubst($2, `dst', `src')) + 1);')
    145142')
    146143dnl }}}
     
    242239define(`IFCALCSTORE', `IFSTORE(`$1', `IFCALC(`$1', `$2')')')
    243240define(`IFRESTORE', `ifelse(PROCESSOR_TYPE, `restore', `$1', `$2')')
    244 define(`IFPTRMOVE', `ifelse(PROCESSOR_TYPE, `relocate', `$1', `$2')')
     241define(`IFRELOCATE', `ifelse(PROCESSOR_TYPE, `relocate', `$1', `$2')')
    245242define(`IFCOPY', `IFSTORE(`$1', `IFRESTORE(`$1', `$2')')')
    246243define(`IFCALCCOPY', `IFCALC(`$1', `IFCOPY(`$1', `$2')')')
     
    253250EXPORT_PROCESSOR(`dasm', `zend_class_entry')
    254251
    255 EXPORT_PROCESSOR(`calc',    `xc_entry_data_php_t')
    256 EXPORT_PROCESSOR(`calc',    `xc_entry_php_t')
    257 EXPORT_PROCESSOR(`calc',    `xc_entry_var_t')
    258 EXPORT_PROCESSOR(`store',   `xc_entry_data_php_t')
    259 EXPORT_PROCESSOR(`store',   `xc_entry_php_t')
    260 EXPORT_PROCESSOR(`store',   `xc_entry_var_t')
    261 EXPORT_PROCESSOR(`restore', `xc_entry_data_php_t')
    262 EXPORT_PROCESSOR(`restore', `xc_entry_php_t')
    263 EXPORT_PROCESSOR(`dasm',    `xc_entry_data_php_t')
    264 EXPORT_PROCESSOR(`dprint',  `xc_entry_php_t')
    265 
    266 EXPORT_PROCESSOR(`restore', `zval')
     252dnl EXPORT_PROCESSOR(`calc',    `xc_entry_data_php_t')
     253dnl EXPORT_PROCESSOR(`calc',    `xc_entry_php_t')
     254dnl EXPORT_PROCESSOR(`calc',    `xc_entry_var_t')
     255dnl EXPORT_PROCESSOR(`store',   `xc_entry_data_php_t')
     256dnl EXPORT_PROCESSOR(`store',   `xc_entry_php_t')
     257dnl EXPORT_PROCESSOR(`store',   `xc_entry_var_t')
     258dnl EXPORT_PROCESSOR(`restore', `xc_entry_data_php_t')
     259dnl EXPORT_PROCESSOR(`restore', `xc_entry_php_t')
     260dnl EXPORT_PROCESSOR(`dasm',    `xc_entry_data_php_t')
     261dnl EXPORT_PROCESSOR(`dprint',  `xc_entry_php_t')
     262
     263dnl EXPORT_PROCESSOR(`restore', `zval')
    267264EXPORT_PROCESSOR(`dprint',  `zval')
    268265
     
    285282#endif /* HAVE_XCACHE_DISASSEMBLER */
    286283
     284include(srcdir`/processor/foot.m4')
     285
    287286ifdef(`EXIT_PENDING', `m4exit(EXIT_PENDING)')
  • trunk/processor/processor.m4

    r1440 r1444  
    194194                    ', `
    195195                        zval_ptr pzv = dst[0];
    196                         FIXPOINTER_EX(zval, pzv, dst[0])
     196                        FIXPOINTER_EX(zval, pzv)
    197197                    ')
    198                     if (zend_hash_add(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void *) &pzv, sizeof(pzv), NULL) == SUCCESS) {
    199                         /* first add, go on */
     198                    if (zend_hash_add(&processor->zvalptrs, (char *) &src[0], sizeof(src[0]), (void *) &pzv, sizeof(pzv), NULL) == SUCCESS) { /* first add, go on */
    200199                        dnl fprintf(stderr, "mark[%p] = %p\n", src[0], pzv);
    201200                    }
     
    210209            IFDPRINT(`INDENT()`'fprintf(stderr, "[%p] ", (void *) src[0]);')
    211210            STRUCT_P_EX(zval, dst[0], src[0], `[0]', `', ` ')
    212             FIXPOINTER_EX(zval, dst[0], src[0])
     211            FIXPOINTER_EX(zval, dst[0])
    213212        } while (0);
    214213    ')
     
    336335        ALLOC(dst[0], zend_trait_alias)
    337336        STRUCT_P_EX(zend_trait_alias, dst[0], src[0], `[0]', `', ` ')
    338         FIXPOINTER_EX(zend_trait_alias, dst[0], src[0])
     337        FIXPOINTER_EX(zend_trait_alias, dst[0])
    339338    ')
    340339    DONE_SIZE(sizeof(zend_trait_alias))
     
    349348        ALLOC(dst[0], zend_trait_precedence)
    350349        STRUCT_P_EX(zend_trait_precedence, dst[0], src[0], `[0]', `', ` ')
    351         FIXPOINTER_EX(zend_trait_precedence, dst[0], src[0])
     350        FIXPOINTER_EX(zend_trait_precedence, dst[0])
    352351    ')
    353352    DONE_SIZE(sizeof(zend_trait_precedence))
     
    674673                assert(Z_OP(DST(`op1')).jmp_addr >= processor->active_op_array_dst->opcodes);
    675674                assert(Z_OP(DST(`op1')).jmp_addr - processor->active_op_array_dst->opcodes < processor->active_op_array_dst->last);
    676                 FIXPOINTER_EX(zend_op, `Z_OP(DST(`op1')).jmp_addr', `Z_OP(SRC(`op1')).jmp_addr')
     675                FIXPOINTER_EX(zend_op, `Z_OP(DST(`op1')).jmp_addr')
    677676                break;
    678677
     
    692691                assert(Z_OP(DST(`op2')).jmp_addr >= processor->active_op_array_dst->opcodes);
    693692                assert(Z_OP(DST(`op2')).jmp_addr - processor->active_op_array_dst->opcodes < processor->active_op_array_dst->last);
    694                 FIXPOINTER_EX(zend_op, `Z_OP(DST(`op2')).jmp_addr', `Z_OP(SRC(`op2')).jmp_addr')
     693                FIXPOINTER_EX(zend_op, `Z_OP(DST(`op2')).jmp_addr')
    695694                break;
    696695
  • trunk/processor/string.m4

    r1440 r1444  
    6464            DSTPTR = ifdef(`REALPTRTYPE', `(REALPTRTYPE() *)') STRDUP() (SRCPTR, ($3) - 1);
    6565        ')
    66         FIXPOINTER_EX(ifdef(`REALPTRTYPE', `REALPTRTYPE()', `PTRTYPE'), DSTPTR, SRCPTR)
     66        FIXPOINTER_EX(ifdef(`REALPTRTYPE', `REALPTRTYPE()', `PTRTYPE'), DSTPTR)
    6767        IFDASM(`
    6868            ifelse(STRTYPE,zstr_uchar, `
  • trunk/processor/struct.m4

    r1443 r1444  
    1515        IFSTORE(  `xc_processor_t *processor, $1 *dst, const $1 * const src')
    1616        IFRESTORE(`xc_processor_t *processor, $1 *dst, const $1 * const src')
    17         IFPTRMOVE(`const xc_relocate_t *relocate, $1 * const dst, const $1 * const src')
    18         IFDASM(   `xc_dasm_t *dasm, zval *dst, const $1 * const src')
     17        IFRELOCATE(`const xc_relocate_t *relocate, $1 *const src')
     18        IFDASM(`xc_dasm_t *dasm, zval *dst, const $1 * const src')
    1919        TSRMLS_DC
    2020    )ifelse(`$3', `', `;')
     
    148148        IFSTORE(  `processor, $6 $2, $6 $3')
    149149        IFRESTORE(`processor, $6 $2, $6 $3')
    150         IFPTRMOVE(`
     150        IFRELOCATE(`
    151151            relocate
    152             , ifelse(`$6', `', `DSTPTR_EX(`$1', `$2')', `$6 $2')
    153152            , ifelse(`$6', `', `SRCPTR_EX(`$1', `$3')', `$6 $3')
    154153        ')
    155         IFDASM(   `dasm, ifdef(`DASM_STRUCT_DIRECT', `dst', `zv'), $6 $3')
     154        IFDASM(`dasm, ifdef(`DASM_STRUCT_DIRECT', `dst', `zv'), $6 $3')
    156155        TSRMLS_CC
    157156    );
     
    163162')
    164163    popdef(`FUNC_NAME')
    165     ifelse(`$6', , `FIXPOINTER_EX(`$1', `$2', `$3')')
     164    ifelse(`$6', , `FIXPOINTER_EX(`$1', `$2')')
    166165')
    167166dnl }}}
Note: See TracChangeset for help on using the changeset viewer.