Ignore:
Timestamp:
2006-12-09T17:27:03+01:00 (7 years ago)
Author:
moo
Message:

restruct cached compile, add md5 table to recognize and merge file with same content

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/head.m4

    r300 r311  
    6565    zend_bool reference; /* enable if to deal with reference */ 
    6666    zend_bool have_references; 
    67     const xc_entry_t *xce_src; 
    68     const xc_entry_t *xce_dst; 
     67    const xc_entry_data_php_t *php_src; 
     68    const xc_entry_data_php_t *php_dst; 
     69    const xc_cache_t          *cache; 
    6970    const zend_class_entry *cache_ce; 
    7071    zend_uint cache_class_num; 
     
    186187static zend_ulong xc_get_class_num(xc_processor_t *processor, zend_class_entry *ce) { 
    187188    zend_ulong i; 
    188     const xc_entry_t *xce = processor->xce_src; 
     189    const xc_entry_data_php_t *php = processor->php_src; 
    189190    zend_class_entry *ceptr; 
    190191 
     
    192193        return processor->cache_class_num; 
    193194    } 
    194     for (i = 0; i < xce->data.php->classinfo_cnt; i ++) { 
    195         ceptr = CestToCePtr(xce->data.php->classinfos[i].cest); 
     195    for (i = 0; i < php->classinfo_cnt; i ++) { 
     196        ceptr = CestToCePtr(php->classinfos[i].cest); 
    196197        if (ZCEP_REFCOUNT_PTR(ceptr) == ZCEP_REFCOUNT_PTR(ce)) { 
    197198            processor->cache_ce = ceptr; 
     
    209210    /* must be parent or currrent class */ 
    210211    assert(class_num <= processor->active_class_num); 
    211     return CestToCePtr(processor->xce_dst->data.php->classinfos[class_num - 1].cest); 
     212    return CestToCePtr(processor->php_dst->classinfos[class_num - 1].cest); 
    212213} 
    213214#endif 
     
    275276/* }}} */ 
    276277dnl ================ export API 
    277 /* export: xc_entry_t *xc_processor_store_xc_entry_t(xc_entry_t *src TSRMLS_DC); :export {{{ */ 
    278 xc_entry_t *xc_processor_store_xc_entry_t(xc_entry_t *src TSRMLS_DC) { 
    279     xc_entry_t *dst; 
     278define(`DEFINE_STORE_API', ` 
     279/* export: $1 *xc_processor_store_$1($1 *src TSRMLS_DC); :export {{{ */ 
     280$1 *xc_processor_store_$1($1 *src TSRMLS_DC) { 
     281    $1 *dst; 
    280282    xc_processor_t processor; 
    281283 
    282284    memset(&processor, 0, sizeof(processor)); 
    283285    processor.reference = 1; 
     286    processor.cache = src->cache; 
    284287 
    285288    IFASSERT(`xc_stack_init(&processor.allocsizes);') 
     
    295298        processor.size = ALIGN(processor.size + sizeof(src[0])); 
    296299 
    297         xc_calc_xc_entry_t(&processor, src TSRMLS_CC); 
     300        xc_calc_$1(&processor, src TSRMLS_CC); 
    298301        if (processor.reference) { 
    299302            zend_hash_destroy(&processor.zvalptrs); 
     
    302305    } 
    303306    src->size = processor.size; 
    304     src->have_references = processor.have_references; 
     307    ifelse(`$1', `xc_entry_t', ` 
     308        src->data.var->have_references = processor.have_references; 
     309    ', ` 
     310        src->have_references = processor.have_references; 
     311    ') 
    305312 
    306313    IFASSERT(`xc_stack_reverse(&processor.allocsizes);') 
     
    314321 
    315322        /* mem :) */ 
    316         processor.p = (char *) src->cache->mem->handlers->malloc(src->cache->mem, processor.size); 
     323        processor.p = (char *) processor.cache->mem->handlers->malloc(processor.cache->mem, processor.size); 
    317324        if (processor.p == NULL) { 
    318325            dst = NULL; 
     
    323330 
    324331        /* allocate */ 
    325         dst = (xc_entry_t *) processor.p; 
     332        dst = ($1 *) processor.p; 
    326333        processor.p = (char *) ALIGN(processor.p + sizeof(dst[0])); 
    327334 
    328         xc_store_xc_entry_t(&processor, dst, src TSRMLS_CC); 
     335        xc_store_$1(&processor, dst, src TSRMLS_CC); 
    329336        IFASSERT(` { 
    330337            int real = processor.p - oldp; 
     
    348355} 
    349356/* }}} */ 
    350 /* export: xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */ 
    351 xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src, zend_bool readonly_protection TSRMLS_DC) { 
     357') 
     358DEFINE_STORE_API(`xc_entry_t') 
     359DEFINE_STORE_API(`xc_entry_data_php_t') 
     360/* export: xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC); :export {{{ */ 
     361xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC) { 
     362    xc_processor_t processor; 
     363 
     364    memset(&processor, 0, sizeof(processor)); 
     365    xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC); 
     366 
     367    return dst; 
     368} 
     369/* }}} */ 
     370/* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */ 
     371xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) { 
    352372    xc_processor_t processor; 
    353373 
    354374    memset(&processor, 0, sizeof(processor)); 
    355375    processor.readonly_protection = readonly_protection; 
     376    /* this function is used for php data only */ 
    356377    if (src->have_references) { 
    357378        processor.reference = 1; 
     
    361382        zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0); 
    362383    } 
    363     xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC); 
     384    xc_restore_xc_entry_data_php_t(&processor, dst, src TSRMLS_CC); 
    364385    if (processor.reference) { 
    365386        zend_hash_destroy(&processor.zvalptrs); 
Note: See TracChangeset for help on using the changeset viewer.