Changeset 851 for trunk/xcache.c
- Timestamp:
- 2012-03-27T18:07:50+02:00 (14 months ago)
- File:
-
- 1 edited
-
trunk/xcache.c (modified) (61 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xcache.c
r848 r851 145 145 { 146 146 xc_entry_data_php_t *p; 147 for (p = php->cache->phps[php->hvalue]; p; p = p->next) {147 for (p = php->cache->phps[php->hvalue]; p; p = (xc_entry_data_php_t *) p->next) { 148 148 if (memcmp(&php->md5.digest, &p->md5.digest, sizeof(php->md5.digest)) == 0) { 149 149 p->hits ++; … … 182 182 /* }}} */ 183 183 184 static inline int xc_entry_equal_dmz( xc_entry_t *a, xc_entry_t *b) /* {{{ */184 static inline int xc_entry_equal_dmz(const xc_entry_t *entry1, const xc_entry_t *entry2) /* {{{ */ 185 185 { 186 186 /* this function isn't required but can be in dmz */ 187 187 188 if ( a->type != b->type) {188 if (entry1->type != entry2->type) { 189 189 return 0; 190 190 } 191 switch ( a->type) {191 switch (entry1->type) { 192 192 case XC_TYPE_PHP: 193 193 #ifdef HAVE_INODE 194 do { 195 if (a->inode) { 196 return a->inode == b->inode 197 && a->device == b->device; 194 { 195 const xc_entry_php_t *php_entry1 = (const xc_entry_php_t *) entry1; 196 const xc_entry_php_t *php_entry2 = (const xc_entry_php_t *) entry2; 197 if (php_entry1->file_inode) { 198 return php_entry1->file_inode == php_entry2->file_inode 199 && php_entry1->file_device == php_entry2->file_device; 198 200 } 199 } while(0);201 } 200 202 #endif 201 203 /* fall */ … … 204 206 do { 205 207 #ifdef IS_UNICODE 206 if ( a->name_type == IS_UNICODE) {207 if ( a->name.ustr.len != b->name.ustr.len) {208 if (entry1->name_type == IS_UNICODE) { 209 if (entry1->name.ustr.len != entry2->name.ustr.len) { 208 210 return 0; 209 211 } 210 return memcmp( a->name.ustr.val, b->name.ustr.val, (a->name.ustr.len + 1) * sizeof(UChar)) == 0;212 return memcmp(entry1->name.ustr.val, entry2->name.ustr.val, (entry1->name.ustr.len + 1) * sizeof(UChar)) == 0; 211 213 } 212 214 #endif 213 if ( a->name.str.len != b->name.str.len) {215 if (entry1->name.str.len != entry2->name.str.len) { 214 216 return 0; 215 217 } 216 return memcmp( a->name.str.val, b->name.str.val, a->name.str.len + 1) == 0;218 return memcmp(entry1->name.str.val, entry2->name.str.val, entry1->name.str.len + 1) == 0; 217 219 218 220 } while(0); … … 275 277 xce->ctime = XG(request_time); 276 278 xce->atime = XG(request_time); 277 stored_xce = xc_processor_store_xc_entry_t(xce TSRMLS_CC); 279 stored_xce = xce->type == XC_TYPE_PHP 280 ? (xc_entry_t *) xc_processor_store_xc_entry_php_t((xc_entry_php_t *) xce TSRMLS_CC) 281 : xc_processor_store_xc_entry_t(xce TSRMLS_CC); 278 282 if (stored_xce) { 279 283 xc_entry_add_dmz(stored_xce); … … 286 290 } 287 291 /* }}} */ 292 static xc_entry_php_t *xc_entry_php_store_dmz(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */ 293 { 294 return (xc_entry_php_t *) xc_entry_store_dmz((xc_entry_t *) xce TSRMLS_CC); 295 } 296 /* }}} */ 288 297 static void xc_entry_free_real_dmz(volatile xc_entry_t *xce) /* {{{ */ 289 298 { … … 297 306 { 298 307 xce->cache->entries_count --; 299 if ( xce->refcount== 0) {308 if ((xce->type == XC_TYPE_PHP ? ((xc_entry_php_t *) xce)->refcount : 0) == 0) { 300 309 xc_entry_free_real_dmz(xce); 301 310 } … … 329 338 for (p = xce->cache->entries[xce->hvalue]; p; p = p->next) { 330 339 if (xc_entry_equal_dmz(xce, p)) { 331 if (p->type == XC_TYPE_VAR || /* PHP */ (p->mtime == xce->mtime && p->data.php->sourcesize == xce->data.php->sourcesize)) { 340 zend_bool fresh; 341 switch (p->type) { 342 case XC_TYPE_PHP: 343 { 344 xc_entry_php_t *p_php = (xc_entry_php_t *) p; 345 xc_entry_php_t *xce_php = (xc_entry_php_t *) xce; 346 fresh = p_php->file_mtime == xce_php->file_mtime && p->data.php->file_size == xce->data.php->file_size; 347 break; 348 } 349 350 case XC_TYPE_VAR: 351 fresh = 1; 352 break; 353 354 default: 355 assert(0); 356 } 357 358 if (fresh) { 332 359 p->hits ++; 333 360 p->atime = XG(request_time); 334 361 return p; 335 362 } 336 else { 337 xc_entry_remove_dmz(p TSRMLS_CC); 338 return NULL; 339 } 363 364 xc_entry_remove_dmz(p TSRMLS_CC); 365 return NULL; 340 366 } 341 367 } … … 343 369 } 344 370 /* }}} */ 345 static void xc_entry_hold_php_dmz(xc_entry_ t *xce TSRMLS_DC) /* {{{ */346 { 347 TRACE("hold %s", xce-> name.str.val);371 static void xc_entry_hold_php_dmz(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */ 372 { 373 TRACE("hold %s", xce->entry.name.str.val); 348 374 xce->refcount ++; 349 xc_stack_push(&XG(php_holds)[xce-> cache->cacheid], (void *)xce);375 xc_stack_push(&XG(php_holds)[xce->entry.cache->cacheid], (void *)xce); 350 376 } 351 377 /* }}} */ … … 500 526 pp = &cache->deletes; 501 527 for (p = *pp; p; p = *pp) { 528 xc_entry_php_t *entry = (xc_entry_php_t *) p; 502 529 if (XG(request_time) - p->dtime > 3600) { 503 p->refcount = 0;530 entry->refcount = 0; 504 531 /* issue warning here */ 505 532 } 506 if ( p->refcount == 0) {533 if (entry->refcount == 0) { 507 534 /* unlink */ 508 535 *pp = p->next; … … 622 649 } 623 650 /* }}} */ 624 static void xc_fillentry_dmz( xc_entry_t *entry, int del, zval *list TSRMLS_DC) /* {{{ */651 static void xc_fillentry_dmz(const xc_entry_t *entry, int del, zval *list TSRMLS_DC) /* {{{ */ 625 652 { 626 653 zval* ei; 627 xc_entry_data_php_t *php; 628 xc_entry_data_var_t *var; 654 const xc_entry_data_php_t *php; 655 const xc_entry_data_var_t *var; 656 xc_entry_php_t *entry_php = (xc_entry_php_t *) entry; 629 657 630 658 ALLOC_INIT_ZVAL(ei); 631 659 array_init(ei); 632 660 633 add_assoc_long_ex(ei, ZEND_STRS("refcount"), entry ->refcount);661 add_assoc_long_ex(ei, ZEND_STRS("refcount"), entry_php->refcount); 634 662 add_assoc_long_ex(ei, ZEND_STRS("hits"), entry->hits); 635 663 add_assoc_long_ex(ei, ZEND_STRS("ctime"), entry->ctime); … … 664 692 add_assoc_long_ex(ei, ZEND_STRS("size"), entry->size + php->size); 665 693 add_assoc_long_ex(ei, ZEND_STRS("phprefcount"), php->refcount); 666 add_assoc_long_ex(ei, ZEND_STRS(" sourcesize"), php->sourcesize);694 add_assoc_long_ex(ei, ZEND_STRS("file_size"), php->file_size); 667 695 #ifdef HAVE_INODE 668 add_assoc_long_ex(ei, ZEND_STRS(" device"), entry->device);669 add_assoc_long_ex(ei, ZEND_STRS(" inode"), entry->inode);670 #endif 671 add_assoc_long_ex(ei, ZEND_STRS(" mtime"), entry->mtime);696 add_assoc_long_ex(ei, ZEND_STRS("file_device"), entry_php->file_device); 697 add_assoc_long_ex(ei, ZEND_STRS("file_inode"), entry_php->file_inode); 698 #endif 699 add_assoc_long_ex(ei, ZEND_STRS("file_mtime"), entry_php->file_mtime); 672 700 673 701 #ifdef HAVE_XCACHE_CONSTANT … … 682 710 683 711 case XC_TYPE_VAR: 684 var = entry->data.var;712 var = &entry->data.var; 685 713 add_assoc_long_ex(ei, ZEND_STRS("size"), entry->size); 686 714 break; … … 718 746 /* }}} */ 719 747 720 static zend_op_array *xc_entry_install(xc_entry_ t *xce, zend_file_handle *h TSRMLS_DC) /* {{{ */748 static zend_op_array *xc_entry_install(xc_entry_php_t *xce, zend_file_handle *h TSRMLS_DC) /* {{{ */ 721 749 { 722 750 zend_uint i; 723 xc_entry_data_php_t *p = xce-> data.php;751 xc_entry_data_php_t *p = xce->entry.data.php; 724 752 zend_op_array *old_active_op_array = CG(active_op_array); 725 753 #ifndef ZEND_ENGINE_2 … … 735 763 for (i = 0; i < p->constinfo_cnt; i ++) { 736 764 xc_constinfo_t *ci = &p->constinfos[i]; 737 xc_install_constant(xce-> name.str.val, &ci->constant,765 xc_install_constant(xce->entry.name.str.val, &ci->constant, 738 766 UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC); 739 767 } … … 743 771 for (i = 0; i < p->funcinfo_cnt; i ++) { 744 772 xc_funcinfo_t *fi = &p->funcinfos[i]; 745 xc_install_function(xce-> name.str.val, &fi->func,773 xc_install_function(xce->entry.name.str.val, &fi->func, 746 774 UNISW(0, fi->type), fi->key, fi->key_size, fi->h TSRMLS_CC); 747 775 } … … 761 789 #endif 762 790 #ifdef ZEND_COMPILE_DELAYED_BINDING 763 xc_install_class(xce-> name.str.val, &ci->cest, -1,791 xc_install_class(xce->entry.name.str.val, &ci->cest, -1, 764 792 UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC); 765 793 #else 766 xc_install_class(xce-> name.str.val, &ci->cest, ci->oplineno,794 xc_install_class(xce->entry.name.str.val, &ci->cest, ci->oplineno, 767 795 UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC); 768 796 #endif … … 787 815 788 816 i = 1; 789 zend_hash_add(&EG(included_files), xce-> name.str.val, xce->name.str.len+1, (void *)&i, sizeof(int), NULL);817 zend_hash_add(&EG(included_files), xce->entry.name.str.val, xce->entry.name.str.len+1, (void *)&i, sizeof(int), NULL); 790 818 if (h) { 791 819 zend_llist_add_element(&CG(open_files), h); … … 816 844 xce = (xc_entry_t*) xc_stack_pop(s); 817 845 TRACE("unhold %s", xce->name.str.val); 818 xce->refcount --;819 assert( xce->refcount >= 0);846 ((xc_entry_php_t *) xce)->refcount ++; 847 assert(((xc_entry_php_t *) xce)->refcount >= 0); 820 848 } 821 849 } LEAVE_LOCK(cache); … … 885 913 /* }}} */ 886 914 915 #if 0 /* {{{ note about php hashing */ 916 the folling note is written in the form of "got = from" 917 918 TODO: open_basedir 919 920 opened_path = stat || zend_compile_file 921 922 phphashid = inode ? inode : hash(basename) 923 md5key = md5(relativepath) 924 md5hashid = hash(md5key) 925 cachehashid = multislot ? hash(basename) : hash(phphashid) 926 927 cached = phphashid -> md5key -> cachedmd5info -> cachedphp 928 cachedphp = [phphashid, fullpath] 929 restoredphp = [fullpath, phphashid] 930 931 #endif /* }}} */ 932 887 933 #define HASH(i) (i) 888 934 #define HASH_ZSTR_L(t, s, l) HASH(zend_u_inline_hash_func((t), (s), ((l) + 1) * sizeof(UChar))) … … 907 953 } 908 954 /* }}} */ 909 #define xc_entry_hash_var xc_entry_hash_name 910 static inline xc_hash_value_t xc_entry_hash_php(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 911 { 912 #ifdef HAVE_INODE 913 if (xce->inode) { 914 return HASH(xce->device + xce->inode); 915 } 916 #endif 917 return xc_entry_hash_name(xce TSRMLS_CC); 918 } 919 /* }}} */ 920 static inline xc_hash_value_t xc_entry_hash_php_basename(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 955 static inline xc_hash_value_t xc_entry_hash_php_basename(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */ 921 956 { 922 957 #ifdef IS_UNICODE 923 if (UG(unicode) && xce-> name_type == IS_UNICODE) {958 if (UG(unicode) && xce->entry.name_type == IS_UNICODE) { 924 959 zstr basename; 925 960 size_t basename_len; 926 php_u_basename(xce-> name.ustr.val, xce->name.ustr.len, NULL, 0, &basename.u, &basename_len TSRMLS_CC);961 php_u_basename(xce->entry.name.ustr.val, xce->entry.name.ustr.len, NULL, 0, &basename.u, &basename_len TSRMLS_CC); 927 962 return HASH_ZSTR_L(IS_UNICODE, basename, basename_len); 928 963 } … … 934 969 size_t basename_len; 935 970 #ifdef ZEND_ENGINE_2 936 php_basename(xce-> name.str.val, xce->name.str.len, "", 0, &basename, &basename_len TSRMLS_CC);971 php_basename(xce->entry.name.str.val, xce->entry.name.str.len, "", 0, &basename, &basename_len TSRMLS_CC); 937 972 #else 938 basename = php_basename(xce-> name.str.val, xce->name.str.len, "", 0);973 basename = php_basename(xce->entry.name.str.val, xce->entry.name.str.len, "", 0); 939 974 basename_len = strlen(basename); 940 975 #endif … … 945 980 } 946 981 /* }}} */ 947 static void xc_entry_free_key_php(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 982 #define xc_entry_hash_var xc_entry_hash_name 983 static inline xc_hash_value_t xc_entry_hash_php(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */ 984 { 985 return 986 #ifdef HAVE_INODE 987 xce->file_inode ? HASH(xce->file_device + xce->file_inode) : 988 #endif 989 xc_entry_hash_php_basename(xce TSRMLS_CC); 990 } 991 /* }}} */ 992 static void xc_entry_free_key_php(xc_entry_php_t *xce TSRMLS_DC) /* {{{ */ 948 993 { 949 994 #define X_FREE(var) do {\ … … 962 1007 /* }}} */ 963 1008 964 static int xc_entry_init_key_php(xc_entry_ t *xce, const char *filename TSRMLS_DC) /* {{{ */1009 static int xc_entry_init_key_php(xc_entry_php_t *xce, const char *filename TSRMLS_DC) /* {{{ */ 965 1010 { 966 1011 char opened_path_buffer[MAXPATHLEN]; … … 1027 1072 } 1028 1073 1029 xce-> mtime= pbuf->st_mtime;1074 xce->file_mtime = pbuf->st_mtime; 1030 1075 #ifdef HAVE_INODE 1031 xce-> device= pbuf->st_dev;1032 xce-> inode= pbuf->st_ino;1033 #endif 1034 xce-> data.php->sourcesize = pbuf->st_size;1076 xce->file_device = pbuf->st_dev; 1077 xce->file_inode = pbuf->st_ino; 1078 #endif 1079 xce->entry.data.php->file_size = pbuf->st_size; 1035 1080 } 1036 1081 else { /* XG(inode) */ 1037 xce-> mtime= 0;1082 xce->file_mtime = 0; 1038 1083 #ifdef HAVE_INODE 1039 xce-> device= 0;1040 xce-> inode= 0;1041 #endif 1042 xce-> data.php->sourcesize = 0;1084 xce->file_device = 0; 1085 xce->file_inode = 0; 1086 #endif 1087 xce->entry.data.php->file_size = 0; 1043 1088 } 1044 1089 1045 1090 #ifdef HAVE_INODE 1046 if (!xce-> inode)1091 if (!xce->file_inode) 1047 1092 #endif 1048 1093 { … … 1055 1100 } 1056 1101 1057 UNISW(NOTHING, xce-> name_type = IS_STRING;)1058 xce-> name.str.val = (char *) filename;1059 xce-> name.str.len = strlen(filename);1102 UNISW(NOTHING, xce->entry.name_type = IS_STRING;) 1103 xce->entry.name.str.val = (char *) filename; 1104 xce->entry.name.str.len = strlen(filename); 1060 1105 1061 1106 cacheid = xc_php_hcache.size > 1 ? xc_hash_fold(xc_entry_hash_php_basename(xce TSRMLS_CC), &xc_php_hcache) : 0; 1062 xce-> cache = xc_php_caches[cacheid];1063 xce-> hvalue = xc_hash_fold(xc_entry_hash_php(xce TSRMLS_CC), &xc_php_hentry);1064 xce-> type = XC_TYPE_PHP;1107 xce->entry.cache = xc_php_caches[cacheid]; 1108 xce->entry.hvalue = xc_hash_fold(xc_entry_hash_php(xce TSRMLS_CC), &xc_php_hentry); 1109 xce->entry.type = XC_TYPE_PHP; 1065 1110 xce->filepath = NULL; 1066 1111 xce->dirpath = NULL; … … 1078 1123 } 1079 1124 /* }}} */ 1080 static int xc_entry_init_key_php_md5(xc_entry_data_php_t *php, xc_entry_ t *xce TSRMLS_DC) /* {{{ */1125 static int xc_entry_init_key_php_md5(xc_entry_data_php_t *php, xc_entry_php_t *xce TSRMLS_DC) /* {{{ */ 1081 1126 { 1082 1127 unsigned char buf[1024]; … … 1086 1131 ulong old_rsid = EG(regular_list).nNextFreeElement; 1087 1132 1088 stream = php_stream_open_wrapper(xce-> name.str.val, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL);1133 stream = php_stream_open_wrapper(xce->entry.name.str.val, "rb", USE_PATH | REPORT_ERRORS | ENFORCE_SAFE_MODE | STREAM_DISABLE_OPEN_BASEDIR, NULL); 1089 1134 if (!stream) { 1090 1135 return FAILURE; … … 1106 1151 } 1107 1152 1108 php->cache = xce-> cache;1153 php->cache = xce->entry.cache; 1109 1154 php->hvalue = (xc_php_hash_md5(php TSRMLS_CC) & php->cache->hphp->mask); 1110 1155 #ifdef XCACHE_DEBUG … … 1119 1164 } 1120 1165 /* }}} */ 1121 static void xc_entry_init_key_php_entry(xc_entry_ t *xce, ZEND_24(const) char *filepath TSRMLS_DC) /* {{{*/1166 static void xc_entry_init_key_php_entry(xc_entry_php_t *xce, ZEND_24(const) char *filepath TSRMLS_DC) /* {{{*/ 1122 1167 { 1123 1168 xce->filepath = filepath; … … 1178 1223 } xc_const_usage_t; 1179 1224 /* }}} */ 1180 static void xc_collect_op_array_info(xc_entry_ t *xce, xc_entry_data_php_t *php, xc_const_usage_t *usage, xc_op_array_info_t *op_array_info, zend_op_array *op_array TSRMLS_DC) /* {{{ */1225 static void xc_collect_op_array_info(xc_entry_php_t *xce, xc_entry_data_php_t *php, xc_const_usage_t *usage, xc_op_array_info_t *op_array_info, zend_op_array *op_array TSRMLS_DC) /* {{{ */ 1181 1226 { 1182 1227 int i; … … 1277 1322 } 1278 1323 /* }}} */ 1279 void xc_fix_op_array_info(const xc_entry_ 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) /* {{{ */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) /* {{{ */ 1280 1325 { 1281 1326 int i; … … 1468 1513 } 1469 1514 /* }}} */ 1470 static zend_op_array *xc_compile_php(xc_entry_ t *xce, xc_entry_data_php_t *php, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */1515 static zend_op_array *xc_compile_php(xc_entry_php_t *xce, xc_entry_data_php_t *php, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */ 1471 1516 { 1472 1517 zend_op_array *op_array; … … 1701 1746 } 1702 1747 /* }}} */ 1703 static zend_op_array *xc_compile_restore(xc_entry_ t *stored_xce, zend_file_handle *h TSRMLS_DC) /* {{{ */1748 static zend_op_array *xc_compile_restore(xc_entry_php_t *stored_xce, zend_file_handle *h TSRMLS_DC) /* {{{ */ 1704 1749 { 1705 1750 zend_op_array *op_array; 1706 xc_entry_ t xce;1751 xc_entry_php_t xce; 1707 1752 xc_entry_data_php_t php; 1708 1753 zend_bool catched; 1709 1754 1710 1755 CG(in_compilation) = 1; 1711 CG(compiled_filename) = stored_xce-> name.str.val;1756 CG(compiled_filename) = stored_xce->entry.name.str.val; 1712 1757 CG(zend_lineno) = 0; 1713 TRACE("restoring %s", stored_xce-> name.str.val);1714 xc_processor_restore_xc_entry_ t(&xce, stored_xce TSRMLS_CC);1715 xc_processor_restore_xc_entry_data_php_t(stored_xce, &php, xce. data.php, xc_readonly_protection TSRMLS_CC);1716 xce. data.php = &php;1758 TRACE("restoring %s", stored_xce->entry.name.str.val); 1759 xc_processor_restore_xc_entry_php_t(&xce, stored_xce TSRMLS_CC); 1760 xc_processor_restore_xc_entry_data_php_t(stored_xce, &php, xce.entry.data.php, xc_readonly_protection TSRMLS_CC); 1761 xce.entry.data.php = &php; 1717 1762 #ifdef SHOW_DPRINT 1718 1763 xc_dprint(&xce, 0 TSRMLS_CC); … … 1753 1798 } 1754 1799 /* }}} */ 1755 static zend_op_array *xc_compile_file_ex(xc_entry_ t *xce, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */1800 static zend_op_array *xc_compile_file_ex(xc_entry_php_t *xce, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */ 1756 1801 { 1757 1802 zend_op_array *op_array; 1758 xc_entry_ t *stored_xce;1803 xc_entry_php_t *stored_xce; 1759 1804 xc_entry_data_php_t *stored_php; 1760 xc_cache_t *cache = xce-> cache;1805 xc_cache_t *cache = xce->entry.cache; 1761 1806 zend_bool gaveup = 0; 1762 1807 zend_bool catched = 0; … … 1773 1818 stored_php = NULL; 1774 1819 ENTER_LOCK_EX(cache) { 1775 stored_xce = xc_entry_find_dmz(xce TSRMLS_CC);1820 stored_xce = (xc_entry_php_t *) xc_entry_find_dmz((xc_entry_t *) xce TSRMLS_CC); 1776 1821 if (stored_xce) { 1777 1822 xc_cache_hit_dmz(cache TSRMLS_CC); … … 1784 1829 TRACE("miss %s", xce->name.str.val); 1785 1830 1786 if (xc_entry_init_key_php_md5(xce-> data.php, xce TSRMLS_CC) != SUCCESS) {1831 if (xc_entry_init_key_php_md5(xce->entry.data.php, xce TSRMLS_CC) != SUCCESS) { 1787 1832 gaveup = 1; 1788 1833 break; 1789 1834 } 1790 1835 1791 stored_php = xc_php_find_dmz(xce-> data.php TSRMLS_CC);1836 stored_php = xc_php_find_dmz(xce->entry.data.php TSRMLS_CC); 1792 1837 1793 1838 /* miss but compiling */ … … 1829 1874 newlycompiled = 0; 1830 1875 xc_entry_init_key_php_entry(xce, h->opened_path ? h->opened_path : h->filename TSRMLS_CC); 1831 xce-> data.php = stored_php;1876 xce->entry.data.php = stored_php; 1832 1877 } 1833 1878 else { … … 1838 1883 1839 1884 #ifdef HAVE_XCACHE_CONSTANT 1840 xce-> data.php->constinfos = NULL;1841 #endif 1842 xce-> data.php->funcinfos = NULL;1843 xce-> data.php->classinfos = NULL;1885 xce->entry.data.php->constinfos = NULL; 1886 #endif 1887 xce->entry.data.php->funcinfos = NULL; 1888 xce->entry.data.php->classinfos = NULL; 1844 1889 #ifdef ZEND_ENGINE_2_1 1845 xce-> data.php->autoglobals = NULL;1846 #endif 1847 1848 memset(&xce-> data.php->op_array_info, 0, sizeof(xce->data.php->op_array_info));1890 xce->entry.data.php->autoglobals = NULL; 1891 #endif 1892 1893 memset(&xce->entry.data.php->op_array_info, 0, sizeof(xce->entry.data.php->op_array_info)); 1849 1894 1850 1895 zend_try { 1851 op_array = xc_compile_php(xce, xce-> data.php, h, type TSRMLS_CC);1896 op_array = xc_compile_php(xce, xce->entry.data.php, h, type TSRMLS_CC); 1852 1897 } zend_catch { 1853 1898 catched = 1; … … 1859 1904 1860 1905 /* not cachable */ 1861 if (!xce-> data.php->op_array) {1906 if (!xce->entry.data.php->op_array) { 1862 1907 cache->compiling = 0; 1863 1908 /* it's not cachable, but don't scare the users with high misses */ … … 1874 1919 * WARNING: this code is required to be after compile 1875 1920 */ 1876 if (xce-> inode) {1921 if (xce->file_inode) { 1877 1922 const char *filename = h->opened_path ? h->opened_path : h->filename; 1878 if (xce-> name.str.val != filename) {1879 xce-> name.str.val = (char *) filename;1880 xce-> name.str.len = strlen(filename);1923 if (xce->entry.name.str.val != filename) { 1924 xce->entry.name.str.val = (char *) filename; 1925 xce->entry.name.str.len = strlen(filename); 1881 1926 } 1882 1927 } … … 1890 1935 /* php_store */ 1891 1936 if (newlycompiled) { 1892 stored_php = xc_php_store_dmz(xce-> data.php TSRMLS_CC);1937 stored_php = xc_php_store_dmz(xce->entry.data.php TSRMLS_CC); 1893 1938 if (!stored_php) { 1894 1939 /* error */ … … 1898 1943 /* entry_store */ 1899 1944 xc_php_addref_dmz(stored_php); 1900 stored_xce = xc_entry_ store_dmz(xce TSRMLS_CC);1945 stored_xce = xc_entry_php_store_dmz(xce TSRMLS_CC); 1901 1946 if (stored_xce) { 1902 stored_xce-> data.php = stored_php;1947 stored_xce->entry.data.php = stored_php; 1903 1948 } 1904 1949 else { … … 1916 1961 1917 1962 if (newlycompiled) { 1918 xc_free_php(xce-> data.php TSRMLS_CC);1963 xc_free_php(xce->entry.data.php TSRMLS_CC); 1919 1964 } 1920 1965 … … 1947 1992 err_aftersandbox: 1948 1993 if (newlycompiled) { 1949 xc_free_php(xce-> data.php TSRMLS_CC);1994 xc_free_php(xce->entry.data.php TSRMLS_CC); 1950 1995 xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC); 1951 1996 } … … 1962 2007 { 1963 2008 zend_op_array *op_array; 1964 xc_entry_ t xce;2009 xc_entry_php_t xce; 1965 2010 xc_entry_data_php_t php; 1966 2011 const char *filename; … … 1976 2021 /* {{{ entry_init_key */ 1977 2022 filename = h->opened_path ? h->opened_path : h->filename; 1978 xce. data.php = &php;2023 xce.entry.data.php = &php; 1979 2024 if (xc_entry_init_key_php(&xce, filename TSRMLS_CC) != SUCCESS) { 1980 2025 TRACE("failed to init key for %s", filename); … … 2656 2701 { 2657 2702 xc_entry_t xce, *stored_xce; 2658 xc_entry_data_var_t var;2659 2703 zval *name; 2660 2704 int found = 0; … … 2668 2712 return; 2669 2713 } 2670 xce.data.var = &var;2671 2714 xc_entry_init_key_var(&xce, name TSRMLS_CC); 2672 2715 … … 2676 2719 if (!VAR_ENTRY_EXPIRED(stored_xce)) { 2677 2720 found = 1; 2678 xc_processor_restore_zval(return_value, stored_xce->data.var ->value, stored_xce->data.var->have_references TSRMLS_CC);2721 xc_processor_restore_zval(return_value, stored_xce->data.var.value, stored_xce->data.var.have_references TSRMLS_CC); 2679 2722 /* return */ 2680 2723 break; … … 2700 2743 { 2701 2744 xc_entry_t xce, *stored_xce; 2702 xc_entry_data_var_t var;2703 2745 zval *name; 2704 2746 zval *value; … … 2719 2761 } 2720 2762 2721 xce.data.var = &var;2722 2763 xc_entry_init_key_var(&xce, name TSRMLS_CC); 2723 2764 … … 2727 2768 xc_entry_remove_dmz(stored_xce TSRMLS_CC); 2728 2769 } 2729 var.value = value;2770 xce.data.var.value = value; 2730 2771 RETVAL_BOOL(xc_entry_store_dmz(&xce TSRMLS_CC) != NULL ? 1 : 0); 2731 2772 } LEAVE_LOCK(xce.cache); … … 2737 2778 { 2738 2779 xc_entry_t xce, *stored_xce; 2739 xc_entry_data_var_t var;2740 2780 zval *name; 2741 2781 int found = 0; … … 2749 2789 return; 2750 2790 } 2751 xce.data.var = &var;2752 2791 xc_entry_init_key_var(&xce, name TSRMLS_CC); 2753 2792 … … 2781 2820 { 2782 2821 xc_entry_t xce, *stored_xce; 2783 xc_entry_data_var_t var;2784 2822 zval *name; 2785 2823 … … 2792 2830 return; 2793 2831 } 2794 xce.data.var = &var;2795 2832 xc_entry_init_key_var(&xce, name TSRMLS_CC); 2796 2833 … … 2843 2880 { 2844 2881 xc_entry_t xce, *stored_xce; 2845 xc_entry_data_var_t var, *stored_var;2846 2882 zval *name; 2847 2883 long count = 1; … … 2864 2900 } 2865 2901 2866 xce.data.var = &var;2867 2902 xc_entry_init_key_var(&xce, name TSRMLS_CC); 2868 2903 … … 2879 2914 else { 2880 2915 /* do it in place */ 2881 stored_var =stored_xce->data.var;2916 xc_entry_data_var_t *stored_var = &stored_xce->data.var; 2882 2917 if (Z_TYPE_P(stored_var->value) == IS_LONG) { 2883 2918 zval *zv; … … 2895 2930 else { 2896 2931 TRACE("%s", "incdec: notlong"); 2897 xc_processor_restore_zval(&oldzval, stored_xce->data.var ->value, stored_xce->data.var->have_references TSRMLS_CC);2932 xc_processor_restore_zval(&oldzval, stored_xce->data.var.value, stored_xce->data.var.have_references TSRMLS_CC); 2898 2933 convert_to_long(&oldzval); 2899 2934 value = Z_LVAL(oldzval); … … 2908 2943 value += (inc == 1 ? count : - count); 2909 2944 RETVAL_LONG(value); 2910 var.value = return_value;2945 stored_xce->data.var.value = return_value; 2911 2946 2912 2947 if (stored_xce) {
Note: See TracChangeset
for help on using the changeset viewer.

