Browse Source

store entry_var_t

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@856 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 10 years ago
parent
commit
06f64aa1eb
  1. 16
      processor/head.m4
  2. 2
      processor/main.m4
  3. 3
      processor/processor.m4
  4. 11
      xcache.c

16
processor/head.m4

@ -415,7 +415,9 @@ $1 *xc_processor_store_$1(xc_cache_t *cache, $1 *src TSRMLS_DC) {
}
zend_hash_destroy(&processor.strings);
}
src->ifelse(`$1', `xc_entry_php_t', entry.)size = processor.size;
src->ifelse(
`$1', `xc_entry_data_php_t', `',
`', `', entry.)size = processor.size;
ifelse(
`$1', `xc_entry_var_t', `src->have_references = processor.have_references;',
`$1', `xc_entry_data_php_t', `src->have_references = processor.have_references;'
@ -466,7 +468,7 @@ err_alloc:
}
/* }}} */
')
DEFINE_STORE_API(`xc_entry_t')
DEFINE_STORE_API(`xc_entry_var_t')
DEFINE_STORE_API(`xc_entry_php_t')
DEFINE_STORE_API(`xc_entry_data_php_t')
/* export: xc_entry_php_t *xc_processor_restore_xc_entry_php_t(xc_entry_php_t *dst, const xc_entry_php_t *src TSRMLS_DC); :export {{{ */
@ -501,12 +503,12 @@ xc_entry_data_php_t *xc_processor_restore_xc_entry_data_php_t(const xc_entry_php
return dst;
}
/* }}} */
/* export: xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC); :export {{{ */
xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src TSRMLS_DC) {
/* export: xc_entry_var_t *xc_processor_restore_xc_entry_var_t(xc_entry_var_t *dst, const xc_entry_var_t *src TSRMLS_DC); :export {{{ */
xc_entry_var_t *xc_processor_restore_xc_entry_var_t(xc_entry_var_t *dst, const xc_entry_var_t *src TSRMLS_DC) {
xc_processor_t processor;
memset(&processor, 0, sizeof(processor));
xc_restore_xc_entry_t(&processor, dst, src TSRMLS_CC);
xc_restore_xc_entry_var_t(&processor, dst, src TSRMLS_CC);
return dst;
}
@ -534,8 +536,8 @@ zval *xc_processor_restore_zval(zval *dst, const zval *src, zend_bool have_refer
/* export: void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC); :export {{{ */
#ifdef HAVE_XCACHE_DPRINT
void xc_dprint(xc_entry_php_t *src, int indent TSRMLS_DC) {
IFDPRINT(`INDENT()`'fprintf(stderr, "xc_entry_t:src");')
xc_dprint_xc_entry_t(src, indent TSRMLS_CC);
IFDPRINT(`INDENT()`'fprintf(stderr, "xc_entry_php_t:src");')
xc_dprint_xc_entry_php_t(src, indent TSRMLS_CC);
}
#endif
/* }}} */

2
processor/main.m4

@ -251,7 +251,7 @@ EXPORT(`HashTable_zend_function')
EXPORT(`zend_class_entry')
EXPORT(`xc_classinfo_t')
EXPORT(`xc_funcinfo_t')
EXPORT(`xc_entry_t')
EXPORT(`xc_entry_var_t')
EXPORT(`xc_entry_php_t')
EXPORT(`xc_entry_data_php_t')
EXPORT(`zval')

3
processor/processor.m4

@ -9,7 +9,8 @@ DECL_STRUCT_P_FUNC(`zend_class_entry')
DECL_STRUCT_P_FUNC(`zend_constant')
#endif
DECL_STRUCT_P_FUNC(`zend_function')
DECL_STRUCT_P_FUNC(`xc_entry_t')
DECL_STRUCT_P_FUNC(`xc_entry_var_t')
DECL_STRUCT_P_FUNC(`xc_entry_php_t')
#ifdef ZEND_ENGINE_2
DECL_STRUCT_P_FUNC(`zend_property_info')
#endif

11
xcache.c

@ -266,7 +266,7 @@ static xc_entry_t *xc_entry_store_dmz(xc_entry_type_t type, xc_cache_t *cache, x
xce->atime = XG(request_time);
stored_xce = type == XC_TYPE_PHP
? (xc_entry_t *) xc_processor_store_xc_entry_php_t(cache, (xc_entry_php_t *) xce TSRMLS_CC)
: xc_processor_store_xc_entry_t(cache, xce TSRMLS_CC);
: (xc_entry_t *) xc_processor_store_xc_entry_var_t(cache, (xc_entry_var_t *) xce TSRMLS_CC);
if (stored_xce) {
xc_entry_add_dmz(cache, entryslotid, stored_xce);
return stored_xce;
@ -282,6 +282,11 @@ static xc_entry_php_t *xc_entry_php_store_dmz(xc_cache_t *cache, xc_hash_value_t
return (xc_entry_php_t *) xc_entry_store_dmz(XC_TYPE_PHP, cache, entryslotid, (xc_entry_t *) xce TSRMLS_CC);
}
/* }}} */
static xc_entry_var_t *xc_entry_var_store_dmz(xc_cache_t *cache, xc_hash_value_t entryslotid, xc_entry_var_t *xce TSRMLS_DC) /* {{{ */
{
return (xc_entry_var_t *) xc_entry_store_dmz(XC_TYPE_VAR, cache, entryslotid, (xc_entry_t *) xce TSRMLS_CC);
}
/* }}} */
static void xc_entry_free_real_dmz(xc_entry_type_t type, xc_cache_t *cache, volatile xc_entry_t *xce) /* {{{ */
{
if (type == XC_TYPE_PHP) {
@ -2753,7 +2758,7 @@ PHP_FUNCTION(xcache_set)
xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) stored_xce TSRMLS_CC);
}
xce.value = value;
RETVAL_BOOL(xc_entry_store_dmz(XC_TYPE_VAR, cache, entry_hash.entryslotid, (xc_entry_t *) &xce TSRMLS_CC) != NULL ? 1 : 0);
RETVAL_BOOL(xc_entry_var_store_dmz(cache, entry_hash.entryslotid, &xce TSRMLS_CC) != NULL ? 1 : 0);
} LEAVE_LOCK(cache);
}
/* }}} */
@ -2943,7 +2948,7 @@ static inline void xc_var_inc_dec(int inc, INTERNAL_FUNCTION_PARAMETERS) /* {{{
xce.entry.hits = stored_xce->entry.hits;
xc_entry_remove_dmz(XC_TYPE_VAR, cache, entry_hash.cacheslotid, (xc_entry_t *) stored_xce TSRMLS_CC);
}
xc_entry_store_dmz(XC_TYPE_VAR, cache, entry_hash.cacheslotid, (xc_entry_t *) &xce TSRMLS_CC);
xc_entry_var_store_dmz(cache, entry_hash.cacheslotid, &xce TSRMLS_CC);
} LEAVE_LOCK(cache);
}

Loading…
Cancel
Save