Changeset 936 for trunk/xcache.c
- Timestamp:
- 2012-06-28T09:45:40+02:00 (12 months ago)
- File:
-
- 1 edited
-
trunk/xcache.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xcache.c
r931 r936 281 281 if (stored_entry) { 282 282 xc_entry_add_unlocked(cache, entryslotid, stored_entry); 283 ++cache->updates; 283 284 return stored_entry; 284 285 } … … 592 593 add_assoc_long_ex(return_value, ZEND_STRS("slots"), cache->hentry->size); 593 594 add_assoc_long_ex(return_value, ZEND_STRS("compiling"), cache->compiling); 594 add_assoc_long_ex(return_value, ZEND_STRS("misses"), cache->misses); 595 add_assoc_long_ex(return_value, ZEND_STRS("updates"), cache->updates); 596 add_assoc_long_ex(return_value, ZEND_STRS("misses"), cache->updates); /* deprecated */ 595 597 add_assoc_long_ex(return_value, ZEND_STRS("hits"), cache->hits); 596 598 add_assoc_long_ex(return_value, ZEND_STRS("clogs"), cache->clogs); … … 1601 1603 } 1602 1604 /* }}} */ 1603 static zend_op_array *xc_compile_php(xc_compiler_t *compiler, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */ 1604 { 1605 zend_op_array *op_array; 1605 static void xc_compile_php(xc_compiler_t *compiler, zend_file_handle *h, int type TSRMLS_DC) /* {{{ */ 1606 { 1606 1607 zend_uint old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt; 1607 1608 zend_bool catched = 0; … … 1614 1615 old_constinfo_cnt = zend_hash_num_elements(EG(zend_constants)); 1615 1616 1616 compiler->new_php.op_array = NULL;1617 XG(initial_compile_file_called) = 0;1618 1617 zend_try { 1619 op_array = old_compile_file(h, type TSRMLS_CC);1618 compiler->new_php.op_array = old_compile_file(h, type TSRMLS_CC); 1620 1619 } zend_catch { 1621 1620 catched = 1; … … 1626 1625 } 1627 1626 1628 if ( op_array == NULL) {1627 if (compiler->new_php.op_array == NULL) { 1629 1628 goto err_op_array; 1630 1629 } 1631 1630 1632 1631 if (!XG(initial_compile_file_called)) { 1633 return op_array;1632 return; 1634 1633 } 1635 1634 … … 1637 1636 /* {{{ prepare */ 1638 1637 zend_restore_compiled_filename(h->opened_path ? h->opened_path : (char *) h->filename TSRMLS_CC); 1639 compiler->new_php.op_array = op_array;1640 1638 1641 1639 #ifdef HAVE_XCACHE_CONSTANT … … 1819 1817 #endif 1820 1818 1821 return op_array;1819 return; 1822 1820 1823 1821 err_alloc: … … 1830 1828 zend_bailout(); 1831 1829 } 1832 1833 return op_array;1834 1830 } 1835 1831 /* }}} */ … … 1912 1908 */ 1913 1909 1914 zend_op_array *op_array;1915 1910 xc_entry_php_t *stored_entry; 1916 1911 xc_entry_data_php_t *stored_php; … … 1956 1951 } 1957 1952 1958 cache->misses ++;1959 1953 TRACE("miss entry %d:%s", compiler->new_entry.file_inode, compiler->new_entry.entry.name.str.val); 1960 1954 … … 2008 2002 /* }}} */ 2009 2003 2010 op_array = NULL;2011 2004 /* {{{ compile */ 2012 2005 /* make compile inside sandbox */ 2013 xc_sandbox_init(&sandbox, h->opened_path ? h->opened_path : h->filename TSRMLS_CC);2014 2006 2015 2007 #ifdef HAVE_XCACHE_CONSTANT … … 2023 2015 memset(&compiler->new_php.op_array_info, 0, sizeof(compiler->new_php.op_array_info)); 2024 2016 2017 XG(initial_compile_file_called) = 0; 2025 2018 zend_try { 2026 op_array = xc_compile_php(compiler, h, type TSRMLS_CC); 2019 xc_sandbox_init(&sandbox, h->opened_path ? h->opened_path : h->filename TSRMLS_CC); 2020 compiler->new_php.op_array = NULL; 2021 xc_compile_php(compiler, h, type TSRMLS_CC); 2027 2022 } zend_catch { 2028 2023 catched = 1; 2029 2024 } zend_end_try(); 2030 2025 2031 if (catched || !op_array) { 2026 if (catched 2027 || !compiler->new_php.op_array /* possible ? */ 2028 || !XG(initial_compile_file_called)) { 2032 2029 goto err_aftersandbox; 2033 2030 } 2034 2031 2035 /* not cachable */2036 if (!compiler->new_php.op_array) {2037 cache->compiling = 0;2038 /* it's not cachable, but don't scare the users with high misses */2039 cache->misses --;2040 xc_sandbox_free(&sandbox, XC_InstallNoBinding TSRMLS_CC);2041 return op_array;2042 }2043 2032 /* }}} */ 2044 2033 #ifdef SHOW_DPRINT … … 2065 2054 TRACE("%s", stored_entry ? "stored" : "store failed"); 2066 2055 2056 if (catched || !stored_php) { 2057 goto err_aftersandbox; 2058 } 2059 2067 2060 cache->compiling = 0; 2068 if (catched) {2069 goto err_aftersandbox;2070 }2071 2072 2061 xc_free_php(&compiler->new_php TSRMLS_CC); 2073 2062 2074 2063 if (stored_entry) { 2075 if ( op_array) {2064 if (compiler->new_php.op_array) { 2076 2065 #ifdef ZEND_ENGINE_2 2077 destroy_op_array( op_array TSRMLS_CC);2066 destroy_op_array(compiler->new_php.op_array TSRMLS_CC); 2078 2067 #else 2079 destroy_op_array(op_array); 2080 #endif 2081 efree(op_array); 2068 destroy_op_array(compiler->new_php.op_array); 2069 #endif 2070 efree(compiler->new_php.op_array); 2071 compiler->new_php.op_array = NULL; 2082 2072 h = NULL; 2083 2073 } … … 2088 2078 zend_op_array *old_active_op_array = CG(active_op_array); 2089 2079 /* install it */ 2090 CG(active_op_array) = op_array;2080 CG(active_op_array) = compiler->new_php.op_array; 2091 2081 xc_sandbox_free(&sandbox, XC_Install TSRMLS_CC); 2092 2082 CG(active_op_array) = old_active_op_array; 2093 2083 } 2094 return op_array;2084 return compiler->new_php.op_array; 2095 2085 2096 2086 err_aftersandbox: … … 2098 2088 xc_sandbox_free(&sandbox, XC_NoInstall TSRMLS_CC); 2099 2089 2090 cache->compiling = 0; 2100 2091 if (catched) { 2101 cache->compiling = 0;2102 2092 cache->errors ++; 2103 2093 zend_bailout(); 2104 2094 } 2105 return op_array;2095 return compiler->new_php.op_array; 2106 2096 } 2107 2097 /* }}} */ … … 2839 2829 else { 2840 2830 RETVAL_NULL(); 2841 cache->misses ++;2842 2831 } 2843 2832 } LEAVE_LOCK(cache); … … 3025 3014 zv = (zval *) cache->shm->handlers->to_readwrite(cache->shm, (char *) stored_entry_var->value); 3026 3015 Z_LVAL_P(zv) = value; 3016 ++cache->updates; 3027 3017 break; /* leave lock */ 3028 3018 }
Note: See TracChangeset
for help on using the changeset viewer.

