Changeset 851 in svn for trunk/processor


Ignore:
Timestamp:
2012-03-27T16:07:50Z (8 years ago)
Author:
Xuefer
Message:

more readability cache property. reduce memory footprint for data caching

Location:
trunk/processor
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/head.m4

    r846 r851  
    8282    zend_bool reference; /* enable if to deal with reference */
    8383    zend_bool have_references;
    84     const xc_entry_t *entry_src;
    85     const xc_entry_t *entry_dst;
     84    const xc_entry_php_t *entry_php_src;
     85    const xc_entry_php_t *entry_php_dst;
    8686    const xc_entry_data_php_t *php_src;
    8787    const xc_entry_data_php_t *php_dst;
     
    396396    memset(&processor, 0, sizeof(processor));
    397397    processor.reference = 1;
    398     processor.cache = src->cache;
     398    processor.cache = src->ifelse(`$1', `xc_entry_php_t', entry.)cache;
    399399
    400400    IFASSERT(`xc_stack_init(&processor.allocsizes);')
     
    416416        zend_hash_destroy(&processor.strings);
    417417    }
    418     src->size = processor.size;
    419     ifelse(`$1', `xc_entry_t', `
    420         src->data.var->have_references = processor.have_references;
    421     ', `
    422         src->have_references = processor.have_references;
    423     ')
     418    src->ifelse(`$1', `xc_entry_php_t', entry.)size = processor.size;
     419    ifelse(
     420        `$1', `xc_entry_t', `src->data.var.have_references = processor.have_references;',
     421        `$1', `xc_entry_data_php_t', `src->have_references = processor.have_references;'
     422    )
    424423
    425424    IFASSERT(`xc_stack_reverse(&processor.allocsizes);')
     
    469468')
    470469DEFINE_STORE_API(`xc_entry_t')
     470DEFINE_STORE_API(`xc_entry_php_t')
    471471DEFINE_STORE_API(`xc_entry_data_php_t')
    472 /* export: xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC); :export {{{ */
    473 xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC) {
     472/* export: xc_entry_php_t *xc_processor_restore_xc_entry_php_t(xc_entry_php_t *dst, const xc_entry_php_t *src TSRMLS_DC); :export {{{ */
     473xc_entry_php_t *xc_processor_restore_xc_entry_php_t(xc_entry_php_t *dst, const xc_entry_php_t *src TSRMLS_DC) {
    474474    xc_processor_t processor;
    475475
    476476    memset(&processor, 0, sizeof(processor));
    477     xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC);
     477    xc_restore_xc_entry_php_t(&processor, dst, src TSRMLS_CC);
    478478
    479479    return dst;
    480480}
    481481/* }}} */
    482 /* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */
    483 xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) {
     482/* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */
     483xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) {
    484484    xc_processor_t processor;
    485485
     
    490490        processor.reference = 1;
    491491    }
    492     processor.entry_src = xce;
     492    processor.entry_php_src = xce;
    493493
    494494    if (processor.reference) {
     
    499499        zend_hash_destroy(&processor.zvalptrs);
    500500    }
     501    return dst;
     502}
     503/* }}} */
     504/* export: xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC); :export {{{ */
     505xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC) {
     506    xc_processor_t processor;
     507
     508    memset(&processor, 0, sizeof(processor));
     509    xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC);
     510
    501511    return dst;
    502512}
     
    522532}
    523533/* }}} */
    524 /* export: void xc_dprint(xc_entry_t *src, int indent TSRMLS_DC); :export {{{ */
     534/* export: void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC); :export {{{ */
    525535#ifdef HAVE_XCACHE_DPRINT
    526 void xc_dprint(xc_entry_t *src, int indent TSRMLS_DC) {
     536void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC) {
    527537    IFDPRINT(`INDENT()`'fprintf(stderr, "xc_entry_t:src");')
    528538    xc_dprint_xc_entry_t(src, indent TSRMLS_CC);
  • trunk/processor/main.m4

    r844 r851  
    253253EXPORT(`xc_funcinfo_t')
    254254EXPORT(`xc_entry_t')
     255EXPORT(`xc_entry_php_t')
    255256EXPORT(`xc_entry_data_php_t')
    256257EXPORT(`zval')
  • trunk/processor/processor.m4

    r846 r851  
    431431#   ifdef ZEND_ENGINE_2_4
    432432    DISABLECHECK(`
    433     IFRESTORE(`dst->info.user.filename = processor->entry_src->filepath;', `PROC_STRING(info.user.filename)')
     433    IFRESTORE(`dst->info.user.filename = processor->entry_php_src->filepath;', `PROC_STRING(info.user.filename)')
    434434    PROCESS(zend_uint, info.user.line_start)
    435435    PROCESS(zend_uint, info.user.line_end)
     
    439439    DONE(info)
    440440#   else
    441     IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)')
     441    IFRESTORE(`dst->filename = processor->entry_php_src->filepath;DONE(filename)', `PROC_STRING(filename)')
    442442    PROCESS(zend_uint, line_start)
    443443    PROCESS(zend_uint, line_end)
     
    709709        gc_arg_info = 1;
    710710#endif
    711         dst->filename = processor->entry_src->filepath;
     711        dst->filename = processor->entry_php_src->filepath;
    712712#ifdef ZEND_ENGINE_2_4
    713713        if (src->literals /* || op_array_info->literalsinfo_cnt */) {
     
    886886#endif
    887887
    888     IFRESTORE(`dst->filename = processor->entry_src->filepath;DONE(filename)', `PROC_STRING(filename)')
     888    IFRESTORE(`dst->filename = processor->entry_php_src->filepath;DONE(filename)', `PROC_STRING(filename)')
    889889#ifdef IS_UNICODE
    890890    IFRESTORE(`
     
    914914#endif
    915915    } while (0);
    916     IFRESTORE(`xc_fix_op_array_info(processor->entry_src, processor->php_src, dst, shallow_copy, op_array_info TSRMLS_CC);')
     916    IFRESTORE(`xc_fix_op_array_info(processor->entry_php_src, processor->php_src, dst, shallow_copy, op_array_info TSRMLS_CC);')
    917917
    918918#ifdef ZEND_ENGINE_2
     
    10741074    PROCESS(zend_ulong, refcount)
    10751075
    1076     PROCESS(size_t, sourcesize)
     1076    PROCESS(size_t, file_size)
    10771077    PROCESS(zend_ulong, hits)
    10781078    PROCESS(size_t, size)
     
    11271127dnl }}}
    11281128DEF_STRUCT_P_FUNC(`xc_entry_t', , `dnl {{{
     1129    PROCESS(xc_hash_value_t, hvalue)
     1130    /* skip */
     1131    DONE(next)
     1132    COPY(cache)
    11291133    PROCESS(xc_entry_type_t, type)
    11301134    PROCESS(size_t, size)
    1131 
    1132     PROCESS(xc_hash_value_t, hvalue)
    1133     COPY(cache)
    1134     /* skip */
    1135     DONE(next)
    1136 
    1137     IFSTORE(`dst->refcount = 0; DONE(refcount)', `PROCESS(long, refcount)')
    11381135
    11391136    PROCESS(time_t, ctime)
     
    11761173
    11771174        case XC_TYPE_VAR:
    1178             STRUCT_P(xc_entry_data_var_t, data.var)
     1175            STRUCT(xc_entry_data_var_t, data.var)
    11791176            break;
    11801177
     
    11851182    DONE(data)
    11861183    dnl }}}
    1187     PROCESS(time_t, mtime)
     1184')
     1185dnl }}}
     1186DEF_STRUCT_P_FUNC(`xc_entry_php_t', , `dnl {{{
     1187    STRUCT(xc_entry_t, entry)
     1188
     1189    IFSTORE(`dst->refcount = 0; DONE(refcount)', `PROCESS(long, refcount)')
     1190    PROCESS(time_t, file_mtime)
    11881191#ifdef HAVE_INODE
    1189     PROCESS(int, device)
    1190     PROCESS(int, inode)
    1191 #endif
    1192 
    1193     if (src->type == XC_TYPE_PHP) {
     1192    PROCESS(int, file_device)
     1193    PROCESS(int, file_inode)
     1194#endif
     1195
     1196    if (src->entry.type == XC_TYPE_PHP) {
    11941197        PROCESS(int, filepath_len)
    11951198        IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)')
Note: See TracChangeset for help on using the changeset viewer.