Changeset 233
- Timestamp:
- 2006-10-10T02:46:00+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
processor/head.m4 (modified) (5 diffs)
-
processor/main.m4 (modified) (1 diff)
-
processor/processor.m4 (modified) (5 diffs)
-
xcache-test.ini (modified) (1 diff)
-
xcache.c (modified) (2 diffs)
-
xcache.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/processor/head.m4
r230 r233 62 62 HashTable zvalptrs; 63 63 zend_bool reference; /* enable if to deal with reference */ 64 zend_bool have_references; 64 65 const xc_entry_t *xce_src; 65 66 const xc_entry_t *xce_dst; … … 261 262 } 262 263 /* }}} */ 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 306 265 /* {{{ call op_array ctor handler */ 307 266 extern zend_bool xc_have_op_array_ctor; … … 320 279 321 280 memset(&processor, 0, sizeof(processor)); 322 if (src->type == XC_TYPE_VAR) { 323 processor.reference = 1; 324 } 281 processor.reference = 1; 325 282 326 283 IFASSERT(`xc_stack_init(&processor.allocsizes);') … … 343 300 } 344 301 src->size = processor.size; 302 src->have_references = processor.have_references; 345 303 346 304 IFASSERT(`xc_stack_reverse(&processor.allocsizes);') … … 394 352 memset(&processor, 0, sizeof(processor)); 395 353 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 } 397 361 xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC); 362 if (processor.reference) { 363 zend_hash_destroy(&processor.zvalptrs); 364 } 398 365 return dst; 399 366 } 400 367 /* }}} */ 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 {{{ */ 369 zval *xc_processor_restore_zval(zval *dst, const zval *src, zend_bool have_references TSRMLS_DC) { 403 370 xc_processor_t processor; 404 371 405 372 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 } 411 380 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 } 413 384 414 385 return dst; -
trunk/processor/main.m4
r198 r233 11 11 define(`m4_errprint', `ONCE(`errprint(`$1 12 12 ')')') 13 define(`ZEND_STRS', `($1), (sizeof($1))') 14 define(`ZEND_STRL', `($1), (sizeof($1) - 1)') 13 15 dnl ============ 14 16 define(`INDENT', `xc_dprint_indent(indent);') -
trunk/processor/processor.m4
r231 r233 67 67 dnl }}} 68 68 DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr', `zval_ptr') 69 DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr_static_member_check', `zval_ptr', , `xc_hash_static_member_check(processor, BUCKET TSRMLS_CC)')70 69 #ifdef HAVE_XCACHE_CONSTANT 71 70 DEF_HASH_TABLE_FUNC(`HashTable_zend_constant', `zend_constant') … … 168 167 dnl fprintf(stderr, "*dst is set to %p\n", dst[0]); 169 168 ') 169 IFCALCSTORE(`processor->have_references = 1;') 170 170 IFSTORE(`assert(xc_is_shm(dst[0]));') 171 171 IFRESTORE(`assert(!xc_is_shm(dst[0]));') … … 300 300 301 301 STRUCT(HashTable, default_properties, HashTable_zval_ptr) 302 IFSTORE(`xc_hash_reset_zval_refcount(&dst->default_properties TSRMLS_CC);')303 302 IFCOPY(`dst->builtin_functions = src->builtin_functions;') 304 303 DONE(builtin_functions) … … 306 305 STRUCT(HashTable, properties_info, HashTable_zend_property_info) 307 306 # ifdef ZEND_ENGINE_2_1 308 STRUCT(HashTable, default_static_members, IFCALCSTORE(HashTable_zval_ptr_static_member_check, HashTable_zval_ptr))307 STRUCT(HashTable, default_static_members, HashTable_zval_ptr) 309 308 IFCOPY(`dst->static_members = &dst->default_static_members;') 310 IFRESTORE(`if (dst->parent) xc_fix_static_members(processor, dst TSRMLS_CC);')311 309 DONE(static_members) 312 310 # else 313 STRUCT_P(HashTable, static_members, IFCALCSTORE(HashTable_zval_ptr_static_member_check, HashTable_zval_ptr))311 STRUCT_P(HashTable, static_members, HashTable_zval_ptr) 314 312 # endif 315 313 STRUCT(HashTable, constants_table, HashTable_zval_ptr) 316 IFSTORE(`xc_hash_reset_zval_refcount(&dst->constants_table TSRMLS_CC);')317 314 318 315 dnl runtime binding: ADD_INTERFACE will deal with it … … 815 812 DONE(data) 816 813 dnl }}} 814 DISPATCH(zend_bool, have_references) 817 815 ') 818 816 dnl }}} -
trunk/xcache-test.ini
r225 r233 6 6 zend_extension_ts=./modules/xcache.so 7 7 zend_extension=./modules/xcache.so 8 xcache.cacher = O n8 xcache.cacher = Off 9 9 xcache.test=1 10 10 xcache.size = 1M -
trunk/xcache.c
r230 r233 1673 1673 if (stored_xce) { 1674 1674 if (XG(request_time) <= stored_xce->ctime + stored_xce->ttl) { 1675 xc_processor_restore_zval(return_value, stored_xce->data.var->value TSRMLS_CC);1675 xc_processor_restore_zval(return_value, stored_xce->data.var->value, stored_xce->have_references TSRMLS_CC); 1676 1676 /* return */ 1677 1677 break; … … 1830 1830 fprintf(stderr, "incdec: notlong\n"); 1831 1831 #endif 1832 xc_processor_restore_zval(&oldzval, stored_xce->data.var->value TSRMLS_CC);1832 xc_processor_restore_zval(&oldzval, stored_xce->data.var->value, stored_xce->have_references TSRMLS_CC); 1833 1833 convert_to_long(&oldzval); 1834 1834 value = Z_LVAL(oldzval); -
trunk/xcache.h
r212 r233 249 249 xc_entry_data_var_t *var; 250 250 } data; 251 252 zend_bool have_references; 251 253 }; 252 254 /* }}} */
Note: See TracChangeset
for help on using the changeset viewer.

