Changeset 865
- Timestamp:
- 03/29/2012 08:14:57 AM (14 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
processor/head.m4 (modified) (2 diffs)
-
xcache.c (modified) (37 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/processor/head.m4
r860 r865 482 482 } 483 483 /* }}} */ 484 /* 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 {{{ */485 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) {484 /* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *entry_php, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */ 485 xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php_t *entry_php, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) { 486 486 xc_processor_t processor; 487 487 … … 492 492 processor.reference = 1; 493 493 } 494 processor.entry_php_src = xce;494 processor.entry_php_src = entry_php; 495 495 496 496 if (processor.reference) { -
trunk/xcache.c
r864 r865 276 276 } 277 277 /* }}} */ 278 static void xc_entry_add_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t * xce) /* {{{ */278 static void xc_entry_add_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry) /* {{{ */ 279 279 { 280 280 xc_entry_t **head = &(cache->entries[entryslotid]); 281 xce->next = *head;282 *head = xce;281 entry->next = *head; 282 *head = entry; 283 283 cache->entries_count ++; 284 284 } 285 285 /* }}} */ 286 static xc_entry_t *xc_entry_store_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t * xceTSRMLS_DC) /* {{{ */287 { 288 xc_entry_t *stored_ xce;289 290 xce->hits = 0;291 xce->ctime = XG(request_time);292 xce->atime = XG(request_time);293 stored_ xce= type == XC_TYPE_PHP294 ? (xc_entry_t *) xc_processor_store_xc_entry_php_t(cache, (xc_entry_php_t *) xceTSRMLS_CC)295 : (xc_entry_t *) xc_processor_store_xc_entry_var_t(cache, (xc_entry_var_t *) xceTSRMLS_CC);296 if (stored_ xce) {297 xc_entry_add_dmz(cache, entryslotid, stored_ xce);298 return stored_ xce;286 static xc_entry_t *xc_entry_store_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */ 287 { 288 xc_entry_t *stored_entry; 289 290 entry->hits = 0; 291 entry->ctime = XG(request_time); 292 entry->atime = XG(request_time); 293 stored_entry = type == XC_TYPE_PHP 294 ? (xc_entry_t *) xc_processor_store_xc_entry_php_t(cache, (xc_entry_php_t *) entry TSRMLS_CC) 295 : (xc_entry_t *) xc_processor_store_xc_entry_var_t(cache, (xc_entry_var_t *) entry TSRMLS_CC); 296 if (stored_entry) { 297 xc_entry_add_dmz(cache, entryslotid, stored_entry); 298 return stored_entry; 299 299 } 300 300 else { … … 304 304 } 305 305 /* }}} */ 306 static xc_entry_php_t *xc_entry_php_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_php_t * xceTSRMLS_DC) /* {{{ */307 { 308 return (xc_entry_php_t *) xc_entry_store_dmz(XC_TYPE_PHP, cache, entryslotid, (xc_entry_t *) xceTSRMLS_CC);309 } 310 /* }}} */ 311 static xc_entry_var_t *xc_entry_var_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_var_t * xceTSRMLS_DC) /* {{{ */312 { 313 return (xc_entry_var_t *) xc_entry_store_dmz(XC_TYPE_VAR, cache, entryslotid, (xc_entry_t *) xceTSRMLS_CC);314 } 315 /* }}} */ 316 static void xc_entry_free_real_dmz(xc_entry_type_t type, xc_cache_t *cache, volatile xc_entry_t * xce) /* {{{ */306 static xc_entry_php_t *xc_entry_php_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */ 307 { 308 return (xc_entry_php_t *) xc_entry_store_dmz(XC_TYPE_PHP, cache, entryslotid, (xc_entry_t *) entry_php TSRMLS_CC); 309 } 310 /* }}} */ 311 static xc_entry_var_t *xc_entry_var_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_var_t *entry_var TSRMLS_DC) /* {{{ */ 312 { 313 return (xc_entry_var_t *) xc_entry_store_dmz(XC_TYPE_VAR, cache, entryslotid, (xc_entry_t *) entry_var TSRMLS_CC); 314 } 315 /* }}} */ 316 static void xc_entry_free_real_dmz(xc_entry_type_t type, xc_cache_t *cache, volatile xc_entry_t *entry) /* {{{ */ 317 317 { 318 318 if (type == XC_TYPE_PHP) { 319 xc_php_release_dmz(cache, ((xc_entry_php_t *) xce)->php);320 } 321 cache->mem->handlers->free(cache->mem, (xc_entry_t *) xce);322 } 323 /* }}} */ 324 static void xc_entry_free_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_entry_t * xceTSRMLS_DC) /* {{{ */319 xc_php_release_dmz(cache, ((xc_entry_php_t *) entry)->php); 320 } 321 cache->mem->handlers->free(cache->mem, (xc_entry_t *)entry); 322 } 323 /* }}} */ 324 static void xc_entry_free_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_entry_t *entry TSRMLS_DC) /* {{{ */ 325 325 { 326 326 cache->entries_count --; 327 if ((type == XC_TYPE_PHP ? ((xc_entry_php_t *) xce)->refcount : 0) == 0) {328 xc_entry_free_real_dmz(type, cache, xce);327 if ((type == XC_TYPE_PHP ? ((xc_entry_php_t *) entry)->refcount : 0) == 0) { 328 xc_entry_free_real_dmz(type, cache, entry); 329 329 } 330 330 else { 331 xce->next = cache->deletes;332 cache->deletes = xce;333 xce->dtime = XG(request_time);331 entry->next = cache->deletes; 332 cache->deletes = entry; 333 entry->dtime = XG(request_time); 334 334 cache->deletes_count ++; 335 335 } … … 337 337 } 338 338 /* }}} */ 339 static void xc_entry_remove_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t * xceTSRMLS_DC) /* {{{ */339 static void xc_entry_remove_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */ 340 340 { 341 341 xc_entry_t **pp = &(cache->entries[entryslotid]); 342 342 xc_entry_t *p; 343 343 for (p = *pp; p; pp = &(p->next), p = p->next) { 344 if (xc_entry_equal_dmz(type, xce, p)) {344 if (xc_entry_equal_dmz(type, entry, p)) { 345 345 /* unlink */ 346 346 *pp = p->next; 347 xc_entry_free_dmz(type, cache, xceTSRMLS_CC);347 xc_entry_free_dmz(type, cache, entry TSRMLS_CC); 348 348 return; 349 349 } … … 352 352 } 353 353 /* }}} */ 354 static xc_entry_t *xc_entry_find_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t * xceTSRMLS_DC) /* {{{ */354 static xc_entry_t *xc_entry_find_dmz(xc_entry_type_t type, xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_t *entry TSRMLS_DC) /* {{{ */ 355 355 { 356 356 xc_entry_t *p; 357 357 for (p = cache->entries[entryslotid]; p; p = p->next) { 358 if (xc_entry_equal_dmz(type, xce, p)) {358 if (xc_entry_equal_dmz(type, entry, p)) { 359 359 zend_bool fresh; 360 360 switch (type) { … … 362 362 { 363 363 xc_entry_php_t *p_php = (xc_entry_php_t *) p; 364 xc_entry_php_t * xce_php = (xc_entry_php_t *) xce;365 fresh = p_php->file_mtime == xce_php->file_mtime && p_php->file_size == xce_php->file_size;364 xc_entry_php_t *entry_php = (xc_entry_php_t *) entry; 365 fresh = p_php->file_mtime == entry_php->file_mtime && p_php->file_size == entry_php->file_size; 366 366 } 367 367 break; … … 397 397 } 398 398 /* }}} */ 399 #if 0400 static void xc_entry_hold_var_dmz(xc_entry_t *xce TSRMLS_DC) /* {{{ */401 {402 xce->refcount ++;403 xc_stack_push(&XG(var_holds)[xce->cache->cacheid], (void *)xce);404 }405 /* }}} */406 #endif407 399 static inline zend_uint advance_wrapped(zend_uint val, zend_uint count) /* {{{ */ 408 400 { … … 765 757 /* }}} */ 766 758 767 static zend_op_array *xc_entry_install(xc_entry_php_t * xce, zend_file_handle *h TSRMLS_DC) /* {{{ */759 static zend_op_array *xc_entry_install(xc_entry_php_t *entry_php, zend_file_handle *h TSRMLS_DC) /* {{{ */ 768 760 { 769 761 zend_uint i; 770 xc_entry_data_php_t *p = xce->php;762 xc_entry_data_php_t *p = entry_php->php; 771 763 zend_op_array *old_active_op_array = CG(active_op_array); 772 764 #ifndef ZEND_ENGINE_2 … … 782 774 for (i = 0; i < p->constinfo_cnt; i ++) { 783 775 xc_constinfo_t *ci = &p->constinfos[i]; 784 xc_install_constant( xce->entry.name.str.val, &ci->constant,776 xc_install_constant(entry_php->entry.name.str.val, &ci->constant, 785 777 UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC); 786 778 } … … 790 782 for (i = 0; i < p->funcinfo_cnt; i ++) { 791 783 xc_funcinfo_t *fi = &p->funcinfos[i]; 792 xc_install_function( xce->entry.name.str.val, &fi->func,784 xc_install_function(entry_php->entry.name.str.val, &fi->func, 793 785 UNISW(0, fi->type), fi->key, fi->key_size, fi->h TSRMLS_CC); 794 786 } … … 808 800 #endif 809 801 #ifdef ZEND_COMPILE_DELAYED_BINDING 810 xc_install_class( xce->entry.name.str.val, &ci->cest, -1,802 xc_install_class(entry_php->entry.name.str.val, &ci->cest, -1, 811 803 UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC); 812 804 #else 813 xc_install_class( xce->entry.name.str.val, &ci->cest, ci->oplineno,805 xc_install_class(entry_php->entry.name.str.val, &ci->cest, ci->oplineno, 814 806 UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC); 815 807 #endif … … 834 826 835 827 i = 1; 836 zend_hash_add(&EG(included_files), xce->entry.name.str.val, xce->entry.name.str.len+1, (void *)&i, sizeof(int), NULL);828 zend_hash_add(&EG(included_files), entry_php->entry.name.str.val, entry_php->entry.name.str.len+1, (void *)&i, sizeof(int), NULL); 837 829 if (h) { 838 830 zend_llist_add_element(&CG(open_files), h); … … 852 844 xc_stack_t *s; 853 845 xc_cache_t *cache; 854 xc_entry_php_t * xce;846 xc_entry_php_t *entry_php; 855 847 856 848 for (i = 0; i < cachecount; i ++) { … … 861 853 ENTER_LOCK(cache) { 862 854 while (xc_stack_count(s)) { 863 xce= (xc_entry_php_t *) xc_stack_pop(s);864 TRACE("unhold %d:%s", xce->file_inode, xce->entry.name.str.val);865 xce->refcount ++;866 assert( xce->refcount >= 0);855 entry_php = (xc_entry_php_t *) xc_stack_pop(s); 856 TRACE("unhold %d:%s", entry_php->file_inode, entry_php->entry.name.str.val); 857 entry_php->refcount ++; 858 assert(entry_php->refcount >= 0); 867 859 } 868 860 } LEAVE_LOCK(cache); … … 948 940 } 949 941 /* }}} */ 950 static inline xc_hash_value_t xc_entry_hash_name(xc_entry_t * xceTSRMLS_DC) /* {{{ */951 { 952 return UNISW(NOTHING, UG(unicode) ? HASH_ZSTR_L( xce->name_type, xce->name.uni.val, xce->name.uni.len) :)953 HASH_STR_L( xce->name.str.val, xce->name.str.len);954 } 955 /* }}} */ 956 static inline xc_hash_value_t xc_entry_hash_php_basename(xc_entry_php_t * xceTSRMLS_DC) /* {{{ */942 static inline xc_hash_value_t xc_entry_hash_name(xc_entry_t *entry TSRMLS_DC) /* {{{ */ 943 { 944 return UNISW(NOTHING, UG(unicode) ? HASH_ZSTR_L(entry->name_type, entry->name.uni.val, entry->name.uni.len) :) 945 HASH_STR_L(entry->name.str.val, entry->name.str.len); 946 } 947 /* }}} */ 948 static inline xc_hash_value_t xc_entry_hash_php_basename(xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */ 957 949 { 958 950 #ifdef IS_UNICODE 959 if (UG(unicode) && xce->entry.name_type == IS_UNICODE) {951 if (UG(unicode) && entry_php->entry.name_type == IS_UNICODE) { 960 952 zstr basename; 961 953 size_t basename_len; 962 php_u_basename( xce->entry.name.ustr.val, xce->entry.name.ustr.len, NULL, 0, &basename.u, &basename_len TSRMLS_CC);954 php_u_basename(entry_php->entry.name.ustr.val, entry_php->entry.name.ustr.len, NULL, 0, &basename.u, &basename_len TSRMLS_CC); 963 955 return HASH_ZSTR_L(IS_UNICODE, basename, basename_len); 964 956 } … … 970 962 size_t basename_len; 971 963 #ifdef ZEND_ENGINE_2 972 php_basename( xce->entry.name.str.val, xce->entry.name.str.len, "", 0, &basename, &basename_len TSRMLS_CC);964 php_basename(entry_php->entry.name.str.val, entry_php->entry.name.str.len, "", 0, &basename, &basename_len TSRMLS_CC); 973 965 #else 974 basename = php_basename( xce->entry.name.str.val, xce->entry.name.str.len, "", 0);966 basename = php_basename(entry_php->entry.name.str.val, entry_php->entry.name.str.len, "", 0); 975 967 basename_len = strlen(basename); 976 968 #endif … … 982 974 /* }}} */ 983 975 #define xc_entry_hash_var xc_entry_hash_name 984 static void xc_entry_free_key_php(xc_entry_php_t * xceTSRMLS_DC) /* {{{ */976 static void xc_entry_free_key_php(xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */ 985 977 { 986 978 #define X_FREE(var) do {\ 987 if ( xce->var) { \988 efree( xce->var); \979 if (entry_php->var) { \ 980 efree(entry_php->var); \ 989 981 } \ 990 982 } while (0) … … 1322 1314 } 1323 1315 /* }}} */ 1324 void xc_fix_op_array_info(const xc_entry_php_t * xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */1316 void xc_fix_op_array_info(const xc_entry_php_t *entry_php, const xc_entry_data_php_t *php, zend_op_array *op_array, int shallow_copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */ 1325 1317 { 1326 1318 int i; … … 1336 1328 } 1337 1329 if (Z_TYPE(literal->constant) == IS_STRING) { 1338 assert( xce->filepath);1339 ZVAL_STRINGL(&literal->constant, xce->filepath, xce->filepath_len, !shallow_copy);1340 TRACE("restored literal constant: %s", xce->filepath);1330 assert(entry_php->filepath); 1331 ZVAL_STRINGL(&literal->constant, entry_php->filepath, entry_php->filepath_len, !shallow_copy); 1332 TRACE("restored literal constant: %s", entry_php->filepath); 1341 1333 } 1342 1334 #ifdef IS_UNICODE 1343 1335 else if (Z_TYPE(literal->constant) == IS_UNICODE) { 1344 assert( xce->ufilepath);1345 ZVAL_UNICODEL(&literal->constant, xce->ufilepath, xce->ufilepath_len, !shallow_copy);1336 assert(entry_php->ufilepath); 1337 ZVAL_UNICODEL(&literal->constant, entry_php->ufilepath, entry_php->ufilepath_len, !shallow_copy); 1346 1338 } 1347 1339 #endif … … 1355 1347 } 1356 1348 if (Z_TYPE(literal->constant) == IS_STRING) { 1357 assert( xce->dirpath);1358 TRACE("restored literal constant: %s", xce->dirpath);1359 ZVAL_STRINGL(&literal->constant, xce->dirpath, xce->dirpath_len, !shallow_copy);1349 assert(entry_php->dirpath); 1350 TRACE("restored literal constant: %s", entry_php->dirpath); 1351 ZVAL_STRINGL(&literal->constant, entry_php->dirpath, entry_php->dirpath_len, !shallow_copy); 1360 1352 } 1361 1353 #ifdef IS_UNICODE 1362 1354 else if (Z_TYPE(literal->constant) == IS_UNICODE) { 1363 assert(! xce->udirpath);1364 ZVAL_UNICODEL(&literal->constant, xce->udirpath, xce->udirpath_len, !shallow_copy);1355 assert(!entry_php->udirpath); 1356 ZVAL_UNICODEL(&literal->constant, entry_php->udirpath, entry_php->udirpath_len, !shallow_copy); 1365 1357 } 1366 1358 #endif … … 1381 1373 } 1382 1374 if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_STRING) { 1383 assert( xce->filepath);1384 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), xce->filepath, xce->filepath_len, !shallow_copy);1385 TRACE("restored op1 constant: %s", xce->filepath);1375 assert(entry_php->filepath); 1376 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), entry_php->filepath, entry_php->filepath_len, !shallow_copy); 1377 TRACE("restored op1 constant: %s", entry_php->filepath); 1386 1378 } 1387 1379 #ifdef IS_UNICODE 1388 1380 else if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_UNICODE) { 1389 assert( xce->ufilepath);1390 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), xce->ufilepath, xce->ufilepath_len, !shallow_copy);1381 assert(entry_php->ufilepath); 1382 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), entry_php->ufilepath, entry_php->ufilepath_len, !shallow_copy); 1391 1383 } 1392 1384 #endif … … 1401 1393 } 1402 1394 if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_STRING) { 1403 assert( xce->dirpath);1404 TRACE("restored op1 constant: %s", xce->dirpath);1405 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), xce->dirpath, xce->dirpath_len, !shallow_copy);1395 assert(entry_php->dirpath); 1396 TRACE("restored op1 constant: %s", entry_php->dirpath); 1397 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op1), entry_php->dirpath, entry_php->dirpath_len, !shallow_copy); 1406 1398 } 1407 1399 #ifdef IS_UNICODE 1408 1400 else if (Z_TYPE(Z_OP_CONSTANT(opline->op1)) == IS_UNICODE) { 1409 assert(! xce->udirpath);1410 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), xce->udirpath, xce->udirpath_len, !shallow_copy);1401 assert(!entry_php->udirpath); 1402 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op1), entry_php->udirpath, entry_php->udirpath_len, !shallow_copy); 1411 1403 } 1412 1404 #endif … … 1422 1414 } 1423 1415 if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_STRING) { 1424 assert( xce->filepath);1425 TRACE("restored op2 constant: %s", xce->filepath);1426 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), xce->filepath, xce->filepath_len, !shallow_copy);1416 assert(entry_php->filepath); 1417 TRACE("restored op2 constant: %s", entry_php->filepath); 1418 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), entry_php->filepath, entry_php->filepath_len, !shallow_copy); 1427 1419 } 1428 1420 #ifdef IS_UNICODE 1429 1421 else if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_UNICODE) { 1430 assert( xce->ufilepath);1431 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), xce->ufilepath, xce->ufilepath_len, !shallow_copy);1422 assert(entry_php->ufilepath); 1423 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), entry_php->ufilepath, entry_php->ufilepath_len, !shallow_copy); 1432 1424 } 1433 1425 #endif … … 1442 1434 } 1443 1435 if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_STRING) { 1444 assert(! xce->dirpath);1445 TRACE("restored op2 constant: %s", xce->dirpath);1446 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), xce->dirpath, xce->dirpath_len, !shallow_copy);1436 assert(!entry_php->dirpath); 1437 TRACE("restored op2 constant: %s", entry_php->dirpath); 1438 ZVAL_STRINGL(&Z_OP_CONSTANT(opline->op2), entry_php->dirpath, entry_php->dirpath_len, !shallow_copy); 1447 1439 } 1448 1440 #ifdef IS_UNICODE 1449 1441 else if (Z_TYPE(Z_OP_CONSTANT(opline->op2)) == IS_UNICODE) { 1450 assert(! xce->udirpath);1451 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), xce->udirpath, xce->udirpath_len, !shallow_copy);1442 assert(!entry_php->udirpath); 1443 ZVAL_UNICODEL(&Z_OP_CONSTANT(opline->op2), entry_php->udirpath, entry_php->udirpath_len, !shallow_copy); 1452 1444 } 1453 1445 #endif … … 2660 2652 } while (0) 2661 2653 2662 static int xc_entry_ init_key_var(xc_entry_hash_t *entry_hash, xc_entry_var_t *xce, zval *name TSRMLS_DC) /* {{{ */2654 static int xc_entry_var_init_key(xc_entry_var_t *entry_var, xc_entry_hash_t *entry_hash, zval *name TSRMLS_DC) /* {{{ */ 2663 2655 { 2664 2656 xc_hash_value_t hv; … … 2678 2670 2679 2671 #ifdef IS_UNICODE 2680 xce->entry.name_type = name->type;2681 #endif 2682 xce->entry.name = name->value;2683 2684 hv = xc_entry_hash_var((xc_entry_t *) xceTSRMLS_CC);2672 entry_var->entry.name_type = name->type; 2673 #endif 2674 entry_var->entry.name = name->value; 2675 2676 hv = xc_entry_hash_var((xc_entry_t *) entry_var TSRMLS_CC); 2685 2677 2686 2678 entry_hash->cacheid = (hv & xc_var_hcache.mask); … … 2696 2688 xc_entry_hash_t entry_hash; 2697 2689 xc_cache_t *cache; 2698 xc_entry_var_t xce, *stored_xce;2690 xc_entry_var_t entry_var, *stored_entry_var; 2699 2691 zval *name; 2700 2692 … … 2707 2699 return; 2708 2700 } 2709 xc_entry_ init_key_var(&entry_hash, &xce, name TSRMLS_CC);2701 xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC); 2710 2702 cache = xc_var_caches[entry_hash.cacheid]; 2711 2703 2712 2704 ENTER_LOCK(cache) { 2713 stored_ xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xceTSRMLS_CC);2714 if (stored_ xce) {2705 stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC); 2706 if (stored_entry_var) { 2715 2707 /* return */ 2716 xc_processor_restore_zval(return_value, stored_ xce->value, stored_xce->have_references TSRMLS_CC);2708 xc_processor_restore_zval(return_value, stored_entry_var->value, stored_entry_var->have_references TSRMLS_CC); 2717 2709 xc_cache_hit_dmz(cache TSRMLS_CC); 2718 2710 } … … 2730 2722 xc_entry_hash_t entry_hash; 2731 2723 xc_cache_t *cache; 2732 xc_entry_var_t xce, *stored_xce;2724 xc_entry_var_t entry_var, *stored_entry_var; 2733 2725 zval *name; 2734 2726 zval *value; … … 2739 2731 } 2740 2732 2741 xce.entry.ttl = XG(var_ttl);2742 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &name, &value, & xce.entry.ttl) == FAILURE) {2733 entry_var.entry.ttl = XG(var_ttl); 2734 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz|l", &name, &value, &entry_var.entry.ttl) == FAILURE) { 2743 2735 return; 2744 2736 } 2745 2737 2746 2738 /* max ttl */ 2747 if (xc_var_maxttl && (! xce.entry.ttl || xce.entry.ttl > xc_var_maxttl)) {2748 xce.entry.ttl = xc_var_maxttl;2749 } 2750 2751 xc_entry_ init_key_var(&entry_hash, &xce, name TSRMLS_CC);2739 if (xc_var_maxttl && (!entry_var.entry.ttl || entry_var.entry.ttl > xc_var_maxttl)) { 2740 entry_var.entry.ttl = xc_var_maxttl; 2741 } 2742 2743 xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC); 2752 2744 cache = xc_var_caches[entry_hash.cacheid]; 2753 2745 2754 2746 ENTER_LOCK(cache) { 2755 stored_ xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xceTSRMLS_CC);2756 if (stored_ xce) {2757 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_ xceTSRMLS_CC);2758 } 2759 xce.value = value;2760 RETVAL_BOOL(xc_entry_var_store_dmz(cache, entry_hash.entryslotid, & xceTSRMLS_CC) != NULL ? 1 : 0);2747 stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC); 2748 if (stored_entry_var) { 2749 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC); 2750 } 2751 entry_var.value = value; 2752 RETVAL_BOOL(xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &entry_var TSRMLS_CC) != NULL ? 1 : 0); 2761 2753 } LEAVE_LOCK(cache); 2762 2754 } … … 2768 2760 xc_entry_hash_t entry_hash; 2769 2761 xc_cache_t *cache; 2770 xc_entry_var_t xce, *stored_xce;2762 xc_entry_var_t entry_var, *stored_entry_var; 2771 2763 zval *name; 2772 2764 … … 2779 2771 return; 2780 2772 } 2781 xc_entry_ init_key_var(&entry_hash, &xce, name TSRMLS_CC);2773 xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC); 2782 2774 cache = xc_var_caches[entry_hash.cacheid]; 2783 2775 2784 2776 ENTER_LOCK(cache) { 2785 stored_ xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xceTSRMLS_CC);2786 if (stored_ xce) {2777 stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC); 2778 if (stored_entry_var) { 2787 2779 xc_cache_hit_dmz(cache TSRMLS_CC); 2788 2780 RETVAL_TRUE; … … 2802 2794 xc_entry_hash_t entry_hash; 2803 2795 xc_cache_t *cache; 2804 xc_entry_var_t xce, *stored_xce;2796 xc_entry_var_t entry_var, *stored_entry_var; 2805 2797 zval *name; 2806 2798 … … 2813 2805 return; 2814 2806 } 2815 xc_entry_ init_key_var(&entry_hash, &xce, name TSRMLS_CC);2807 xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC); 2816 2808 cache = xc_var_caches[entry_hash.cacheid]; 2817 2809 2818 2810 ENTER_LOCK(cache) { 2819 stored_ xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xceTSRMLS_CC);2820 if (stored_ xce) {2821 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_ xceTSRMLS_CC);2811 stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC); 2812 if (stored_entry_var) { 2813 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC); 2822 2814 RETVAL_TRUE; 2823 2815 } … … 2865 2857 xc_entry_hash_t entry_hash; 2866 2858 xc_cache_t *cache; 2867 xc_entry_var_t xce, *stored_xce;2859 xc_entry_var_t entry_var, *stored_entry_var; 2868 2860 zval *name; 2869 2861 long count = 1; … … 2876 2868 } 2877 2869 2878 xce.entry.ttl = XG(var_ttl);2879 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &name, &count, & xce.entry.ttl) == FAILURE) {2870 entry_var.entry.ttl = XG(var_ttl); 2871 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|ll", &name, &count, &entry_var.entry.ttl) == FAILURE) { 2880 2872 return; 2881 2873 } 2882 2874 2883 2875 /* max ttl */ 2884 if (xc_var_maxttl && (! xce.entry.ttl || xce.entry.ttl > xc_var_maxttl)) {2885 xce.entry.ttl = xc_var_maxttl;2886 } 2887 2888 xc_entry_ init_key_var(&entry_hash, &xce, name TSRMLS_CC);2876 if (xc_var_maxttl && (!entry_var.entry.ttl || entry_var.entry.ttl > xc_var_maxttl)) { 2877 entry_var.entry.ttl = xc_var_maxttl; 2878 } 2879 2880 xc_entry_var_init_key(&entry_var, &entry_hash, name TSRMLS_CC); 2889 2881 cache = xc_var_caches[entry_hash.cacheid]; 2890 2882 2891 2883 ENTER_LOCK(cache) { 2892 stored_ xce = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xceTSRMLS_CC);2893 if (stored_ xce) {2894 TRACE("incdec: got xce %s", xce.entry.name.str.val);2884 stored_entry_var = (xc_entry_var_t *) xc_entry_find_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &entry_var TSRMLS_CC); 2885 if (stored_entry_var) { 2886 TRACE("incdec: got entry_var %s", entry_var.entry.name.str.val); 2895 2887 /* do it in place */ 2896 if (Z_TYPE_P(stored_ xce->value) == IS_LONG) {2888 if (Z_TYPE_P(stored_entry_var->value) == IS_LONG) { 2897 2889 zval *zv; 2898 stored_ xce->entry.ctime = XG(request_time);2899 stored_ xce->entry.ttl = xce.entry.ttl;2890 stored_entry_var->entry.ctime = XG(request_time); 2891 stored_entry_var->entry.ttl = entry_var.entry.ttl; 2900 2892 TRACE("%s", "incdec: islong"); 2901 value = Z_LVAL_P(stored_ xce->value);2893 value = Z_LVAL_P(stored_entry_var->value); 2902 2894 value += (inc == 1 ? count : - count); 2903 2895 RETVAL_LONG(value); 2904 2896 2905 zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_ xce->value);2897 zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_entry_var->value); 2906 2898 Z_LVAL_P(zv) = value; 2907 2899 break; /* leave lock */ … … 2909 2901 2910 2902 TRACE("%s", "incdec: notlong"); 2911 xc_processor_restore_zval(&oldzval, stored_ xce->value, stored_xce->have_references TSRMLS_CC);2903 xc_processor_restore_zval(&oldzval, stored_entry_var->value, stored_entry_var->have_references TSRMLS_CC); 2912 2904 convert_to_long(&oldzval); 2913 2905 value = Z_LVAL(oldzval); … … 2915 2907 } 2916 2908 else { 2917 TRACE("incdec: %s not found", xce.entry.name.str.val);2909 TRACE("incdec: %s not found", entry_var.entry.name.str.val); 2918 2910 } 2919 2911 2920 2912 value += (inc == 1 ? count : - count); 2921 2913 RETVAL_LONG(value); 2922 xce.value = return_value; 2923 2924 if (stored_xce) { 2925 xce.entry.atime = stored_xce->entry.atime; 2926 xce.entry.ctime = stored_xce->entry.ctime; 2927 xce.entry.hits = stored_xce->entry.hits; 2928 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_xce TSRMLS_CC); 2929 } 2930 xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &xce TSRMLS_CC); 2931 2914 entry_var.value = return_value; 2915 2916 if (stored_entry_var) { 2917 entry_var.entry.atime = stored_entry_var->entry.atime; 2918 entry_var.entry.ctime = stored_entry_var->entry.ctime; 2919 entry_var.entry.hits = stored_entry_var->entry.hits; 2920 xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_entry_var TSRMLS_CC); 2921 } 2922 xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &entry_var TSRMLS_CC); 2932 2923 } LEAVE_LOCK(cache); 2933 2924 }

