| [1051] | 1 | #ifndef XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE |
|---|
| 2 | #define XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE |
|---|
| 3 | |
|---|
| 4 | #if _MSC_VER > 1000 |
|---|
| 5 | #pragma once |
|---|
| 6 | #endif /* _MSC_VER > 1000 */ |
|---|
| 7 | |
|---|
| 8 | #include "xcache.h" |
|---|
| 9 | #include "xcache/xc_compatibility.h" |
|---|
| 10 | |
|---|
| 11 | typedef ulong xc_hash_value_t; |
|---|
| 12 | typedef struct _xc_hash_t xc_hash_t; |
|---|
| [1062] | 13 | typedef struct _xc_cached_t xc_cached_t; |
|---|
| [1051] | 14 | typedef struct _xc_entry_t xc_entry_t; |
|---|
| 15 | typedef struct _xc_entry_data_php_t xc_entry_data_php_t; |
|---|
| 16 | |
|---|
| 17 | struct _xc_lock_t; |
|---|
| 18 | struct _xc_shm_t; |
|---|
| 19 | /* {{{ xc_op_array_info_detail_t */ |
|---|
| 20 | typedef struct { |
|---|
| 21 | zend_uint index; |
|---|
| 22 | zend_uint info; |
|---|
| 23 | } xc_op_array_info_detail_t; |
|---|
| 24 | /* }}} */ |
|---|
| 25 | /* {{{ xc_op_array_info_t */ |
|---|
| 26 | typedef struct { |
|---|
| 27 | #ifdef ZEND_ENGINE_2_4 |
|---|
| 28 | zend_uint literalinfo_cnt; |
|---|
| 29 | xc_op_array_info_detail_t *literalinfos; |
|---|
| 30 | #else |
|---|
| 31 | zend_uint oplineinfo_cnt; |
|---|
| 32 | xc_op_array_info_detail_t *oplineinfos; |
|---|
| 33 | #endif |
|---|
| 34 | } xc_op_array_info_t; |
|---|
| 35 | /* }}} */ |
|---|
| 36 | /* {{{ xc_classinfo_t */ |
|---|
| 37 | typedef struct { |
|---|
| 38 | #ifdef IS_UNICODE |
|---|
| 39 | zend_uchar type; |
|---|
| 40 | #endif |
|---|
| 41 | const24_zstr key; |
|---|
| 42 | zend_uint key_size; |
|---|
| 43 | ulong h; |
|---|
| 44 | zend_uint methodinfo_cnt; |
|---|
| 45 | xc_op_array_info_t *methodinfos; |
|---|
| 46 | xc_cest_t cest; |
|---|
| 47 | #ifndef ZEND_COMPILE_DELAYED_BINDING |
|---|
| 48 | int oplineno; |
|---|
| 49 | #endif |
|---|
| 50 | } xc_classinfo_t; |
|---|
| 51 | /* }}} */ |
|---|
| 52 | #ifdef HAVE_XCACHE_CONSTANT |
|---|
| 53 | /* {{{ xc_constinfo_t */ |
|---|
| 54 | typedef struct { |
|---|
| 55 | #ifdef IS_UNICODE |
|---|
| 56 | zend_uchar type; |
|---|
| 57 | #endif |
|---|
| 58 | const24_zstr key; |
|---|
| 59 | zend_uint key_size; |
|---|
| 60 | ulong h; |
|---|
| 61 | zend_constant constant; |
|---|
| 62 | } xc_constinfo_t; |
|---|
| 63 | /* }}} */ |
|---|
| 64 | #endif |
|---|
| 65 | /* {{{ xc_funcinfo_t */ |
|---|
| 66 | typedef struct { |
|---|
| 67 | #ifdef IS_UNICODE |
|---|
| 68 | zend_uchar type; |
|---|
| 69 | #endif |
|---|
| 70 | const24_zstr key; |
|---|
| 71 | zend_uint key_size; |
|---|
| 72 | ulong h; |
|---|
| 73 | xc_op_array_info_t op_array_info; |
|---|
| 74 | zend_function func; |
|---|
| 75 | } xc_funcinfo_t; |
|---|
| 76 | /* }}} */ |
|---|
| 77 | #ifdef ZEND_ENGINE_2_1 |
|---|
| 78 | /* {{{ xc_autoglobal_t */ |
|---|
| 79 | typedef struct { |
|---|
| 80 | #ifdef IS_UNICODE |
|---|
| 81 | zend_uchar type; |
|---|
| 82 | #endif |
|---|
| 83 | const24_zstr key; |
|---|
| 84 | zend_uint key_len; |
|---|
| 85 | ulong h; |
|---|
| 86 | } xc_autoglobal_t; |
|---|
| 87 | /* }}} */ |
|---|
| 88 | #endif |
|---|
| 89 | |
|---|
| 90 | typedef struct { |
|---|
| 91 | char digest[16]; |
|---|
| 92 | } xc_md5sum_t; |
|---|
| 93 | struct _xc_compilererror_t; |
|---|
| 94 | /* {{{ xc_entry_data_php_t */ |
|---|
| 95 | struct _xc_entry_data_php_t { |
|---|
| 96 | xc_entry_data_php_t *next; |
|---|
| 97 | xc_hash_value_t hvalue; |
|---|
| 98 | |
|---|
| 99 | xc_md5sum_t md5; /* md5sum of the source */ |
|---|
| 100 | zend_ulong refcount; /* count of entries referencing to this data */ |
|---|
| 101 | |
|---|
| 102 | zend_ulong hits; /* hits of this php */ |
|---|
| 103 | size_t size; |
|---|
| 104 | |
|---|
| 105 | xc_op_array_info_t op_array_info; |
|---|
| 106 | zend_op_array *op_array; |
|---|
| 107 | |
|---|
| 108 | #ifdef HAVE_XCACHE_CONSTANT |
|---|
| 109 | zend_uint constinfo_cnt; |
|---|
| 110 | xc_constinfo_t *constinfos; |
|---|
| 111 | #endif |
|---|
| 112 | |
|---|
| 113 | zend_uint funcinfo_cnt; |
|---|
| 114 | xc_funcinfo_t *funcinfos; |
|---|
| 115 | |
|---|
| 116 | zend_uint classinfo_cnt; |
|---|
| 117 | xc_classinfo_t *classinfos; |
|---|
| 118 | #ifndef ZEND_COMPILE_DELAYED_BINDING |
|---|
| 119 | zend_bool have_early_binding; |
|---|
| 120 | #endif |
|---|
| 121 | |
|---|
| 122 | #ifdef ZEND_ENGINE_2_1 |
|---|
| 123 | zend_uint autoglobal_cnt; |
|---|
| 124 | xc_autoglobal_t *autoglobals; |
|---|
| 125 | #endif |
|---|
| 126 | |
|---|
| 127 | #ifdef XCACHE_ERROR_CACHING |
|---|
| 128 | zend_uint compilererror_cnt; |
|---|
| 129 | struct _xc_compilererror_t *compilererrors; |
|---|
| 130 | #endif |
|---|
| 131 | |
|---|
| 132 | zend_bool have_references; |
|---|
| 133 | }; |
|---|
| 134 | /* }}} */ |
|---|
| 135 | typedef zvalue_value xc_entry_name_t; |
|---|
| 136 | /* {{{ xc_entry_t */ |
|---|
| 137 | struct _xc_entry_t { |
|---|
| 138 | xc_entry_t *next; |
|---|
| 139 | |
|---|
| 140 | size_t size; |
|---|
| 141 | time_t ctime; /* creation ctime of this entry */ |
|---|
| 142 | time_t atime; /* access atime of this entry */ |
|---|
| 143 | time_t dtime; /* deletion time of this entry */ |
|---|
| 144 | zend_ulong hits; |
|---|
| 145 | zend_ulong ttl; |
|---|
| 146 | |
|---|
| 147 | xc_entry_name_t name; |
|---|
| 148 | }; |
|---|
| 149 | |
|---|
| 150 | typedef struct { |
|---|
| 151 | xc_entry_t entry; |
|---|
| 152 | xc_entry_data_php_t *php; |
|---|
| 153 | |
|---|
| 154 | zend_ulong refcount; /* count of php instances holding this entry */ |
|---|
| 155 | time_t file_mtime; |
|---|
| 156 | size_t file_size; |
|---|
| 157 | int file_device; |
|---|
| 158 | int file_inode; |
|---|
| 159 | |
|---|
| 160 | int filepath_len; |
|---|
| 161 | ZEND_24(NOTHING, const) char *filepath; |
|---|
| 162 | int dirpath_len; |
|---|
| 163 | char *dirpath; |
|---|
| 164 | #ifdef IS_UNICODE |
|---|
| 165 | int ufilepath_len; |
|---|
| 166 | UChar *ufilepath; |
|---|
| 167 | int udirpath_len; |
|---|
| 168 | UChar *udirpath; |
|---|
| 169 | #endif |
|---|
| 170 | } xc_entry_php_t; |
|---|
| 171 | |
|---|
| 172 | typedef struct { |
|---|
| 173 | xc_entry_t entry; |
|---|
| 174 | #ifdef IS_UNICODE |
|---|
| 175 | zend_uchar name_type; |
|---|
| 176 | #endif |
|---|
| 177 | zval *value; |
|---|
| 178 | zend_bool have_references; |
|---|
| 179 | } xc_entry_var_t; |
|---|
| 180 | /* }}} */ |
|---|
| 181 | typedef struct xc_entry_hash_t { /* {{{ */ |
|---|
| 182 | xc_hash_value_t cacheid; |
|---|
| 183 | xc_hash_value_t entryslotid; |
|---|
| 184 | } xc_entry_hash_t; |
|---|
| 185 | /* }}} */ |
|---|
| 186 | |
|---|
| [1188] | 187 | zend_bool xc_is_rw(const void *p); |
|---|
| 188 | zend_bool xc_is_ro(const void *p); |
|---|
| 189 | zend_bool xc_is_shm(const void *p); |
|---|
| [1051] | 190 | /* {{{ xc_gc_op_array_t */ |
|---|
| 191 | typedef struct { |
|---|
| 192 | #ifdef ZEND_ENGINE_2 |
|---|
| 193 | zend_uint num_args; |
|---|
| 194 | zend_arg_info *arg_info; |
|---|
| 195 | #endif |
|---|
| 196 | zend_op *opcodes; |
|---|
| 197 | } xc_gc_op_array_t; |
|---|
| 198 | /* }}} */ |
|---|
| 199 | void xc_gc_add_op_array(xc_gc_op_array_t *gc_op_array TSRMLS_DC); |
|---|
| 200 | 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); |
|---|
| 201 | |
|---|
| 202 | #endif /* XC_CACHE_H_684B099102B4651FB10058EF6F7E80CE */ |
|---|