source: trunk/mod_cacher/xc_cache.h @ 1062

Last change on this file since 1062 was 1062, checked in by moo, 21 months ago

const some mem handlers
split non-shared data from shm
make editor goto file correctly

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