Changeset 1051
- Timestamp:
- 07/26/2012 05:47:52 AM (10 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 modified
-
Makefile.frag.deps (modified) (1 diff)
-
includes.c (modified) (1 diff)
-
mod_cacher/xc_cache.h (added)
-
mod_cacher/xc_cacher.c (modified) (3 diffs)
-
processor/head.m4 (modified) (3 diffs)
-
processor/processor.m4 (modified) (2 diffs)
-
xcache.h (modified) (2 diffs)
-
xcache/xc_sandbox.h (modified) (1 diff)
-
xcache/xc_utils.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile.frag.deps
r1046 r1051 1 $(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 1 $(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 2 2 $(builddir)/mod_assembler/xc_assembler.lo: 3 $(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.h3 $(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 4 4 $(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 5 5 $(builddir)/mod_decoder/xc_decoder.lo: 6 $(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.h6 $(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) 7 7 $(builddir)/mod_encoder/xc_encoder.lo: 8 8 $(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 -
trunk/includes.c
r393 r1051 1 1 #include "xcache.h" 2 #include "mod_cacher/xc_cache.h" 3 #include "xcache/xc_utils.h" 2 4 #include "zend_compile.h" -
trunk/mod_cacher/xc_cacher.c
r1047 r1051 9 9 /* {{{ macros */ 10 10 #include "xc_cacher.h" 11 #include "xc_cache.h" 11 12 #include "xcache.h" 12 13 #include "xc_processor.h" … … 29 30 #include "SAPI.h" 30 31 32 #define ECALLOC_N(x, n) ((x) = ecalloc(n, sizeof((x)[0]))) 33 #define ECALLOC_ONE(x) ECALLOC_N(x, 1) 31 34 #define VAR_ENTRY_EXPIRED(pentry) ((pentry)->ttl && XG(request_time) > (pentry)->ctime + (time_t) (pentry)->ttl) 32 35 #define CHECK(x, e) do { if ((x) == NULL) { zend_error(E_ERROR, "XCache: " e); goto err; } } while (0) … … 54 57 } \ 55 58 } while(0) 59 /* }}} */ 60 61 /* {{{ types */ 62 struct _xc_hash_t { 63 size_t bits; 64 size_t size; 65 xc_hash_value_t mask; 66 }; 56 67 /* }}} */ 57 68 -
trunk/processor/head.m4
r1018 r1051 12 12 /* export: #include "xcache.h" :export */ 13 13 #include "xcache.h" 14 /* export: #include "mod_cacher/xc_cache.h" :export */ 15 #include "mod_cacher/xc_cache.h" 14 16 #include "util/xc_align.h" 15 17 #include "xcache/xc_const_string.h" 18 #include "xcache/xc_utils.h" 16 19 #include "xc_processor.h" 17 20 #include "xcache_globals.h" … … 359 362 if (!zend_u_hash_exists(done_names, IS_STRING, assert_names[i], strlen(assert_names[i]) + 1)) { 360 363 fprintf(stderr 361 , " missing field at %s `#'%d %s`' : %s\n"364 , "Error: missing field at %s `#'%d %s`' : %s\n" 362 365 , file, line, functionName 363 366 , assert_names[i] … … 377 380 if (!known) { 378 381 fprintf(stderr 379 , " unknown field at %s `#'%d %s`' : %s\n"382 , "Error: unknown field at %s `#'%d %s`' : %s\n" 380 383 , file, line, functionName 381 384 , BUCKET_KEY_S(b) -
trunk/processor/processor.m4
r1027 r1051 1080 1080 ') 1081 1081 IFRESTORE(`', ` 1082 #ifdef E_STRICT1082 #ifdef XCACHE_ERROR_CACHING 1083 1083 DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{ 1084 1084 PROCESS(int, type) … … 1132 1132 ') 1133 1133 #endif 1134 #ifdef E_STRICT1134 #ifdef XCACHE_ERROR_CACHING 1135 1135 PROCESS(zend_uint, compilererror_cnt) 1136 1136 IFRESTORE(` -
trunk/xcache.h
r1040 r1051 10 10 #define XCACHE_WIKI_URL XCACHE_URL "/wiki" 11 11 12 #include <php.h> 12 #include "php.h" 13 14 #if defined(E_STRICT) || defined(E_DEPRECATED) 15 #define XCACHE_ERROR_CACHING 16 #endif 13 17 14 18 #ifdef HAVE_CONFIG_H … … 19 23 #include "xcache/xc_compatibility.h" 20 24 21 #define ECALLOC_N(x, n) ((x) = ecalloc(n, sizeof((x)[0])))22 #define ECALLOC_ONE(x) ECALLOC_N(x, 1)23 24 typedef ulong xc_hash_value_t;25 typedef struct {26 size_t bits;27 size_t size;28 xc_hash_value_t mask;29 } xc_hash_t;30 31 typedef zend_op_array *(zend_compile_file_t)(zend_file_handle *h, int type TSRMLS_DC);32 33 typedef struct _xc_entry_t xc_entry_t;34 typedef struct _xc_entry_data_php_t xc_entry_data_php_t;35 /* {{{ xc_cache_t */36 typedef struct {37 int cacheid;38 xc_hash_t *hcache; /* hash to cacheid */39 40 time_t compiling;41 zend_ulong updates;42 zend_ulong hits;43 zend_ulong clogs;44 zend_ulong ooms;45 zend_ulong errors;46 xc_lock_t *lck;47 xc_shm_t *shm; /* which shm contains us */48 xc_mem_t *mem; /* which mem contains us */49 50 xc_entry_t **entries;51 int entries_count;52 xc_entry_data_php_t **phps;53 int phps_count;54 xc_entry_t *deletes;55 int deletes_count;56 xc_hash_t *hentry; /* hash settings to entry */57 xc_hash_t *hphp; /* hash settings to php */58 59 time_t last_gc_deletes;60 time_t last_gc_expires;61 62 time_t hits_by_hour_cur_time;63 zend_uint hits_by_hour_cur_slot;64 zend_ulong hits_by_hour[24];65 time_t hits_by_second_cur_time;66 zend_uint hits_by_second_cur_slot;67 zend_ulong hits_by_second[5];68 } xc_cache_t;69 /* }}} */70 /* {{{ xc_op_array_info_detail_t */71 typedef struct {72 zend_uint index;73 zend_uint info;74 } xc_op_array_info_detail_t;75 /* }}} */76 /* {{{ xc_op_array_info_t */77 typedef struct {78 #ifdef ZEND_ENGINE_2_479 zend_uint literalinfo_cnt;80 xc_op_array_info_detail_t *literalinfos;81 #else82 zend_uint oplineinfo_cnt;83 xc_op_array_info_detail_t *oplineinfos;84 #endif85 } xc_op_array_info_t;86 /* }}} */87 /* {{{ xc_classinfo_t */88 typedef struct {89 #ifdef IS_UNICODE90 zend_uchar type;91 #endif92 const24_zstr key;93 zend_uint key_size;94 ulong h;95 zend_uint methodinfo_cnt;96 xc_op_array_info_t *methodinfos;97 xc_cest_t cest;98 #ifndef ZEND_COMPILE_DELAYED_BINDING99 int oplineno;100 #endif101 } xc_classinfo_t;102 /* }}} */103 #ifdef HAVE_XCACHE_CONSTANT104 /* {{{ xc_constinfo_t */105 typedef struct {106 #ifdef IS_UNICODE107 zend_uchar type;108 #endif109 const24_zstr key;110 zend_uint key_size;111 ulong h;112 zend_constant constant;113 } xc_constinfo_t;114 /* }}} */115 #endif116 /* {{{ xc_funcinfo_t */117 typedef struct {118 #ifdef IS_UNICODE119 zend_uchar type;120 #endif121 const24_zstr key;122 zend_uint key_size;123 ulong h;124 xc_op_array_info_t op_array_info;125 zend_function func;126 } xc_funcinfo_t;127 /* }}} */128 #ifdef ZEND_ENGINE_2_1129 /* {{{ xc_autoglobal_t */130 typedef struct {131 #ifdef IS_UNICODE132 zend_uchar type;133 #endif134 const24_zstr key;135 zend_uint key_len;136 ulong h;137 } xc_autoglobal_t;138 /* }}} */139 #endif140 typedef struct {141 char digest[16];142 } xc_md5sum_t;143 /* {{{ xc_compilererror_t */144 typedef struct {145 int type;146 uint lineno;147 int error_len;148 char *error;149 } xc_compilererror_t;150 /* }}} */151 /* {{{ xc_entry_data_php_t */152 struct _xc_entry_data_php_t {153 xc_entry_data_php_t *next;154 xc_hash_value_t hvalue;155 156 xc_md5sum_t md5; /* md5sum of the source */157 zend_ulong refcount; /* count of entries referencing to this data */158 159 zend_ulong hits; /* hits of this php */160 size_t size;161 162 xc_op_array_info_t op_array_info;163 zend_op_array *op_array;164 165 #ifdef HAVE_XCACHE_CONSTANT166 zend_uint constinfo_cnt;167 xc_constinfo_t *constinfos;168 #endif169 170 zend_uint funcinfo_cnt;171 xc_funcinfo_t *funcinfos;172 173 zend_uint classinfo_cnt;174 xc_classinfo_t *classinfos;175 #ifndef ZEND_COMPILE_DELAYED_BINDING176 zend_bool have_early_binding;177 #endif178 179 #ifdef ZEND_ENGINE_2_1180 zend_uint autoglobal_cnt;181 xc_autoglobal_t *autoglobals;182 #endif183 184 #ifdef E_STRICT185 zend_uint compilererror_cnt;186 xc_compilererror_t *compilererrors;187 #endif188 189 zend_bool have_references;190 };191 /* }}} */192 typedef zvalue_value xc_entry_name_t;193 /* {{{ xc_entry_t */194 struct _xc_entry_t {195 xc_entry_t *next;196 197 size_t size;198 time_t ctime; /* creation ctime of this entry */199 time_t atime; /* access atime of this entry */200 time_t dtime; /* deletion time of this entry */201 zend_ulong hits;202 zend_ulong ttl;203 204 xc_entry_name_t name;205 };206 207 typedef struct {208 xc_entry_t entry;209 xc_entry_data_php_t *php;210 211 zend_ulong refcount; /* count of php instances holding this entry */212 time_t file_mtime;213 size_t file_size;214 int file_device;215 int file_inode;216 217 int filepath_len;218 ZEND_24(NOTHING, const) char *filepath;219 int dirpath_len;220 char *dirpath;221 #ifdef IS_UNICODE222 int ufilepath_len;223 UChar *ufilepath;224 int udirpath_len;225 UChar *udirpath;226 #endif227 } xc_entry_php_t;228 229 typedef struct {230 xc_entry_t entry;231 #ifdef IS_UNICODE232 zend_uchar name_type;233 #endif234 zval *value;235 zend_bool have_references;236 } xc_entry_var_t;237 /* }}} */238 typedef struct xc_entry_hash_t { /* {{{ */239 xc_hash_value_t cacheid;240 xc_hash_value_t entryslotid;241 } xc_entry_hash_t;242 /* }}} */243 244 25 extern zend_module_entry xcache_module_entry; 245 26 #define phpext_xcache_ptr &xcache_module_entry 246 247 int xc_is_rw(const void *p);248 int xc_is_ro(const void *p);249 int xc_is_shm(const void *p);250 /* {{{ xc_gc_op_array_t */251 typedef struct {252 #ifdef ZEND_ENGINE_2253 zend_uint num_args;254 zend_arg_info *arg_info;255 #endif256 zend_op *opcodes;257 } xc_gc_op_array_t;258 /* }}} */259 void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC);260 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);261 27 262 28 extern zend_bool xc_test; -
trunk/xcache/xc_sandbox.h
r1044 r1051 21 21 zend_uint xc_sandbox_compilererror_cnt(TSRMLS_D); 22 22 #ifdef XCACHE_ERROR_CACHING 23 xc_compilererror_t *xc_sandbox_compilererrors(TSRMLS_D); 23 struct _xc_compilererror_t; 24 struct _xc_compilererror_t *xc_sandbox_compilererrors(TSRMLS_D); 24 25 zend_uint xc_sandbox_compilererror_cnt(TSRMLS_D); 25 26 #endif -
trunk/xcache/xc_utils.h
r1018 r1051 2 2 #include "xc_compatibility.h" 3 3 4 typedef struct { 4 typedef zend_op_array *(zend_compile_file_t)(zend_file_handle *h, int type TSRMLS_DC); 5 6 typedef struct _xc_compilererror_t { 7 int type; 8 uint lineno; 9 int error_len; 10 char *error; 11 } xc_compilererror_t; 12 13 typedef struct _xc_compile_result_t { 5 14 zend_op_array *op_array; 6 15 HashTable *function_table; … … 33 42 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); 34 43 35 #if defined(E_STRICT) || defined(E_DEPRECATED)36 #define XCACHE_ERROR_CACHING37 #endif38 39 44 typedef zend_bool (*xc_if_func_t)(void *data); 40 45

