Changeset 877


Ignore:
Timestamp:
2012-04-01T05:39:31+02:00 (3 years ago)
Author:
moo
Message:

kill warning

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/optimizer.c

    r847 r877  
    2929typedef int bbid_t;
    3030enum {
    31     BBID_INVALID = -1,
     31    BBID_INVALID = -1
    3232};
    3333/* {{{ basic block */
  • trunk/processor/head.m4

    r873 r877  
    9999
    100100    zend_bool readonly_protection; /* wheather it's present */
    101 IFASSERT(xc_stack_t allocsizes;)
     101IFAUTOCHECK(xc_stack_t allocsizes;)
    102102};
    103103/* }}} */
    104104/* {{{ memsetptr */
    105 IFASSERT(`dnl
     105IFAUTOCHECK(`dnl
    106106static void *memsetptr(void *mem, void *content, size_t n)
    107107{
     
    171171#undef C_RELAYLINE
    172172#define C_RELAYLINE
    173 IFASSERT(`
     173IFAUTOCHECK(`
    174174#undef C_RELAYLINE
    175175#define C_RELAYLINE , __LINE__
    176176')
    177 static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFASSERT(`, int relayline')) {
     177static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFAUTOCHECK(`, int relayline')) {
    178178    pushdef(`__LINE__', `relayline')
    179179    int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size);
     
    187187        ALLOC(, char, realsize)
    188188    }
    189     IFASSERT(`
     189    IFAUTOCHECK(`
    190190        else {
    191191            dnl fprintf(stderr, "dupstr %s\n", ZSTR_S(str));
     
    197197/* {{{ xc_store_string_n */
    198198REDEF(`KIND', `store')
    199 static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFASSERT(`, int relayline')) {
     199static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFAUTOCHECK(`, int relayline')) {
    200200    pushdef(`__LINE__', `relayline')
    201201    int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size);
     
    341341/* }}} */
    342342/* {{{ field name checker */
    343 IFASSERT(`dnl
     343IFAUTOCHECK(`dnl
    344344static int xc_check_names(const char *file, int line, const char *functionName, const char **assert_names, int assert_names_count, HashTable *done_names)
    345345{
     
    394394    processor.cache = cache;
    395395
    396     IFASSERT(`xc_stack_init(&processor.allocsizes);')
     396    IFAUTOCHECK(`xc_stack_init(&processor.allocsizes);')
    397397
    398398    /* calc size */ {
     
    420420    )
    421421
    422     IFASSERT(`xc_stack_reverse(&processor.allocsizes);')
     422    IFAUTOCHECK(`xc_stack_reverse(&processor.allocsizes);')
    423423    /* store {{{ */
    424424    {
    425         IFASSERT(`char *oldp;')
     425        IFAUTOCHECK(`char *oldp;')
    426426        zend_hash_init(&processor.strings, 0, NULL, NULL, 0);
    427427        if (processor.reference) {
     
    435435            goto err_alloc;
    436436        }
    437         IFASSERT(`oldp = processor.p;')
     437        IFAUTOCHECK(`oldp = processor.p;')
    438438        assert(processor.p == (char *) ALIGN(processor.p));
    439439
     
    443443
    444444        xc_store_$1(&processor, dst, src TSRMLS_CC);
    445         IFASSERT(` {
     445        IFAUTOCHECK(` {
    446446            int real = processor.p - oldp;
    447447            int should = processor.size;
     
    459459    /* }}} */
    460460
    461     IFASSERT(`xc_stack_destroy(&processor.allocsizes);')
     461    IFAUTOCHECK(`xc_stack_destroy(&processor.allocsizes);')
    462462
    463463    return dst;
  • trunk/processor/main.m4

    r860 r877  
    3232    /* allocate */
    3333    IFCALC(`
    34         IFASSERT(`
     34        IFAUTOCHECK(`
    3535            xc_stack_push(&processor->allocsizes, (void *) (long) (SIZE));
    3636            xc_stack_push(&processor->allocsizes, (void *) (long) (__LINE__));
     
    4040    ')
    4141    IFSTORE(`
    42         IFASSERT(`{
     42        IFAUTOCHECK(`{
    4343            if (!xc_stack_count(&processor->allocsizes)) {
    4444                fprintf(stderr, "mismatch `$@' at line %d\n", __LINE__);
     
    5858        $1 = (REALTYPE *) (processor->p = (char *) ALIGN(processor->p));
    5959        ifelse(`$4', `', `
    60                 IFASSERT(`memsetptr($1, (void *) (unsigned long) __LINE__, SIZE);')
     60                IFAUTOCHECK(`memsetptr($1, (void *) (unsigned long) __LINE__, SIZE);')
    6161            ', `
    6262                memset($1, 0, SIZE);
     
    7575                REALTYPE*COUNT, `HashTable*1', `ALLOC_HASHTABLE($1);',
    7676                `', `', `$1 = (REALTYPE *) emalloc(SIZE);')
    77             IFASSERT(`memsetptr($1, (void *) __LINE__, SIZE);')
     77            IFAUTOCHECK(`memsetptr($1, (void *) __LINE__, SIZE);')
    7878        ', `
    7979            $1 = (REALTYPE *) ecalloc(COUNT, sizeof($2));
     
    105105')
    106106dnl }}}
    107 dnl {{{ IFASSERTEX
    108 define(`IFASSERTEX', `ifdef(`XCACHE_ENABLE_TEST', `$1', `$2')')
    109 dnl }}}
    110 dnl {{{ IFASSERT
    111 define(`IFASSERT', `IFASSERTEX(`
     107dnl {{{ IFAUTOCHECKEX
     108define(`IFAUTOCHECKEX', `ifdef(`XCACHE_ENABLE_TEST', `$1', `$2')')
     109dnl }}}
     110dnl {{{ IFAUTOCHECK
     111define(`IFAUTOCHECK', `IFAUTOCHECKEX(`
    112112#ifndef NDEBUG
    113113        $1
     
    206206dnl }}}
    207207dnl {{{ DONE_*
    208 define(`DONE_SIZE', `IFASSERT(`dnl
    209     done_size += $1`';
    210     done_count ++;
     208define(`DONE_SIZE', `IFAUTOCHECK(`dnl
     209    xc_autocheck_done_size += $1`';
     210    xc_autocheck_done_count ++;
    211211')')
    212212define(`DONE', `
    213213    define(`ELEMENTS_DONE', defn(`ELEMENTS_DONE')`,"$1"')
    214     IFASSERT(`dnl
    215         if (zend_u_hash_exists(&done_names, IS_STRING, "$1", sizeof("$1"))) {
     214    IFAUTOCHECK(`dnl
     215        if (zend_u_hash_exists(&xc_autocheck_done_names, IS_STRING, "$1", sizeof("$1"))) {
    216216            fprintf(stderr
    217217                , "duplicate field at %s `#'%d FUNC_NAME`' : %s\n"
     
    222222        else {
    223223            zend_uchar b = 1;
    224             zend_hash_add(&done_names, "$1", sizeof("$1"), (void*)&b, sizeof(b), NULL);
     224            zend_hash_add(&xc_autocheck_done_names, "$1", sizeof("$1"), (void*)&b, sizeof(b), NULL);
    225225        }
    226226    ')
     
    236236dnl }}}
    237237dnl {{{ IF**
    238 define(`IFCALC', `ifelse(KIND, `calc', `$1', `$2')')
    239 define(`IFSTORE', `ifelse(KIND, `store', `$1', `$2')')
     238define(`IFCALC', `ifelse(PROCESSOR_TYPE, `calc', `$1', `$2')')
     239define(`IFSTORE', `ifelse(PROCESSOR_TYPE, `store', `$1', `$2')')
    240240define(`IFCALCSTORE', `IFSTORE(`$1', `IFCALC(`$1', `$2')')')
    241 define(`IFRESTORE', `ifelse(KIND, `restore', `$1', `$2')')
     241define(`IFRESTORE', `ifelse(PROCESSOR_TYPE, `restore', `$1', `$2')')
    242242define(`IFCOPY', `IFSTORE(`$1', `IFRESTORE(`$1', `$2')')')
    243243define(`IFCALCCOPY', `IFCALC(`$1', `IFCOPY(`$1', `$2')')')
    244 define(`IFDPRINT', `ifelse(KIND, `dprint', `$1', `$2')')
    245 define(`IFASM', `ifelse(KIND, `asm', `$1', `$2')')
    246 define(`IFDASM', `ifelse(KIND, `dasm', `$1', `$2')')
     244define(`IFDPRINT', `ifelse(PROCESSOR_TYPE, `dprint', `$1', `$2')')
     245define(`IFASM', `ifelse(PROCESSOR_TYPE, `asm', `$1', `$2')')
     246define(`IFDASM', `ifelse(PROCESSOR_TYPE, `dasm', `$1', `$2')')
    247247dnl }}}
    248248EXPORT(`zend_op')
     
    265265
    266266define(`IFNOTMEMCPY', `ifdef(`USEMEMCPY', `', `$1')')
    267 REDEF(`KIND', `calc') include(srcdir`/processor/processor.m4')
     267REDEF(`PROCESSOR_TYPE', `calc') include(srcdir`/processor/processor.m4')
    268268pushdef(`xc_get_class_num', ``xc_get_class_num'($@)')
    269 REDEF(`KIND', `store') include(srcdir`/processor/processor.m4')
     269REDEF(`PROCESSOR_TYPE', `store') include(srcdir`/processor/processor.m4')
    270270popdef(`xc_get_class_num')
    271271pushdef(`xc_get_class', ``xc_get_class'($@)')
    272 REDEF(`KIND', `restore') include(srcdir`/processor/processor.m4')
     272REDEF(`PROCESSOR_TYPE', `restore') include(srcdir`/processor/processor.m4')
    273273popdef(`xc_get_class')
    274274
    275275REDEF(`IFNOTMEMCPY', `$1')
    276276#ifdef HAVE_XCACHE_DPRINT
    277 REDEF(`KIND', `dprint') include(srcdir`/processor/processor.m4')
     277REDEF(`PROCESSOR_TYPE', `dprint') include(srcdir`/processor/processor.m4')
    278278#endif /* HAVE_XCACHE_DPRINT */
    279279#ifdef HAVE_XCACHE_DISASSEMBLER
    280 REDEF(`KIND', `dasm') include(srcdir`/processor/processor.m4')
     280REDEF(`PROCESSOR_TYPE', `dasm') include(srcdir`/processor/processor.m4')
    281281#endif /* HAVE_XCACHE_DISASSEMBLER */
    282282#ifdef HAVE_XCACHE_ASSEMBLER
    283 REDEF(`KIND', `asm') include(srcdir`/processor/processor.m4')
     283REDEF(`PROCESSOR_TYPE', `asm') include(srcdir`/processor/processor.m4')
    284284#endif /* HAVE_XCACHE_ASSEMBLER */
    285285
  • trunk/processor/processor.m4

    r875 r877  
    6262dnl }}}
    6363DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr',           `zval_ptr')
    64 DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr_nullable',  `zval_ptr_nullable')
    6564DEF_HASH_TABLE_FUNC(`HashTable_zend_function',      `zend_function')
    6665#ifdef ZEND_ENGINE_2
     
    173172                            dst[0] = *ppzv;
    174173                            /* *dst is updated */
    175                             dnl fprintf(stderr, "*dst is set to %p, KIND is_shm %d\n", dst[0], xc_is_shm(dst[0]));
     174                            dnl fprintf(stderr, "*dst is set to %p, PROCESSOR_TYPE is_shm %d\n", dst[0], xc_is_shm(dst[0]));
    176175                        ')
    177176                        IFCALCSTORE(`processor->have_references = 1;')
     
    782781            xc_gc_add_op_array(&gc_op_array TSRMLS_CC);
    783782        }
    784         define(`SKIPASSERT_ONCE')
     783        xc_autocheck_skip = 1;
    785784    }
    786785    else
     
    989988dnl }}}
    990989#endif
     990IFRESTORE(`', `
    991991DEF_STRUCT_P_FUNC(`xc_op_array_info_detail_t', , `dnl {{{
    992992    PROCESS(zend_uint, index)
     
    10041004')
    10051005dnl }}}
     1006')
    10061007DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{
    10071008    PROCESS(zend_uint, key_size)
     
    10501051')
    10511052dnl }}}
     1053IFRESTORE(`', `
    10521054#ifdef ZEND_ENGINE_2_1
    10531055DEF_STRUCT_P_FUNC(`xc_autoglobal_t', , `dnl {{{
     
    10631065dnl }}}
    10641066#endif
     1067')
     1068IFRESTORE(`', `
    10651069#ifdef E_STRICT
    10661070DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{
     
    10721076dnl }}}
    10731077#endif
     1078')
    10741079DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
    10751080    IFCOPY(`
  • trunk/processor/struct.m4

    r873 r877  
    11define(`pushdefFUNC_NAME', `
    2     pushdef(`FUNC_NAME', `xc_`'KIND`'_`'ifelse(`$2', `', `$1', `$2')')
     2    pushdef(`FUNC_NAME', `xc_`'PROCESSOR_TYPE`'_`'ifelse(`$2', `', `$1', `$2')')
    33')
    44dnl {{{ DECL_STRUCT_P_FUNC(1:type, 2:name, 3:comma=;)
     
    3030    {
    3131        pushdef(`ELEMENTS_DONE')
    32         IFASSERT(`
     32        IFAUTOCHECK(`
    3333            /* {{{ init assert */
    3434            ifdef(`SIZEOF_$1', , `m4_errprint(`missing SIZEOF_$1, safe to ignore')')
     
    4545                define(`COUNTOF_$1', 0)
    4646            ')
    47             int assert_size = SIZEOF_$1, assert_count = COUNTOF_$1;
    48             int done_size = 0, done_count = 0;
    49             const char *assert_names[] = { ifdef(`ELEMENTSOF_$1', `ELEMENTSOF_$1') };
    50             HashTable done_names;
    51             zend_hash_init(&done_names, 0, NULL, NULL, 0);
     47            int xc_autocheck_assert_size = SIZEOF_$1, assert_count = COUNTOF_$1;
     48            int xc_autocheck_done_size = 0, xc_autocheck_done_count = 0;
     49            const char *xc_autocheck_assert_names[] = { ifdef(`ELEMENTSOF_$1', `ELEMENTSOF_$1') };
     50            zend_bool xc_autocheck_skip = 0;
     51            HashTable xc_autocheck_done_names;
     52            zend_hash_init(&xc_autocheck_done_names, 0, NULL, NULL, 0);
    5253            /* }}} */
    5354            IFRESTORE(`assert(xc_is_shm(src));')
     
    7172            INDENT()fprintf(stderr, "}\n");
    7273        ')
    73         ifdef(`SKIPASSERT_ONCE', `
    74             undefine(`SKIPASSERT_ONCE')
    75             IFASSERT(`
    76                 zend_hash_destroy(&done_names);
     74        IFAUTOCHECK(`
     75        /* {{{ autocheck */ if (!xc_autocheck_skip) {
     76            int name_check_errors = xc_check_names(__FILE__, __LINE__, "FUNC_NAME", xc_autocheck_assert_names, sizeof(xc_autocheck_assert_names) / sizeof(xc_autocheck_assert_names[0]), &xc_autocheck_done_names);
     77            zend_hash_destroy(&xc_autocheck_done_names);
     78
     79            if (xc_autocheck_done_count != assert_count) {
     80                fprintf(stderr
     81                    , "count assertion failed at %s `#'%d FUNC_NAME`' : unexpected:%d - expecting:%d = %d != 0\n"
     82                    , __FILE__, __LINE__
     83                    , xc_autocheck_done_count, assert_count, xc_autocheck_done_count - assert_count
     84                    );
     85            }
     86            if (xc_autocheck_done_size != xc_autocheck_assert_size) {
     87                fprintf(stderr
     88                    , "size assertion failed at %s `#'%d FUNC_NAME`' : unexpected:%d - expecting:%d = %d != 0\n"
     89                    , __FILE__, __LINE__
     90                    , xc_autocheck_done_size, xc_autocheck_assert_size, xc_autocheck_done_size - xc_autocheck_assert_size
     91                    );
     92            }
     93            if (name_check_errors || xc_autocheck_done_count != assert_count || xc_autocheck_done_size != xc_autocheck_assert_size) {
     94                assert(0);
     95            }
     96        } while (0); /* }}} */
     97        ')
     98        ifdef(`ELEMENTSOF_$1', `
     99            pushdef(`ELEMENTS_UNDONE', LIST_DIFF(defn(`ELEMENTSOF_$1'), defn(`ELEMENTS_DONE')))
     100            ifelse(defn(`ELEMENTS_UNDONE'), , `m4_errprint(`AUTOCHECK INFO: $1: processor looks good')', `
     101                m4_errprint(`AUTOCHECK ERROR: ====' PROCESSOR_TYPE `$1 =================')
     102                m4_errprint(`AUTOCHECK expected:' defn(`ELEMENTSOF_$1'))
     103                m4_errprint(`AUTOCHECK missing :' defn(`ELEMENTS_UNDONE'))
     104                define(`EXIT_PENDING', 1)
    77105            ')
    78         ', `
    79             IFASSERT(`
    80             /* {{{ check assert */ do {
    81                 int name_check_errors = xc_check_names(__FILE__, __LINE__, "FUNC_NAME", assert_names, sizeof(assert_names) / sizeof(assert_names[0]), &done_names);
    82                 zend_hash_destroy(&done_names);
    83 
    84                 if (done_count != assert_count) {
    85                     fprintf(stderr
    86                         , "count assertion failed at %s `#'%d FUNC_NAME`' : unexpected:%d - expecting:%d = %d != 0\n"
    87                         , __FILE__, __LINE__
    88                         , done_count, assert_count, done_count - assert_count
    89                         );
    90                 }
    91                 if (done_size != assert_size) {
    92                     fprintf(stderr
    93                         , "size assertion failed at %s `#'%d FUNC_NAME`' : unexpected:%d - expecting:%d = %d != 0\n"
    94                         , __FILE__, __LINE__
    95                         , done_size, assert_size, done_size - assert_size
    96                         );
    97                 }
    98                 if (name_check_errors || done_count != assert_count || done_size != assert_size) {
    99                     assert(0);
    100                 }
    101             } while (0); /* }}} */
    102             ')
    103             ifdef(`ELEMENTSOF_$1', `
    104                 pushdef(`ELEMENTS_UNDONE', LIST_DIFF(defn(`ELEMENTSOF_$1'), defn(`ELEMENTS_DONE')))
    105                 ifelse(defn(`ELEMENTS_UNDONE'), , `m4_errprint(`AUTOCHECK INFO: $1: processor looks good')', `
    106                     m4_errprint(`AUTOCHECK ERROR: ====' KIND `$1 =================')
    107                     m4_errprint(`AUTOCHECK expected:' defn(`ELEMENTSOF_$1'))
    108                     m4_errprint(`AUTOCHECK missing :' defn(`ELEMENTS_UNDONE'))
    109                     define(`EXIT_PENDING', 1)
    110                 ')
    111                 popdef(`ELEMENTS_UNDONE')
    112             ')
     106            popdef(`ELEMENTS_UNDONE')
    113107        ')
    114108        ifdef(`USEMEMCPY', `IFCOPY(`
    115109            } while (0);
    116110        ')')
    117         IFASSERT(`
     111        IFAUTOCHECK(`
    118112            } while (0);
    119113        ')
Note: See TracChangeset for help on using the changeset viewer.