Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 232 lines (176 sloc) 5.741 kB
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
6 +----------------------------------------------------------------------+
7 | This source file is subject to the Zend license, that is bundled |
8 | with this package in the file LICENSE. If you did not receive a |
9 | copy of the Zend license, please mail us at zend@zend.com so we can |
10 | send you a copy immediately. |
11 +----------------------------------------------------------------------+
12 | Authors: Andi Gutmans <andi@zend.com> |
13 | Zeev Suraski <zeev@zend.com> |
14 +----------------------------------------------------------------------+
15 */
16
551fe77 @zsuraski Make token names uniform, they all begin with T_ now.
zsuraski authored
17 #ifndef _T_GLOBALS_H
18 #define _T_GLOBALS_H
573b460 @andigutmans Zend Library
andigutmans authored
19
20 #include <setjmp.h>
21
22 #include "zend_stack.h"
23 #include "zend_ptr_stack.h"
24 #include "zend_hash.h"
25 #include "zend_llist.h"
26
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles aga…
zsuraski authored
27 /* Define ZTS if you want a thread-safe Zend */
52fcaa4 @zsuraski Thread-safe project
zsuraski authored
28 /*#undef ZTS*/
573b460 @andigutmans Zend Library
andigutmans authored
29
30 #ifdef ZTS
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles aga…
zsuraski authored
31 #include "../TSRM/TSRM.h"
573b460 @andigutmans Zend Library
andigutmans authored
32
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
33 #ifdef __cplusplus
34 class ZendFlexLexer;
35 #endif
36
37 BEGIN_EXTERN_C()
e06a1ed @zsuraski Thread safety fixes
zsuraski authored
38 ZEND_API extern int compiler_globals_id;
39 ZEND_API extern int executor_globals_id;
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles aga…
zsuraski authored
40 extern int alloc_globals_id;
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
41 END_EXTERN_C()
42
573b460 @andigutmans Zend Library
andigutmans authored
43 #endif
44
45 typedef struct _zend_compiler_globals zend_compiler_globals;
46 typedef struct _zend_executor_globals zend_executor_globals;
47 typedef struct _zend_alloc_globals zend_alloc_globals;
48
49 #define SYMTABLE_CACHE_SIZE 32
50
51
52 /* Compiler */
53 #ifdef ZTS
54 # define CLS_D zend_compiler_globals *compiler_globals
55 # define CLS_DC , CLS_D
56 # define CLS_C compiler_globals
57 # define CLS_CC , CLS_C
58 # define CG(v) (((zend_compiler_globals *) compiler_globals)->v)
942f409 @zsuraski * Change the thread safe project to create a C++ scanner.
zsuraski authored
59 # define CLS_FETCH() zend_compiler_globals *compiler_globals = (zend_compiler_globals *) ts_resource(compiler_globals_id)
573b460 @andigutmans Zend Library
andigutmans authored
60 # define YYPARSE_PARAM compiler_globals
61 # define YYLEX_PARAM compiler_globals
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
62 BEGIN_EXTERN_C()
573b460 @andigutmans Zend Library
andigutmans authored
63 int zendparse(void *compiler_globals);
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
64 END_EXTERN_C()
573b460 @andigutmans Zend Library
andigutmans authored
65 #else
66 # define CLS_D
67 # define CLS_DC
68 # define CLS_C
69 # define CLS_CC
70 # define CG(v) (compiler_globals.v)
71 # define CLS_FETCH()
72 extern ZEND_API zend_compiler_globals compiler_globals;
73 int zendparse();
74 #endif
75
76
77 /* Executor */
78 #ifdef ZTS
79 # define ELS_D zend_executor_globals *executor_globals
80 # define ELS_DC , ELS_D
81 # define ELS_C executor_globals
82 # define ELS_CC , ELS_C
83 # define EG(v) (executor_globals->v)
942f409 @zsuraski * Change the thread safe project to create a C++ scanner.
zsuraski authored
84 # define ELS_FETCH() zend_executor_globals *executor_globals = (zend_executor_globals *) ts_resource(executor_globals_id)
573b460 @andigutmans Zend Library
andigutmans authored
85 #else
86 # define ELS_D
87 # define ELS_DC
88 # define ELS_C
89 # define ELS_CC
90 # define EG(v) (executor_globals.v)
91 # define ELS_FETCH()
92 extern ZEND_API zend_executor_globals executor_globals;
93 #endif
94
95
96 /* Memory Manager */
97 #ifdef ZTS
98 # define ALS_D zend_alloc_globals *alloc_globals
99 # define ALS_DC , ALS_D
100 # define ALS_C alloc_globals
101 # define ALS_CC , ALS_C
102 # define AG(v) (((zend_alloc_globals *) alloc_globals)->v)
942f409 @zsuraski * Change the thread safe project to create a C++ scanner.
zsuraski authored
103 # define ALS_FETCH() zend_alloc_globals *alloc_globals = (zend_alloc_globals *) ts_resource(alloc_globals_id)
573b460 @andigutmans Zend Library
andigutmans authored
104 #else
105 # define ALS_D
106 # define ALS_DC
107 # define ALS_C
108 # define ALS_CC
109 # define AG(v) (alloc_globals.v)
110 # define ALS_FETCH()
111 #endif
112
113
114 #include "zend_compile.h"
115 #include "zend_execute.h"
116
117 struct _zend_compiler_globals {
118 zend_stack bp_stack;
119 zend_stack switch_cond_stack;
120 zend_stack object_stack;
121
122 zend_class_entry class_entry, *active_class_entry;
123
124 /* variables for list() compilation */
125 zend_llist list_llist;
126 zend_llist dimension_llist;
127
128 zend_stack function_call_stack;
129
130 char *compiled_filename;
131
132 int zend_lineno;
133 char *heredoc;
134 int heredoc_len;
135
136 zend_op_array *active_op_array;
137
138 HashTable *function_table; /* function symbol table */
139 HashTable *class_table; /* class table */
140
141 zend_llist filenames_list;
142
143 unsigned char short_tags;
144 unsigned char asp_tags;
145
146 /* For extensions support */
147 unsigned char extended_info; /* generate extension information for debugger/profiler */
148 unsigned char handle_op_arrays; /* run op_arrays through op_array handlers */
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
149
150 #ifdef ZTS
151 #ifdef __cplusplus
152 ZendFlexLexer *ZFL;
153 #else
154 void *ZFL;
155 #endif
156 #endif
573b460 @andigutmans Zend Library
andigutmans authored
157 };
158
159
160 struct _zend_executor_globals {
161 zval *return_value;
162
163 zval uninitialized_zval;
164 zval *uninitialized_zval_ptr;
165
166 zval error_zval;
167 zval *error_zval_ptr;
168
169 zend_function_state *function_state_ptr;
170 zend_ptr_stack arg_types_stack;
171 zend_stack overloaded_objects_stack;
172 zval global_return_value;
173
174 /* symbol table cache */
175 HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
176 HashTable **symtable_cache_limit;
177 HashTable **symtable_cache_ptr;
178
179 zend_op **opline_ptr;
180
181 HashTable *active_symbol_table;
182 HashTable symbol_table; /* main symbol table */
183
184 jmp_buf bailout;
185
186 int error_reporting;
187
188 zend_op_array *active_op_array;
189 zend_op_array *main_op_array;
190
191 HashTable *function_table; /* function symbol table */
192 HashTable *class_table; /* class table */
193 HashTable *zend_constants; /* constants table */
194
195 long precision;
196
197 unsigned int AiCount;
198
199 zend_ptr_stack garbage;
200
201 /* for extended information support */
202 unsigned char no_extensions;
203
204 HashTable regular_list;
205 HashTable persistent_list;
206
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
207 zend_ptr_stack argument_stack;
208
342c6e0 @zsuraski Whatnot:
zsuraski authored
209 void *reserved[4];
573b460 @andigutmans Zend Library
andigutmans authored
210 #if SUPPORT_INTERACTIVE
211 int interactive;
212 #endif
213 };
214
215
216
217 struct _zend_alloc_globals {
218 mem_header *head; /* standard list */
219 mem_header *phead; /* persistent list */
220 void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
221 unsigned char cache_count[MAX_CACHED_MEMORY];
222
2e9886d @zsuraski Get rid of php3_ini in Zend
zsuraski authored
223 #if MEMORY_LIMIT
224 unsigned int memory_limit;
573b460 @andigutmans Zend Library
andigutmans authored
225 unsigned int allocated_memory;
226 unsigned char memory_exhausted;
227 #endif
228 };
229
230
551fe77 @zsuraski Make token names uniform, they all begin with T_ now.
zsuraski authored
231 #endif /* _T_GLOBALS_H */
Something went wrong with that request. Please try again.