refactor: move more cache stuffs to mod_cacher
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1051 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
parent
186c10e279
commit
ef9f0d6d09
|
@ -1,9 +1,9 @@
|
|||
$(XCACHE_INCLUDES_I) $(builddir)/includes.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_mem.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_lock.h $(srcdir)/xcache/xc_compatibility.h
|
||||
$(XCACHE_INCLUDES_I) $(builddir)/includes.lo: $(srcdir)/xcache.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_mem.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_lock.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/mod_cacher/xc_cache.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache/xc_compatibility.h
|
||||
$(builddir)/mod_assembler/xc_assembler.lo:
|
||||
$(builddir)/mod_cacher/xc_cacher.lo: $(srcdir)/mod_cacher/xc_cacher.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_mem.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_lock.h $(srcdir)/xcache/xc_compatibility.h $(XCACHE_PROC_H) $(srcdir)/xcache.h $(srcdir)/xcache_globals.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache/xc_extension.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/util/xc_trace.h $(srcdir)/util/xc_vector.h $(srcdir)/util/xc_align.h
|
||||
$(builddir)/mod_cacher/xc_cacher.lo: $(srcdir)/mod_cacher/xc_cacher.h $(srcdir)/mod_cacher/xc_cache.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_mem.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_lock.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_compatibility.h $(XCACHE_PROC_H) $(srcdir)/xcache_globals.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache/xc_extension.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/util/xc_trace.h $(srcdir)/util/xc_vector.h $(srcdir)/util/xc_align.h
|
||||
$(builddir)/mod_coverager/xc_coverager.lo: $(srcdir)/mod_coverager/xc_coverager.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_mem.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_lock.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_extension.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache_globals.h $(srcdir)/util/xc_stack.h
|
||||
$(builddir)/mod_decoder/xc_decoder.lo:
|
||||
$(builddir)/mod_disassembler/xc_disassembler.lo: $(srcdir)/mod_disassembler/xc_disassembler.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_mem.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_lock.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/xcache/xc_compatibility.h $(XCACHE_PROC_H) $(srcdir)/xcache.h
|
||||
$(builddir)/mod_disassembler/xc_disassembler.lo: $(srcdir)/mod_disassembler/xc_disassembler.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_mem.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_lock.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_sandbox.h $(srcdir)/xcache/xc_compatibility.h $(XCACHE_PROC_H)
|
||||
$(builddir)/mod_encoder/xc_encoder.lo:
|
||||
$(builddir)/mod_optimizer/xc_optimizer.lo: $(srcdir)/mod_optimizer/xc_optimizer.h $(srcdir)/xcache/xc_extension.h $(srcdir)/util/xc_stack.h $(srcdir)/xcache/xc_ini.h $(srcdir)/xcache/xc_utils.h $(srcdir)/xcache.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_mem.h $(srcdir)/xcache/xc_shm.h $(srcdir)/xcache/xc_lock.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/xcache/xc_compatibility.h $(srcdir)/util/xc_trace.h $(srcdir)/xcache_globals.h $(srcdir)/util/xc_stack.h
|
||||
$(builddir)/util/xc_stack.lo: $(srcdir)/util/xc_trace.h $(srcdir)/util/xc_stack.h
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
#include "xcache.h"
|
||||
#include "mod_cacher/xc_cache.h"
|
||||
#include "xcache/xc_utils.h"
|
||||
#include "zend_compile.h"
|
||||
|
|
|
@ -0,0 +1,236 @@
|
|||
#ifndef XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE
|
||||
#define XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif /* _MSC_VER > 1000 */
|
||||
|
||||
#include "xcache.h"
|
||||
#include "xcache/xc_compatibility.h"
|
||||
|
||||
typedef ulong xc_hash_value_t;
|
||||
typedef struct _xc_hash_t xc_hash_t;
|
||||
typedef struct _xc_entry_t xc_entry_t;
|
||||
typedef struct _xc_entry_data_php_t xc_entry_data_php_t;
|
||||
|
||||
struct _xc_lock_t;
|
||||
struct _xc_shm_t;
|
||||
/* {{{ xc_cache_t */
|
||||
typedef struct {
|
||||
int cacheid;
|
||||
xc_hash_t *hcache; /* hash to cacheid */
|
||||
|
||||
time_t compiling;
|
||||
zend_ulong updates;
|
||||
zend_ulong hits;
|
||||
zend_ulong clogs;
|
||||
zend_ulong ooms;
|
||||
zend_ulong errors;
|
||||
struct _xc_lock_t *lck;
|
||||
struct _xc_shm_t *shm; /* which shm contains us */
|
||||
struct _xc_mem_t *mem; /* which mem contains us */
|
||||
|
||||
xc_entry_t **entries;
|
||||
int entries_count;
|
||||
xc_entry_data_php_t **phps;
|
||||
int phps_count;
|
||||
xc_entry_t *deletes;
|
||||
int deletes_count;
|
||||
xc_hash_t *hentry; /* hash settings to entry */
|
||||
xc_hash_t *hphp; /* hash settings to php */
|
||||
|
||||
time_t last_gc_deletes;
|
||||
time_t last_gc_expires;
|
||||
|
||||
time_t hits_by_hour_cur_time;
|
||||
zend_uint hits_by_hour_cur_slot;
|
||||
zend_ulong hits_by_hour[24];
|
||||
time_t hits_by_second_cur_time;
|
||||
zend_uint hits_by_second_cur_slot;
|
||||
zend_ulong hits_by_second[5];
|
||||
} xc_cache_t;
|
||||
/* }}} */
|
||||
/* {{{ xc_op_array_info_detail_t */
|
||||
typedef struct {
|
||||
zend_uint index;
|
||||
zend_uint info;
|
||||
} xc_op_array_info_detail_t;
|
||||
/* }}} */
|
||||
/* {{{ xc_op_array_info_t */
|
||||
typedef struct {
|
||||
#ifdef ZEND_ENGINE_2_4
|
||||
zend_uint literalinfo_cnt;
|
||||
xc_op_array_info_detail_t *literalinfos;
|
||||
#else
|
||||
zend_uint oplineinfo_cnt;
|
||||
xc_op_array_info_detail_t *oplineinfos;
|
||||
#endif
|
||||
} xc_op_array_info_t;
|
||||
/* }}} */
|
||||
/* {{{ xc_classinfo_t */
|
||||
typedef struct {
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar type;
|
||||
#endif
|
||||
const24_zstr key;
|
||||
zend_uint key_size;
|
||||
ulong h;
|
||||
zend_uint methodinfo_cnt;
|
||||
xc_op_array_info_t *methodinfos;
|
||||
xc_cest_t cest;
|
||||
#ifndef ZEND_COMPILE_DELAYED_BINDING
|
||||
int oplineno;
|
||||
#endif
|
||||
} xc_classinfo_t;
|
||||
/* }}} */
|
||||
#ifdef HAVE_XCACHE_CONSTANT
|
||||
/* {{{ xc_constinfo_t */
|
||||
typedef struct {
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar type;
|
||||
#endif
|
||||
const24_zstr key;
|
||||
zend_uint key_size;
|
||||
ulong h;
|
||||
zend_constant constant;
|
||||
} xc_constinfo_t;
|
||||
/* }}} */
|
||||
#endif
|
||||
/* {{{ xc_funcinfo_t */
|
||||
typedef struct {
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar type;
|
||||
#endif
|
||||
const24_zstr key;
|
||||
zend_uint key_size;
|
||||
ulong h;
|
||||
xc_op_array_info_t op_array_info;
|
||||
zend_function func;
|
||||
} xc_funcinfo_t;
|
||||
/* }}} */
|
||||
#ifdef ZEND_ENGINE_2_1
|
||||
/* {{{ xc_autoglobal_t */
|
||||
typedef struct {
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar type;
|
||||
#endif
|
||||
const24_zstr key;
|
||||
zend_uint key_len;
|
||||
ulong h;
|
||||
} xc_autoglobal_t;
|
||||
/* }}} */
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char digest[16];
|
||||
} xc_md5sum_t;
|
||||
struct _xc_compilererror_t;
|
||||
/* {{{ xc_entry_data_php_t */
|
||||
struct _xc_entry_data_php_t {
|
||||
xc_entry_data_php_t *next;
|
||||
xc_hash_value_t hvalue;
|
||||
|
||||
xc_md5sum_t md5; /* md5sum of the source */
|
||||
zend_ulong refcount; /* count of entries referencing to this data */
|
||||
|
||||
zend_ulong hits; /* hits of this php */
|
||||
size_t size;
|
||||
|
||||
xc_op_array_info_t op_array_info;
|
||||
zend_op_array *op_array;
|
||||
|
||||
#ifdef HAVE_XCACHE_CONSTANT
|
||||
zend_uint constinfo_cnt;
|
||||
xc_constinfo_t *constinfos;
|
||||
#endif
|
||||
|
||||
zend_uint funcinfo_cnt;
|
||||
xc_funcinfo_t *funcinfos;
|
||||
|
||||
zend_uint classinfo_cnt;
|
||||
xc_classinfo_t *classinfos;
|
||||
#ifndef ZEND_COMPILE_DELAYED_BINDING
|
||||
zend_bool have_early_binding;
|
||||
#endif
|
||||
|
||||
#ifdef ZEND_ENGINE_2_1
|
||||
zend_uint autoglobal_cnt;
|
||||
xc_autoglobal_t *autoglobals;
|
||||
#endif
|
||||
|
||||
#ifdef XCACHE_ERROR_CACHING
|
||||
zend_uint compilererror_cnt;
|
||||
struct _xc_compilererror_t *compilererrors;
|
||||
#endif
|
||||
|
||||
zend_bool have_references;
|
||||
};
|
||||
/* }}} */
|
||||
typedef zvalue_value xc_entry_name_t;
|
||||
/* {{{ xc_entry_t */
|
||||
struct _xc_entry_t {
|
||||
xc_entry_t *next;
|
||||
|
||||
size_t size;
|
||||
time_t ctime; /* creation ctime of this entry */
|
||||
time_t atime; /* access atime of this entry */
|
||||
time_t dtime; /* deletion time of this entry */
|
||||
zend_ulong hits;
|
||||
zend_ulong ttl;
|
||||
|
||||
xc_entry_name_t name;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
xc_entry_t entry;
|
||||
xc_entry_data_php_t *php;
|
||||
|
||||
zend_ulong refcount; /* count of php instances holding this entry */
|
||||
time_t file_mtime;
|
||||
size_t file_size;
|
||||
int file_device;
|
||||
int file_inode;
|
||||
|
||||
int filepath_len;
|
||||
ZEND_24(NOTHING, const) char *filepath;
|
||||
int dirpath_len;
|
||||
char *dirpath;
|
||||
#ifdef IS_UNICODE
|
||||
int ufilepath_len;
|
||||
UChar *ufilepath;
|
||||
int udirpath_len;
|
||||
UChar *udirpath;
|
||||
#endif
|
||||
} xc_entry_php_t;
|
||||
|
||||
typedef struct {
|
||||
xc_entry_t entry;
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar name_type;
|
||||
#endif
|
||||
zval *value;
|
||||
zend_bool have_references;
|
||||
} xc_entry_var_t;
|
||||
/* }}} */
|
||||
typedef struct xc_entry_hash_t { /* {{{ */
|
||||
xc_hash_value_t cacheid;
|
||||
xc_hash_value_t entryslotid;
|
||||
} xc_entry_hash_t;
|
||||
/* }}} */
|
||||
|
||||
int xc_is_rw(const void *p);
|
||||
int xc_is_ro(const void *p);
|
||||
int xc_is_shm(const void *p);
|
||||
/* {{{ xc_gc_op_array_t */
|
||||
typedef struct {
|
||||
#ifdef ZEND_ENGINE_2
|
||||
zend_uint num_args;
|
||||
zend_arg_info *arg_info;
|
||||
#endif
|
||||
zend_op *opcodes;
|
||||
} xc_gc_op_array_t;
|
||||
/* }}} */
|
||||
void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC);
|
||||
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);
|
||||
|
||||
#endif /* XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE */
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
/* {{{ macros */
|
||||
#include "xc_cacher.h"
|
||||
#include "xc_cache.h"
|
||||
#include "xcache.h"
|
||||
#include "xc_processor.h"
|
||||
#include "xcache_globals.h"
|
||||
|
@ -28,6 +29,8 @@
|
|||
#include "ext/standard/php_math.h"
|
||||
#include "SAPI.h"
|
||||
|
||||
#define ECALLOC_N(x, n) ((x) = ecalloc(n, sizeof((x)[0])))
|
||||
#define ECALLOC_ONE(x) ECALLOC_N(x, 1)
|
||||
#define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (time_t) (pentry)->ttl)
|
||||
#define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0)
|
||||
#define LOCK(x) xc_lock((x)->lck)
|
||||
|
@ -55,6 +58,14 @@
|
|||
} while(0)
|
||||
/* }}} */
|
||||
|
||||
/* {{{ types */
|
||||
struct _xc_hash_t {
|
||||
size_t bits;
|
||||
size_t size;
|
||||
xc_hash_value_t mask;
|
||||
};
|
||||
/* }}} */
|
||||
|
||||
/* {{{ globals */
|
||||
static char *xc_shm_scheme = NULL;
|
||||
static char *xc_mmap_path = NULL;
|
||||
|
|
|
@ -11,8 +11,11 @@ divert(0)
|
|||
|
||||
/* export: #include "xcache.h" :export */
|
||||
#include "xcache.h"
|
||||
/* export: #include "mod_cacher/xc_cache.h" :export */
|
||||
#include "mod_cacher/xc_cache.h"
|
||||
#include "util/xc_align.h"
|
||||
#include "xcache/xc_const_string.h"
|
||||
#include "xcache/xc_utils.h"
|
||||
#include "xc_processor.h"
|
||||
#include "xcache_globals.h"
|
||||
|
||||
|
@ -358,7 +361,7 @@ static int xc_check_names(const char *file, int line, const char *functionName,
|
|||
for (i = 0; i < assert_names_count; ++i) {
|
||||
if (!zend_u_hash_exists(done_names, IS_STRING, assert_names[i], strlen(assert_names[i]) + 1)) {
|
||||
fprintf(stderr
|
||||
, "missing field at %s `#'%d %s`' : %s\n"
|
||||
, "Error: missing field at %s `#'%d %s`' : %s\n"
|
||||
, file, line, functionName
|
||||
, assert_names[i]
|
||||
);
|
||||
|
@ -376,7 +379,7 @@ static int xc_check_names(const char *file, int line, const char *functionName,
|
|||
}
|
||||
if (!known) {
|
||||
fprintf(stderr
|
||||
, "unknown field at %s `#'%d %s`' : %s\n"
|
||||
, "Error: unknown field at %s `#'%d %s`' : %s\n"
|
||||
, file, line, functionName
|
||||
, BUCKET_KEY_S(b)
|
||||
);
|
||||
|
|
|
@ -1079,7 +1079,7 @@ dnl }}}
|
|||
#endif
|
||||
')
|
||||
IFRESTORE(`', `
|
||||
#ifdef E_STRICT
|
||||
#ifdef XCACHE_ERROR_CACHING
|
||||
DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{
|
||||
PROCESS(int, type)
|
||||
PROCESS(uint, lineno)
|
||||
|
@ -1131,7 +1131,7 @@ DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
|
|||
STRUCT_ARRAY(zend_uint, autoglobal_cnt, xc_autoglobal_t, autoglobals)
|
||||
')
|
||||
#endif
|
||||
#ifdef E_STRICT
|
||||
#ifdef XCACHE_ERROR_CACHING
|
||||
PROCESS(zend_uint, compilererror_cnt)
|
||||
IFRESTORE(`
|
||||
COPY(compilererrors)
|
||||
|
|
244
xcache.h
244
xcache.h
|
@ -9,7 +9,11 @@
|
|||
#define XCACHE_URL "http://xcache.lighttpd.net"
|
||||
#define XCACHE_WIKI_URL XCACHE_URL "/wiki"
|
||||
|
||||
#include <php.h>
|
||||
#include "php.h"
|
||||
|
||||
#if defined(E_STRICT) || defined(E_DEPRECATED)
|
||||
#define XCACHE_ERROR_CACHING
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
|
@ -18,247 +22,9 @@
|
|||
#include "xcache/xc_lock.h"
|
||||
#include "xcache/xc_compatibility.h"
|
||||
|
||||
#define ECALLOC_N(x, n) ((x) = ecalloc(n, sizeof((x)[0])))
|
||||
#define ECALLOC_ONE(x) ECALLOC_N(x, 1)
|
||||
|
||||
typedef ulong xc_hash_value_t;
|
||||
typedef struct {
|
||||
size_t bits;
|
||||
size_t size;
|
||||
xc_hash_value_t mask;
|
||||
} xc_hash_t;
|
||||
|
||||
typedef zend_op_array *(zend_compile_file_t)(zend_file_handle *h, int type TSRMLS_DC);
|
||||
|
||||
typedef struct _xc_entry_t xc_entry_t;
|
||||
typedef struct _xc_entry_data_php_t xc_entry_data_php_t;
|
||||
/* {{{ xc_cache_t */
|
||||
typedef struct {
|
||||
int cacheid;
|
||||
xc_hash_t *hcache; /* hash to cacheid */
|
||||
|
||||
time_t compiling;
|
||||
zend_ulong updates;
|
||||
zend_ulong hits;
|
||||
zend_ulong clogs;
|
||||
zend_ulong ooms;
|
||||
zend_ulong errors;
|
||||
xc_lock_t *lck;
|
||||
xc_shm_t *shm; /* which shm contains us */
|
||||
xc_mem_t *mem; /* which mem contains us */
|
||||
|
||||
xc_entry_t **entries;
|
||||
int entries_count;
|
||||
xc_entry_data_php_t **phps;
|
||||
int phps_count;
|
||||
xc_entry_t *deletes;
|
||||
int deletes_count;
|
||||
xc_hash_t *hentry; /* hash settings to entry */
|
||||
xc_hash_t *hphp; /* hash settings to php */
|
||||
|
||||
time_t last_gc_deletes;
|
||||
time_t last_gc_expires;
|
||||
|
||||
time_t hits_by_hour_cur_time;
|
||||
zend_uint hits_by_hour_cur_slot;
|
||||
zend_ulong hits_by_hour[24];
|
||||
time_t hits_by_second_cur_time;
|
||||
zend_uint hits_by_second_cur_slot;
|
||||
zend_ulong hits_by_second[5];
|
||||
} xc_cache_t;
|
||||
/* }}} */
|
||||
/* {{{ xc_op_array_info_detail_t */
|
||||
typedef struct {
|
||||
zend_uint index;
|
||||
zend_uint info;
|
||||
} xc_op_array_info_detail_t;
|
||||
/* }}} */
|
||||
/* {{{ xc_op_array_info_t */
|
||||
typedef struct {
|
||||
#ifdef ZEND_ENGINE_2_4
|
||||
zend_uint literalinfo_cnt;
|
||||
xc_op_array_info_detail_t *literalinfos;
|
||||
#else
|
||||
zend_uint oplineinfo_cnt;
|
||||
xc_op_array_info_detail_t *oplineinfos;
|
||||
#endif
|
||||
} xc_op_array_info_t;
|
||||
/* }}} */
|
||||
/* {{{ xc_classinfo_t */
|
||||
typedef struct {
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar type;
|
||||
#endif
|
||||
const24_zstr key;
|
||||
zend_uint key_size;
|
||||
ulong h;
|
||||
zend_uint methodinfo_cnt;
|
||||
xc_op_array_info_t *methodinfos;
|
||||
xc_cest_t cest;
|
||||
#ifndef ZEND_COMPILE_DELAYED_BINDING
|
||||
int oplineno;
|
||||
#endif
|
||||
} xc_classinfo_t;
|
||||
/* }}} */
|
||||
#ifdef HAVE_XCACHE_CONSTANT
|
||||
/* {{{ xc_constinfo_t */
|
||||
typedef struct {
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar type;
|
||||
#endif
|
||||
const24_zstr key;
|
||||
zend_uint key_size;
|
||||
ulong h;
|
||||
zend_constant constant;
|
||||
} xc_constinfo_t;
|
||||
/* }}} */
|
||||
#endif
|
||||
/* {{{ xc_funcinfo_t */
|
||||
typedef struct {
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar type;
|
||||
#endif
|
||||
const24_zstr key;
|
||||
zend_uint key_size;
|
||||
ulong h;
|
||||
xc_op_array_info_t op_array_info;
|
||||
zend_function func;
|
||||
} xc_funcinfo_t;
|
||||
/* }}} */
|
||||
#ifdef ZEND_ENGINE_2_1
|
||||
/* {{{ xc_autoglobal_t */
|
||||
typedef struct {
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar type;
|
||||
#endif
|
||||
const24_zstr key;
|
||||
zend_uint key_len;
|
||||
ulong h;
|
||||
} xc_autoglobal_t;
|
||||
/* }}} */
|
||||
#endif
|
||||
typedef struct {
|
||||
char digest[16];
|
||||
} xc_md5sum_t;
|
||||
/* {{{ xc_compilererror_t */
|
||||
typedef struct {
|
||||
int type;
|
||||
uint lineno;
|
||||
int error_len;
|
||||
char *error;
|
||||
} xc_compilererror_t;
|
||||
/* }}} */
|
||||
/* {{{ xc_entry_data_php_t */
|
||||
struct _xc_entry_data_php_t {
|
||||
xc_entry_data_php_t *next;
|
||||
xc_hash_value_t hvalue;
|
||||
|
||||
xc_md5sum_t md5; /* md5sum of the source */
|
||||
zend_ulong refcount; /* count of entries referencing to this data */
|
||||
|
||||
zend_ulong hits; /* hits of this php */
|
||||
size_t size;
|
||||
|
||||
xc_op_array_info_t op_array_info;
|
||||
zend_op_array *op_array;
|
||||
|
||||
#ifdef HAVE_XCACHE_CONSTANT
|
||||
zend_uint constinfo_cnt;
|
||||
xc_constinfo_t *constinfos;
|
||||
#endif
|
||||
|
||||
zend_uint funcinfo_cnt;
|
||||
xc_funcinfo_t *funcinfos;
|
||||
|
||||
zend_uint classinfo_cnt;
|
||||
xc_classinfo_t *classinfos;
|
||||
#ifndef ZEND_COMPILE_DELAYED_BINDING
|
||||
zend_bool have_early_binding;
|
||||
#endif
|
||||
|
||||
#ifdef ZEND_ENGINE_2_1
|
||||
zend_uint autoglobal_cnt;
|
||||
xc_autoglobal_t *autoglobals;
|
||||
#endif
|
||||
|
||||
#ifdef E_STRICT
|
||||
zend_uint compilererror_cnt;
|
||||
xc_compilererror_t *compilererrors;
|
||||
#endif
|
||||
|
||||
zend_bool have_references;
|
||||
};
|
||||
/* }}} */
|
||||
typedef zvalue_value xc_entry_name_t;
|
||||
/* {{{ xc_entry_t */
|
||||
struct _xc_entry_t {
|
||||
xc_entry_t *next;
|
||||
|
||||
size_t size;
|
||||
time_t ctime; /* creation ctime of this entry */
|
||||
time_t atime; /* access atime of this entry */
|
||||
time_t dtime; /* deletion time of this entry */
|
||||
zend_ulong hits;
|
||||
zend_ulong ttl;
|
||||
|
||||
xc_entry_name_t name;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
xc_entry_t entry;
|
||||
xc_entry_data_php_t *php;
|
||||
|
||||
zend_ulong refcount; /* count of php instances holding this entry */
|
||||
time_t file_mtime;
|
||||
size_t file_size;
|
||||
int file_device;
|
||||
int file_inode;
|
||||
|
||||
int filepath_len;
|
||||
ZEND_24(NOTHING, const) char *filepath;
|
||||
int dirpath_len;
|
||||
char *dirpath;
|
||||
#ifdef IS_UNICODE
|
||||
int ufilepath_len;
|
||||
UChar *ufilepath;
|
||||
int udirpath_len;
|
||||
UChar *udirpath;
|
||||
#endif
|
||||
} xc_entry_php_t;
|
||||
|
||||
typedef struct {
|
||||
xc_entry_t entry;
|
||||
#ifdef IS_UNICODE
|
||||
zend_uchar name_type;
|
||||
#endif
|
||||
zval *value;
|
||||
zend_bool have_references;
|
||||
} xc_entry_var_t;
|
||||
/* }}} */
|
||||
typedef struct xc_entry_hash_t { /* {{{ */
|
||||
xc_hash_value_t cacheid;
|
||||
xc_hash_value_t entryslotid;
|
||||
} xc_entry_hash_t;
|
||||
/* }}} */
|
||||
|
||||
extern zend_module_entry xcache_module_entry;
|
||||
#define phpext_xcache_ptr &xcache_module_entry
|
||||
|
||||
int xc_is_rw(const void *p);
|
||||
int xc_is_ro(const void *p);
|
||||
int xc_is_shm(const void *p);
|
||||
/* {{{ xc_gc_op_array_t */
|
||||
typedef struct {
|
||||
#ifdef ZEND_ENGINE_2
|
||||
zend_uint num_args;
|
||||
zend_arg_info *arg_info;
|
||||
#endif
|
||||
zend_op *opcodes;
|
||||
} xc_gc_op_array_t;
|
||||
/* }}} */
|
||||
void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC);
|
||||
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);
|
||||
|
||||
extern zend_bool xc_test;
|
||||
|
||||
#endif /* __XCACHE_H */
|
||||
|
|
|
@ -20,7 +20,8 @@ const Bucket *xc_sandbox_user_function_begin(TSRMLS_D);
|
|||
const Bucket *xc_sandbox_user_class_begin(TSRMLS_D);
|
||||
zend_uint xc_sandbox_compilererror_cnt(TSRMLS_D);
|
||||
#ifdef XCACHE_ERROR_CACHING
|
||||
xc_compilererror_t *xc_sandbox_compilererrors(TSRMLS_D);
|
||||
struct _xc_compilererror_t;
|
||||
struct _xc_compilererror_t *xc_sandbox_compilererrors(TSRMLS_D);
|
||||
zend_uint xc_sandbox_compilererror_cnt(TSRMLS_D);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
#include "xcache.h"
|
||||
#include "xc_compatibility.h"
|
||||
|
||||
typedef struct {
|
||||
typedef zend_op_array *(zend_compile_file_t)(zend_file_handle *h, int type TSRMLS_DC);
|
||||
|
||||
typedef struct _xc_compilererror_t {
|
||||
int type;
|
||||
uint lineno;
|
||||
int error_len;
|
||||
char *error;
|
||||
} xc_compilererror_t;
|
||||
|
||||
typedef struct _xc_compile_result_t {
|
||||
zend_op_array *op_array;
|
||||
HashTable *function_table;
|
||||
HashTable *class_table;
|
||||
|
@ -32,10 +41,6 @@ void xc_install_constant(ZEND_24(NOTHING, const) char *filename, zend_constant *
|
|||
void xc_install_function(ZEND_24(NOTHING, const) char *filename, zend_function *func, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
|
||||
ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(NOTHING, const) char *filename, xc_cest_t *cest, int oplineno, zend_uchar type, const24_zstr key, uint len, ulong h TSRMLS_DC);
|
||||
|
||||
#if defined(E_STRICT) || defined(E_DEPRECATED)
|
||||
#define XCACHE_ERROR_CACHING
|
||||
#endif
|
||||
|
||||
typedef zend_bool (*xc_if_func_t)(void *data);
|
||||
|
||||
void xc_hash_copy_if(HashTable *target, HashTable *source, copy_ctor_func_t pCopyConstructor, void *tmp, uint size, xc_if_func_t checker);
|
||||
|
|
Loading…
Reference in New Issue