Ignore:
Timestamp:
2006-10-10T02:46:00+02:00 (8 years ago)
Author:
moo
Message:

processor: apply reference handling on opcode caching. reverted [196] [199] [220] and refix for #36

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/head.m4

    r230 r233  
    6262    HashTable zvalptrs; 
    6363    zend_bool reference; /* enable if to deal with reference */ 
     64    zend_bool have_references; 
    6465    const xc_entry_t *xce_src; 
    6566    const xc_entry_t *xce_dst; 
     
    261262} 
    262263/* }}} */ 
    263 static int xc_hash_static_member_check(xc_processor_t *processor, Bucket *b TSRMLS_DC) /* {{{ */ 
    264 { 
    265     const zend_class_entry *src = processor->active_class_entry_src; 
    266     if (src->parent) { 
    267         zval **parentzv; 
    268         if (zend_u_hash_quick_find(CE_STATIC_MEMBERS(src->parent), BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, b->h, (void **) &parentzv) == SUCCESS) { 
    269             zval **zv = (zval **) b->pData; 
    270             if (*parentzv == *zv) { 
    271                 return ZEND_HASH_APPLY_REMOVE; 
    272             } 
    273         } 
    274     } 
    275     return ZEND_HASH_APPLY_KEEP; 
    276 } 
    277 /* }}} */ 
    278 /* fix static members on restore */ 
    279 static void inherit_static_prop(zval **p) /* {{{ */ 
    280 { 
    281     /* already set */ 
    282 #if 0 
    283     (*p)->refcount++; 
    284     (*p)->is_ref = 1; 
    285 #endif 
    286 } 
    287 /* }}} */ 
    288 static void xc_fix_static_members(xc_processor_t *processor, zend_class_entry *dst TSRMLS_DC) /* {{{ */ 
    289 { 
    290     zend_hash_merge(&dst->default_static_members, &dst->parent->default_static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0); 
    291 } 
    292 /* }}} */ 
    293 #endif 
    294 int xc_hash_reset_zval_refcount_applyer(void *pDest TSRMLS_DC) /* {{{ */ 
    295 { 
    296     zval **zv = (zval **) pDest; 
    297     ZVAL_REFCOUNT(*zv) = 1; 
    298     return ZEND_HASH_APPLY_KEEP; 
    299 } 
    300 /* }}} */ 
    301 static void xc_hash_reset_zval_refcount(HashTable *hash TSRMLS_DC) /* {{{ */ 
    302 { 
    303     zend_hash_apply(hash, xc_hash_reset_zval_refcount_applyer TSRMLS_CC); 
    304 } 
    305 /* }}} */ 
     264#endif 
    306265/* {{{ call op_array ctor handler */ 
    307266extern zend_bool xc_have_op_array_ctor; 
     
    320279 
    321280    memset(&processor, 0, sizeof(processor)); 
    322     if (src->type == XC_TYPE_VAR) { 
    323         processor.reference = 1; 
    324     } 
     281    processor.reference = 1; 
    325282 
    326283    IFASSERT(`xc_stack_init(&processor.allocsizes);') 
     
    343300    } 
    344301    src->size = processor.size; 
     302    src->have_references = processor.have_references; 
    345303 
    346304    IFASSERT(`xc_stack_reverse(&processor.allocsizes);') 
     
    394352    memset(&processor, 0, sizeof(processor)); 
    395353    processor.readonly_protection = readonly_protection; 
    396  
     354    if (src->have_references) { 
     355        processor.reference = 1; 
     356    } 
     357 
     358    if (processor.reference) { 
     359        zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0); 
     360    } 
    397361    xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC); 
     362    if (processor.reference) { 
     363        zend_hash_destroy(&processor.zvalptrs); 
     364    } 
    398365    return dst; 
    399366} 
    400367/* }}} */ 
    401 /* export: zval *xc_processor_restore_zval(zval *dst, const zval *src TSRMLS_DC); :export {{{ */ 
    402 zval *xc_processor_restore_zval(zval *dst, const zval *src TSRMLS_DC) { 
     368/* export: zval *xc_processor_restore_zval(zval *dst, const zval *src, zend_bool have_references TSRMLS_DC); :export {{{ */ 
     369zval *xc_processor_restore_zval(zval *dst, const zval *src, zend_bool have_references TSRMLS_DC) { 
    403370    xc_processor_t processor; 
    404371 
    405372    memset(&processor, 0, sizeof(processor)); 
    406     processor.reference = 1; 
    407  
    408     zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0); 
    409     dnl fprintf(stderr, "mark[%p] = %p\n", src, dst); 
    410     zend_hash_add(&processor.zvalptrs, (char *)src, sizeof(src), (void*)&dst, sizeof(dst), NULL); 
     373    processor.reference = have_references; 
     374 
     375    if (processor.reference) { 
     376        zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0); 
     377        dnl fprintf(stderr, "mark[%p] = %p\n", src, dst); 
     378        zend_hash_add(&processor.zvalptrs, (char *)src, sizeof(src), (void*)&dst, sizeof(dst), NULL); 
     379    } 
    411380    xc_restore_zval(&processor, dst, src TSRMLS_CC); 
    412     zend_hash_destroy(&processor.zvalptrs); 
     381    if (processor.reference) { 
     382        zend_hash_destroy(&processor.zvalptrs); 
     383    } 
    413384 
    414385    return dst; 
Note: See TracChangeset for help on using the changeset viewer.