Changeset 311 for trunk/processor
- Timestamp:
- 12/09/2006 04:27:03 PM (2 years ago)
- Location:
- trunk/processor
- Files:
-
- 4 modified
-
dispatch.m4 (modified) (1 diff)
-
head.m4 (modified) (11 diffs)
-
main.m4 (modified) (2 diffs)
-
processor.m4 (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/processor/dispatch.m4
r1 r311 23 23 , `$1', `xc_entry_type_t', `PROC_INT(`$2', `d', `$1')' 24 24 , `$1', `xc_hash_value_t', `PROC_INT(`$2', `lu', `$1')' 25 , `$1', `xc_md5sum_t', `/* is copying enough? */COPY(`$2')' 25 26 , `', `', `m4_errprint(`Unknown type "$1"')' 26 27 ) -
trunk/processor/head.m4
r300 r311 65 65 zend_bool reference; /* enable if to deal with reference */ 66 66 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; 69 70 const zend_class_entry *cache_ce; 70 71 zend_uint cache_class_num; … … 186 187 static zend_ulong xc_get_class_num(xc_processor_t *processor, zend_class_entry *ce) { 187 188 zend_ulong i; 188 const xc_entry_ t *xce = processor->xce_src;189 const xc_entry_data_php_t *php = processor->php_src; 189 190 zend_class_entry *ceptr; 190 191 … … 192 193 return processor->cache_class_num; 193 194 } 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); 196 197 if (ZCEP_REFCOUNT_PTR(ceptr) == ZCEP_REFCOUNT_PTR(ce)) { 197 198 processor->cache_ce = ceptr; … … 209 210 /* must be parent or currrent class */ 210 211 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); 212 213 } 213 214 #endif … … 275 276 /* }}} */ 276 277 dnl ================ 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; 278 define(`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; 280 282 xc_processor_t processor; 281 283 282 284 memset(&processor, 0, sizeof(processor)); 283 285 processor.reference = 1; 286 processor.cache = src->cache; 284 287 285 288 IFASSERT(`xc_stack_init(&processor.allocsizes);') … … 295 298 processor.size = ALIGN(processor.size + sizeof(src[0])); 296 299 297 xc_calc_ xc_entry_t(&processor, src TSRMLS_CC);300 xc_calc_$1(&processor, src TSRMLS_CC); 298 301 if (processor.reference) { 299 302 zend_hash_destroy(&processor.zvalptrs); … … 302 305 } 303 306 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 ') 305 312 306 313 IFASSERT(`xc_stack_reverse(&processor.allocsizes);') … … 314 321 315 322 /* 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); 317 324 if (processor.p == NULL) { 318 325 dst = NULL; … … 323 330 324 331 /* allocate */ 325 dst = ( xc_entry_t*) processor.p;332 dst = ($1 *) processor.p; 326 333 processor.p = (char *) ALIGN(processor.p + sizeof(dst[0])); 327 334 328 xc_store_ xc_entry_t(&processor, dst, src TSRMLS_CC);335 xc_store_$1(&processor, dst, src TSRMLS_CC); 329 336 IFASSERT(` { 330 337 int real = processor.p - oldp; … … 348 355 } 349 356 /* }}} */ 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 ') 358 DEFINE_STORE_API(`xc_entry_t') 359 DEFINE_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 {{{ */ 361 xc_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 {{{ */ 371 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) { 352 372 xc_processor_t processor; 353 373 354 374 memset(&processor, 0, sizeof(processor)); 355 375 processor.readonly_protection = readonly_protection; 376 /* this function is used for php data only */ 356 377 if (src->have_references) { 357 378 processor.reference = 1; … … 361 382 zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0); 362 383 } 363 xc_restore_xc_entry_ t(&processor, dst, src TSRMLS_CC);384 xc_restore_xc_entry_data_php_t(&processor, dst, src TSRMLS_CC); 364 385 if (processor.reference) { 365 386 zend_hash_destroy(&processor.zvalptrs); -
trunk/processor/main.m4
r307 r311 136 136 define(`FIXPOINTER', `FIXPOINTER_EX(`$1', `dst->$2')') 137 137 define(`FIXPOINTER_EX', `IFSTORE(` 138 $2 = ($1 *) processor-> xce_src->cache->shm->handlers->to_readonly(processor->xce_src->cache->shm, (char *)$2);138 $2 = ($1 *) processor->cache->shm->handlers->to_readonly(processor->cache->shm, (char *)$2); 139 139 ')') 140 140 define(`UNFIXPOINTER', `UNFIXPOINTER_EX(`$1', `dst->$2')') 141 141 define(`UNFIXPOINTER_EX', `IFSTORE(` 142 $2 = ($1 *) processor-> xce_src->cache->shm->handlers->to_readwrite(processor->xce_src->cache->shm, (char *)$2);142 $2 = ($1 *) processor->cache->shm->handlers->to_readwrite(processor->cache->shm, (char *)$2); 143 143 ')') 144 144 dnl }}} 145 145 dnl {{{ COPY 146 146 define(`COPY', `IFNOTMEMCPY(`IFCOPY(`dst->$1 = src->$1;')')DONE(`$1')') 147 dnl }}} 148 dnl {{{ COPYPOINTER 149 define(`COPYPOINTER', `COPY(`$1')') 150 dnl }}} 151 dnl {{{ COPYARRAY 152 define(`COPYARRAY', `IFNOTMEMCPY(`IFCOPY(`memcpy(dst->$1, src->$1, sizeof(dst->$1));')')DONE(`$1')') 147 153 dnl }}} 148 154 dnl {{{ SETNULL_EX … … 223 229 EXPORT(`xc_funcinfo_t') 224 230 EXPORT(`xc_entry_t') 231 EXPORT(`xc_entry_data_php_t') 225 232 EXPORT(`zval') 226 233 -
trunk/processor/processor.m4
r310 r311 479 479 dnl readonly_protection=on 480 480 dnl main op_array && have early binding 481 if (!processor->readonly_protection && !(src == processor-> xce_src->data.php->op_array && processor->xce_src->data.php->have_early_binding)) {481 if (!processor->readonly_protection && !(src == processor->php_src->op_array && processor->php_src->have_early_binding)) { 482 482 /* really fast shallow copy */ 483 483 memcpy(dst, src, sizeof(src[0])); … … 719 719 zend_uint i; 720 720 721 #ifdef HAVE_INODE 722 DISPATCH(int, device) 723 DISPATCH(int, inode) 724 #endif 721 IFCOPY(` 722 processor->php_dst = dst; 723 processor->php_src = src; 724 ') 725 726 DISPATCH(xc_hash_value_t, hvalue) 727 /* skip */ 728 DONE(next) 729 COPY(cache) 730 DISPATCH(xc_md5sum_t, md5) 731 DISPATCH(zend_ulong, refcount) 732 725 733 DISPATCH(size_t, sourcesize) 726 727 DISPATCH( time_t, mtime)734 DISPATCH(zend_ulong, hits) 735 DISPATCH(size_t, size) 728 736 729 737 STRUCT_P(zend_op_array, op_array) … … 750 758 DISPATCH(zend_bool, have_early_binding) 751 759 popdef(`BEFORE_LOOP') 760 DISPATCH(zend_bool, have_references) 752 761 ') 753 762 dnl }}} … … 755 764 IFDPRINT(`INDENT()`'fprintf(stderr, "zval:value");') 756 765 STRUCT_P_EX(zval_ptr, dst->value, src->value, `value', `', `&') 766 DISPATCH(zend_bool, have_references) 757 767 DONE(value) 758 768 ') … … 760 770 dnl {{{ xc_entry_t 761 771 DEF_STRUCT_P_FUNC(`xc_entry_t', , ` 762 IFCOPY(`763 processor->xce_dst = dst;764 processor->xce_src = src;765 ')766 772 DISPATCH(xc_entry_type_t, type) 767 773 DISPATCH(size_t, size) … … 809 815 switch (src->type) { 810 816 case XC_TYPE_PHP: 811 STRUCT_P(xc_entry_data_php_t, data.php)817 IFCALCCOPY(`DONE(data.php)', `STRUCT_P(xc_entry_data_php_t, data.php)') 812 818 break; 819 813 820 case XC_TYPE_VAR: 814 821 STRUCT_P(xc_entry_data_var_t, data.var) 815 822 break; 823 816 824 default: 817 825 assert(0); … … 820 828 DONE(data) 821 829 dnl }}} 822 DISPATCH(zend_bool, have_references) 830 DISPATCH(time_t, mtime) 831 #ifdef HAVE_INODE 832 DISPATCH(int, device) 833 DISPATCH(int, inode) 834 #endif 823 835 ') 824 836 dnl }}}

