Changeset 684
- Timestamp:
- 09/29/2009 01:25:01 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
processor/head.m4 (modified) (3 diffs)
-
processor/processor.m4 (modified) (3 diffs)
-
xcache.c (modified) (31 diffs)
-
xcache.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/processor/head.m4
r667 r684 65 65 zend_bool reference; /* enable if to deal with reference */ 66 66 zend_bool have_references; 67 const xc_entry_t *entry_src; 68 const xc_entry_t *entry_dst; 67 69 const xc_entry_data_php_t *php_src; 68 70 const xc_entry_data_php_t *php_dst; … … 391 393 } 392 394 /* }}} */ 393 /* 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 {{{ */394 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) {395 /* export: xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */ 396 xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_t *xce, xc_entry_data_php_t *dst, const xc_entry_data_php_t *src, zend_bool readonly_protection TSRMLS_DC) { 395 397 xc_processor_t processor; 396 398 … … 401 403 processor.reference = 1; 402 404 } 405 processor.entry_src = xce; 403 406 404 407 if (processor.reference) { -
trunk/processor/processor.m4
r666 r684 664 664 #endif 665 665 } while (0); 666 IFRESTORE(`xc_fix_op_array_info(processor-> php_src, dst, !shallow_copy, op_array_info TSRMLS_CC);')666 IFRESTORE(`xc_fix_op_array_info(processor->entry_src, processor->php_src, dst, !shallow_copy, op_array_info TSRMLS_CC);') 667 667 668 668 #ifdef ZEND_ENGINE_2 … … 819 819 DISPATCH(size_t, size) 820 820 821 DISPATCH(int, filepath_len)822 IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)')823 DISPATCH(int, dirpath_len)824 IFRESTORE(`COPY(dirpath)', `PROC_STRING_L(dirpath, dirpath_len)')825 #ifdef IS_UNICODE826 DISPATCH(int, ufilepath_len)827 IFRESTORE(`COPY(ufilepath)', `PROC_USTRING_L(ufilepath, ufilepath_len)')828 DISPATCH(int, udirpath_len)829 IFRESTORE(`COPY(udirpath)', `PROC_USTRING_L(udirpath, udirpath_len)')830 #endif831 832 821 IFRESTORE(`COPY(op_array_info)', ` 833 822 STRUCT(xc_op_array_info_t, op_array_info) … … 943 932 DISPATCH(int, inode) 944 933 #endif 934 935 DISPATCH(int, filepath_len) 936 IFRESTORE(`COPY(filepath)', `PROC_STRING_L(filepath, filepath_len)') 937 DISPATCH(int, dirpath_len) 938 IFRESTORE(`COPY(dirpath)', `PROC_STRING_L(dirpath, dirpath_len)') 939 #ifdef IS_UNICODE 940 DISPATCH(int, ufilepath_len) 941 IFRESTORE(`COPY(ufilepath)', `PROC_USTRING_L(ufilepath, ufilepath_len)') 942 DISPATCH(int, udirpath_len) 943 IFRESTORE(`COPY(udirpath)', `PROC_USTRING_L(udirpath, udirpath_len)') 944 #endif 945 945 946 ') 946 947 dnl }}} -
trunk/xcache.c
r683 r684 1 1 2 #if 02 #if 1 3 3 #define XCACHE_DEBUG 4 4 #endif … … 945 945 } 946 946 /* }}} */ 947 static int xc_entry_init_key_php(xc_entry_t *xce, char *filename, char *opened_path_buffer TSRMLS_DC) /* {{{ */ 948 { 947 static void xc_entry_free_key_php(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 948 { 949 #define X_FREE(var) do {\ 950 if (xce->var) { \ 951 efree(xce->var); \ 952 } \ 953 } while (0) 954 X_FREE(dirpath); 955 #ifdef IS_UNICODE 956 X_FREE(ufilepath); 957 X_FREE(udirpath); 958 #endif 959 960 #undef X_FREE 961 } 962 /* }}} */ 963 964 static int xc_entry_init_key_php(xc_entry_t *xce, char *filename TSRMLS_DC) /* {{{ */ 965 { 966 char opened_path_buffer[MAXPATHLEN]; 949 967 struct stat buf, *pbuf; 950 968 xc_hash_value_t hv; … … 1106 1124 1107 1125 return SUCCESS; 1126 } 1127 /* }}} */ 1128 static void xc_entry_init_key_php_entry(xc_entry_t *xce, char *filepath TSRMLS_DC) /* {{{*/ 1129 { 1130 xce->filepath = filepath; 1131 xce->filepath_len = strlen(xce->filepath); 1132 xce->dirpath = estrndup(xce->filepath, xce->filepath_len); 1133 xce->dirpath_len = zend_dirname(xce->dirpath, xce->filepath_len); 1134 #ifdef IS_UNICODE 1135 zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &xce->ufilepath, &xce->ufilepath_len, xce->filepath, xce->filepath_len TSRMLS_CC); 1136 zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &xce->udirpath, &xce->udirpath_len, xce->dirpath, xce->dirpath_len TSRMLS_CC); 1137 #endif 1108 1138 } 1109 1139 /* }}} */ … … 1150 1180 } xc_const_usage_t; 1151 1181 /* }}} */ 1152 static void xc_collect_op_array_info(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) /* {{{ */1182 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) /* {{{ */ 1153 1183 { 1154 1184 int oplineno; … … 1158 1188 1159 1189 #define XCACHE_CHECK_OP(type, op) \ 1160 if (zend_binary_strcmp(Z_STRVAL(opline->op.u.constant), Z_STRLEN(opline->op.u.constant), php->type##path, php->type##path_len) == 0) { \1190 if (zend_binary_strcmp(Z_STRVAL(opline->op.u.constant), Z_STRLEN(opline->op.u.constant), xce->type##path, xce->type##path_len) == 0) { \ 1161 1191 usage->type##path_used = 1; \ 1162 1192 oplineinfo |= xcache_##op##_is_##type; \ … … 1164 1194 1165 1195 #define XCACHE_U_CHECK_OP(type, op) \ 1166 if (zend_u_##binary_strcmp(Z_USTRVAL(opline->op.u.constant), Z_USTRLEN(opline->op.u.constant), php->u##type##path, php->u##type##path_len) == 0) { \1196 if (zend_u_##binary_strcmp(Z_USTRVAL(opline->op.u.constant), Z_USTRLEN(opline->op.u.constant), xce->u##type##path, xce->u##type##path_len) == 0) { \ 1167 1197 usage->u##type##path_used = 1; \ 1168 1198 oplineinfo |= xcache_##op##_is_##type; \ … … 1209 1239 } 1210 1240 /* }}} */ 1211 void xc_fix_op_array_info(const xc_entry_ data_php_t *php, zend_op_array *op_array, int copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */1241 void xc_fix_op_array_info(const xc_entry_t *xce, const xc_entry_data_php_t *php, zend_op_array *op_array, int copy, const xc_op_array_info_t *op_array_info TSRMLS_DC) /* {{{ */ 1212 1242 { 1213 1243 int i; … … 1226 1256 } 1227 1257 if (Z_TYPE(opline->op1.u.constant) == IS_STRING) { 1228 assert(php->filepath); 1229 ZVAL_STRINGL(&opline->op1.u.constant, php->filepath, php->filepath_len, copy); 1258 assert(xce->filepath); 1259 ZVAL_STRINGL(&opline->op1.u.constant, xce->filepath, xce->filepath_len, copy); 1260 TRACE("fixing op1 to %s", xce->filepath); 1230 1261 } 1231 1262 #ifdef IS_UNICODE 1232 1263 else if (Z_TYPE(opline->op1.u.constant) == IS_UNICODE) { 1233 assert( php->ufilepath);1234 ZVAL_UNICODEL(&opline->op1.u.constant, php->ufilepath, php->ufilepath_len, copy);1264 assert(xce->ufilepath); 1265 ZVAL_UNICODEL(&opline->op1.u.constant, xce->ufilepath, xce->ufilepath_len, copy); 1235 1266 } 1236 1267 #endif … … 1245 1276 } 1246 1277 if (Z_TYPE(opline->op1.u.constant) == IS_STRING) { 1247 assert(php->dirpath); 1248 ZVAL_STRINGL(&opline->op1.u.constant, php->dirpath, php->dirpath_len, copy); 1278 assert(xce->dirpath); 1279 TRACE("fixing op1 to %s", xce->dirpath); 1280 ZVAL_STRINGL(&opline->op1.u.constant, xce->dirpath, xce->dirpath_len, copy); 1249 1281 } 1250 1282 #ifdef IS_UNICODE 1251 1283 else if (Z_TYPE(opline->op1.u.constant) == IS_UNICODE) { 1252 assert(! php->udirpath);1253 ZVAL_UNICODEL(&opline->op1.u.constant, php->udirpath, php->udirpath_len, copy);1284 assert(!xce->udirpath); 1285 ZVAL_UNICODEL(&opline->op1.u.constant, xce->udirpath, xce->udirpath_len, copy); 1254 1286 } 1255 1287 #endif … … 1265 1297 } 1266 1298 if (Z_TYPE(opline->op2.u.constant) == IS_STRING) { 1267 assert(php->filepath); 1268 ZVAL_STRINGL(&opline->op2.u.constant, php->filepath, php->filepath_len, copy); 1299 assert(xce->filepath); 1300 TRACE("fixing op2 to %s", xce->filepath); 1301 ZVAL_STRINGL(&opline->op2.u.constant, xce->filepath, xce->filepath_len, copy); 1269 1302 } 1270 1303 #ifdef IS_UNICODE 1271 1304 else if (Z_TYPE(opline->op2.u.constant) == IS_UNICODE) { 1272 assert( php->ufilepath);1273 ZVAL_UNICODEL(&opline->op2.u.constant, php->ufilepath, php->ufilepath_len, copy);1305 assert(xce->ufilepath); 1306 ZVAL_UNICODEL(&opline->op2.u.constant, xce->ufilepath, xce->ufilepath_len, copy); 1274 1307 } 1275 1308 #endif … … 1284 1317 } 1285 1318 if (Z_TYPE(opline->op2.u.constant) == IS_STRING) { 1286 assert(!php->dirpath); 1287 ZVAL_STRINGL(&opline->op2.u.constant, php->dirpath, php->dirpath_len, copy); 1319 assert(!xce->dirpath); 1320 TRACE("fixing op2 to %s", xce->dirpath); 1321 ZVAL_STRINGL(&opline->op2.u.constant, xce->dirpath, xce->dirpath_len, copy); 1288 1322 } 1289 1323 #ifdef IS_UNICODE 1290 1324 else if (Z_TYPE(opline->op2.u.constant) == IS_UNICODE) { 1291 assert(! php->udirpath);1292 ZVAL_UNICODEL(&opline->op2.u.constant, php->udirpath, php->udirpath_len, copy);1325 assert(!xce->udirpath); 1326 ZVAL_UNICODEL(&opline->op2.u.constant, xce->udirpath, xce->udirpath_len, copy); 1293 1327 } 1294 1328 #endif … … 1336 1370 } while (0) 1337 1371 1338 X_FREE(dirpath);1339 #ifdef IS_UNICODE1340 X_FREE(ufilepath);1341 X_FREE(udirpath);1342 #endif1343 1344 1372 #ifdef ZEND_ENGINE_2_1 1345 1373 X_FREE(autoglobals); … … 1353 1381 } 1354 1382 /* }}} */ 1355 static zend_op_array *xc_compile_php(xc_entry_ data_php_t *php, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */1383 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) /* {{{ */ 1356 1384 { 1357 1385 zend_op_array *op_array; 1358 1386 int old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt; 1359 1387 zend_bool catched = 0; 1360 xc_const_usage_t const_usage;1361 1388 1362 1389 /* {{{ compile */ … … 1436 1463 /* }}} */ 1437 1464 1438 /* {{{ file/dir path init */1439 memset(&const_usage, 0, sizeof(const_usage));1440 php->filepath = zend_get_compiled_filename(TSRMLS_C);1441 php->filepath_len = strlen(php->filepath);1442 php->dirpath = estrndup(php->filepath, php->filepath_len);1443 php->dirpath_len = zend_dirname(php->dirpath, php->filepath_len);1444 #ifdef IS_UNICODE1445 zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &php->ufilepath, &php->ufilepath_len, php->filepath, php->filepath_len TSRMLS_CC);1446 zend_string_to_unicode(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), &php->udirpath, &php->udirpath_len, php->dirpath, php->dirpath_len TSRMLS_CC);1447 #endif1448 /* }}} */1449 1465 /* {{{ shallow copy, pointers only */ { 1450 1466 Bucket *b; … … 1482 1498 b = CG(class_table)->pListHead; COPY_H(xc_classinfo_t, classinfos, classinfo_cnt, cest, xc_cest_t); 1483 1499 1484 for (i = 0; i < php->classinfo_cnt; i ++) {1485 xc_classinfo_t *classinfo = &php->classinfos[i];1486 zend_class_entry *ce = CestToCePtr(classinfo->cest);1487 classinfo->methodinfo_cnt = ce->function_table.nTableSize;1488 if (classinfo->methodinfo_cnt) {1489 int j;1490 1491 ECALLOC_N(classinfo->methodinfos, classinfo->methodinfo_cnt);1492 if (!classinfo->methodinfos) {1493 goto err_alloc;1494 }1495 1496 for (j = 0, b = ce->function_table.pListHead; b; j ++, b = b->pListNext) {1497 xc_collect_op_array_info(php, &const_usage, &classinfo->methodinfos[j], (zend_op_array *) b->pData TSRMLS_CC);1498 }1499 }1500 else {1501 classinfo->methodinfos = NULL;1502 }1503 }1504 1505 for (i = 0; i < php->funcinfo_cnt; i ++) {1506 xc_collect_op_array_info(php, &const_usage, &php->funcinfos[i].op_array_info, (zend_op_array *) &php->funcinfos[i].func TSRMLS_CC);1507 }1508 1509 xc_collect_op_array_info(php, &const_usage, &php->op_array_info, php->op_array TSRMLS_CC);1510 1511 1500 #undef COPY_H 1512 1501 … … 1538 1527 } 1539 1528 /* }}} */ 1540 /* {{{ file/dir path free unused */ 1529 1530 /* {{{ collect info for file/dir path */ { 1531 Bucket *b; 1532 xc_const_usage_t const_usage; 1533 unsigned int i; 1534 1535 xc_entry_init_key_php_entry(xce, zend_get_compiled_filename(TSRMLS_C) TSRMLS_CC); 1536 memset(&const_usage, 0, sizeof(const_usage)); 1537 1538 for (i = 0; i < php->classinfo_cnt; i ++) { 1539 xc_classinfo_t *classinfo = &php->classinfos[i]; 1540 zend_class_entry *ce = CestToCePtr(classinfo->cest); 1541 classinfo->methodinfo_cnt = ce->function_table.nTableSize; 1542 if (classinfo->methodinfo_cnt) { 1543 int j; 1544 1545 ECALLOC_N(classinfo->methodinfos, classinfo->methodinfo_cnt); 1546 if (!classinfo->methodinfos) { 1547 goto err_alloc; 1548 } 1549 1550 for (j = 0, b = ce->function_table.pListHead; b; j ++, b = b->pListNext) { 1551 xc_collect_op_array_info(xce, php, &const_usage, &classinfo->methodinfos[j], (zend_op_array *) b->pData TSRMLS_CC); 1552 } 1553 } 1554 else { 1555 classinfo->methodinfos = NULL; 1556 } 1557 } 1558 1559 for (i = 0; i < php->funcinfo_cnt; i ++) { 1560 xc_collect_op_array_info(xce, php, &const_usage, &php->funcinfos[i].op_array_info, (zend_op_array *) &php->funcinfos[i].func TSRMLS_CC); 1561 } 1562 1563 xc_collect_op_array_info(xce, php, &const_usage, &php->op_array_info, php->op_array TSRMLS_CC); 1564 1565 /* file/dir path free unused */ 1541 1566 #define X_FREE_UNUSED(var) \ 1542 if (!const_usage.var##path_used) { \1543 efree(php->var##path); \1544 php->var##path = NULL; \1545 php->var##path_len = 0; \1546 }1547 if (!const_usage.filepath_used) {1548 php->filepath = NULL;1549 php->filepath_len = 0;1550 }1551 X_FREE_UNUSED(dir)1567 if (!const_usage.var##path_used) { \ 1568 efree(xce->var##path); \ 1569 xce->var##path = NULL; \ 1570 xce->var##path_len = 0; \ 1571 } 1572 if (!const_usage.filepath_used) { 1573 xce->filepath = NULL; 1574 xce->filepath_len = 0; 1575 } 1576 X_FREE_UNUSED(dir) 1552 1577 #ifdef IS_UNICODE 1553 X_FREE_UNUSED(ufile)1554 X_FREE_UNUSED(udir)1578 X_FREE_UNUSED(ufile) 1579 X_FREE_UNUSED(udir) 1555 1580 #endif 1556 1581 #undef X_FREE_UNUSED 1582 } 1557 1583 /* }}} */ 1558 1584 #ifdef XCACHE_ERROR_CACHING … … 1603 1629 TRACE("restoring %s", stored_xce->name.str.val); 1604 1630 xc_processor_restore_xc_entry_t(&xce, stored_xce TSRMLS_CC); 1605 xc_processor_restore_xc_entry_data_php_t( &php, xce.data.php, xc_readonly_protection TSRMLS_CC);1631 xc_processor_restore_xc_entry_data_php_t(stored_xce, &php, xce.data.php, xc_readonly_protection TSRMLS_CC); 1606 1632 xce.data.php = &php; 1607 1633 #ifdef SHOW_DPRINT … … 1641 1667 } 1642 1668 /* }}} */ 1643 static zend_op_array *xc_compile_file (zend_file_handle *h, int type TSRMLS_DC) /* {{{ */1669 static zend_op_array *xc_compile_file_ex(xc_entry_t *xce, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */ 1644 1670 { 1645 1671 zend_op_array *op_array; 1646 xc_entry_t xce,*stored_xce;1647 xc_entry_data_php_t php,*stored_php;1648 xc_cache_t *cache ;1672 xc_entry_t *stored_xce; 1673 xc_entry_data_php_t *stored_php; 1674 xc_cache_t *cache = xce->cache; 1649 1675 zend_bool gaveup = 0; 1650 1676 zend_bool catched = 0; 1651 1677 zend_bool newlycompiled; 1652 char *filename;1653 char opened_path_buffer[MAXPATHLEN];1654 1678 xc_sandbox_t sandbox; 1655 1656 assert(xc_initized);1657 1658 TRACE("type = %d\n", h->type);1659 if (!XG(cacher)) {1660 op_array = old_compile_file(h, type TSRMLS_CC);1661 return op_array;1662 }1663 1664 /* {{{ entry_init_key */1665 filename = h->opened_path ? h->opened_path : h->filename;1666 xce.data.php = &php;1667 if (xc_entry_init_key_php(&xce, filename, opened_path_buffer TSRMLS_CC) != SUCCESS) {1668 TRACE("failed to init key for %s", filename);1669 return old_compile_file(h, type TSRMLS_CC);1670 }1671 cache = xce.cache;1672 /* }}} */1673 1679 1674 1680 /* stale clogs precheck */ … … 1681 1687 stored_php = NULL; 1682 1688 ENTER_LOCK_EX(cache) { 1683 stored_xce = xc_entry_find_dmz( &xce TSRMLS_CC);1689 stored_xce = xc_entry_find_dmz(xce TSRMLS_CC); 1684 1690 if (stored_xce) { 1685 1691 xc_cache_hit_dmz(cache TSRMLS_CC); … … 1690 1696 else { 1691 1697 cache->misses ++; 1692 TRACE("miss %s", xce .name.str.val);1693 1694 if (xc_entry_init_key_php_md5( &php, &xce TSRMLS_CC) != SUCCESS) {1698 TRACE("miss %s", xce->name.str.val); 1699 1700 if (xc_entry_init_key_php_md5(xce->data.php, xce TSRMLS_CC) != SUCCESS) { 1695 1701 gaveup = 1; 1696 1702 break; 1697 1703 } 1698 1704 1699 stored_php = xc_php_find_dmz( &php TSRMLS_CC);1705 stored_php = xc_php_find_dmz(xce->data.php TSRMLS_CC); 1700 1706 1701 1707 /* miss but compiling */ … … 1736 1742 if (stored_php) { 1737 1743 newlycompiled = 0; 1738 xce.data.php = stored_php; 1744 xc_entry_init_key_php_entry(xce, h->opened_path ? h->opened_path : h->filename TSRMLS_CC); 1745 xce->data.php = stored_php; 1739 1746 } 1740 1747 else { … … 1742 1749 1743 1750 /* make compile inside sandbox */ 1744 xc_sandbox_init(&sandbox, filename TSRMLS_CC);1751 xc_sandbox_init(&sandbox, h->opened_path ? h->opened_path : h->filename TSRMLS_CC); 1745 1752 1746 1753 #ifdef HAVE_XCACHE_CONSTANT 1747 php.constinfos = NULL;1748 #endif 1749 php.funcinfos = NULL;1750 php.classinfos = NULL;1754 xce->data.php->constinfos = NULL; 1755 #endif 1756 xce->data.php->funcinfos = NULL; 1757 xce->data.php->classinfos = NULL; 1751 1758 #ifdef ZEND_ENGINE_2_1 1752 php.autoglobals = NULL; 1753 #endif 1754 1755 #ifdef IS_UNICODE 1756 php.udirpath = NULL; 1757 php.ufilepath = NULL; 1758 #endif 1759 php.dirpath = NULL; 1760 1761 memset(&php.op_array_info, 0, sizeof(php.op_array_info)); 1759 xce->data.php->autoglobals = NULL; 1760 #endif 1761 1762 memset(&xce->data.php->op_array_info, 0, sizeof(xce->data.php->op_array_info)); 1762 1763 1763 1764 zend_try { 1764 op_array = xc_compile_php( &php, h, type TSRMLS_CC);1765 op_array = xc_compile_php(xce, xce->data.php, h, type TSRMLS_CC); 1765 1766 } zend_catch { 1766 1767 catched = 1; … … 1772 1773 1773 1774 /* not cachable */ 1774 if (! php.op_array) {1775 if (!xce->data.php->op_array) { 1775 1776 cache->compiling = 0; 1776 1777 /* it's not cachable, but don't scare the users with high misses */ … … 1779 1780 return op_array; 1780 1781 } 1781 1782 xce.data.php = &php;1783 1782 } 1784 1783 /* }}} */ … … 1789 1788 * WARNING: this code is required to be after compile 1790 1789 */ 1791 if (xce .inode) {1792 filename = h->opened_path ? h->opened_path : h->filename;1793 if (xce .name.str.val != filename) {1794 xce .name.str.val = filename;1795 xce .name.str.len = strlen(filename);1790 if (xce->inode) { 1791 char *filename = h->opened_path ? h->opened_path : h->filename; 1792 if (xce->name.str.val != filename) { 1793 xce->name.str.val = filename; 1794 xce->name.str.len = strlen(filename); 1796 1795 } 1797 1796 } … … 1799 1798 #endif 1800 1799 #ifdef SHOW_DPRINT 1801 xc_dprint( &xce, 0 TSRMLS_CC);1800 xc_dprint(xce, 0 TSRMLS_CC); 1802 1801 #endif 1803 1802 stored_xce = NULL; … … 1805 1804 /* php_store */ 1806 1805 if (newlycompiled) { 1807 stored_php = xc_php_store_dmz( &php TSRMLS_CC);1806 stored_php = xc_php_store_dmz(xce->data.php TSRMLS_CC); 1808 1807 if (!stored_php) { 1809 1808 /* error */ … … 1813 1812 /* entry_store */ 1814 1813 xc_php_addref_dmz(stored_php); 1815 stored_xce = xc_entry_store_dmz( &xce TSRMLS_CC);1814 stored_xce = xc_entry_store_dmz(xce TSRMLS_CC); 1816 1815 if (stored_xce) { 1817 1816 stored_xce->data.php = stored_php; … … 1831 1830 1832 1831 if (newlycompiled) { 1833 xc_free_php( &php TSRMLS_CC);1832 xc_free_php(xce->data.php TSRMLS_CC); 1834 1833 } 1835 1834 … … 1862 1861 err_aftersandbox: 1863 1862 if (newlycompiled) { 1864 xc_free_php( &php TSRMLS_CC);1863 xc_free_php(xce->data.php TSRMLS_CC); 1865 1864 xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC); 1866 1865 } … … 1871 1870 zend_bailout(); 1872 1871 } 1872 return op_array; 1873 } 1874 /* }}} */ 1875 static zend_op_array *xc_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */ 1876 { 1877 zend_op_array *op_array; 1878 xc_entry_t xce; 1879 xc_entry_data_php_t php; 1880 char *filename; 1881 1882 assert(xc_initized); 1883 1884 TRACE("type = %d\n", h->type); 1885 if (!XG(cacher)) { 1886 op_array = old_compile_file(h, type TSRMLS_CC); 1887 return op_array; 1888 } 1889 1890 /* {{{ entry_init_key */ 1891 filename = h->opened_path ? h->opened_path : h->filename; 1892 xce.data.php = &php; 1893 if (xc_entry_init_key_php(&xce, filename TSRMLS_CC) != SUCCESS) { 1894 TRACE("failed to init key for %s", filename); 1895 return old_compile_file(h, type TSRMLS_CC); 1896 } 1897 /* }}} */ 1898 1899 op_array = xc_compile_file_ex(&xce, h, type TSRMLS_CC); 1900 1901 xc_entry_free_key_php(&xce TSRMLS_CC); 1902 1873 1903 return op_array; 1874 1904 } -
trunk/xcache.h
r671 r684 320 320 size_t size; 321 321 322 int filepath_len;323 char *filepath;324 int dirpath_len;325 char *dirpath;326 #ifdef IS_UNICODE327 UChar *ufilepath;328 int ufilepath_len;329 UChar *udirpath;330 int udirpath_len;331 #endif332 333 322 xc_op_array_info_t op_array_info; 334 323 zend_op_array *op_array; … … 399 388 int inode; /* the filesystem inode */ 400 389 #endif 390 391 /* php only */ 392 int filepath_len; 393 char *filepath; 394 int dirpath_len; 395 char *dirpath; 396 #ifdef IS_UNICODE 397 UChar *ufilepath; 398 int ufilepath_len; 399 UChar *udirpath; 400 int udirpath_len; 401 #endif 402 401 403 }; 402 404 /* }}} */ … … 419 421 /* }}} */ 420 422 void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC); 421 void xc_fix_op_array_info(const xc_entry_ data_php_t *php, zend_op_array *op_array, int shallow_copied, const xc_op_array_info_t *op_array_info TSRMLS_DC);423 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_copied, const xc_op_array_info_t *op_array_info TSRMLS_DC); 422 424 423 425 #endif /* __XCACHE_H */

