Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 321 lines (234 sloc) 7.441 kb
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
ccfc46b - Happy new year and PHP 5 for rest of the files too..
foobar authored
5 | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
573b460 @andigutmans Zend Library
andigutmans authored
6 +----------------------------------------------------------------------+
d863d52 Update headers.
Sebastian Bergmann authored
7 | This source file is subject to version 2.00 of the Zend license, |
b5b1117 @zsuraski License update
zsuraski authored
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
9 | available through the world-wide-web at the following url: |
d863d52 Update headers.
Sebastian Bergmann authored
10 | http://www.zend.com/license/2_00.txt. |
b5b1117 @zsuraski License update
zsuraski authored
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
573b460 @andigutmans Zend Library
andigutmans authored
14 +----------------------------------------------------------------------+
15 | Authors: Andi Gutmans <andi@zend.com> |
16 | Zeev Suraski <zeev@zend.com> |
17 +----------------------------------------------------------------------+
18 */
19
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
20 /* $Id$ */
b5b1117 @zsuraski License update
zsuraski authored
21
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
22 #ifndef ZEND_GLOBALS_H
23 #define ZEND_GLOBALS_H
573b460 @andigutmans Zend Library
andigutmans authored
24
99947a2 @andigutmans - Shift around header files.
andigutmans authored
25
573b460 @andigutmans Zend Library
andigutmans authored
26 #include <setjmp.h>
27
99947a2 @andigutmans - Shift around header files.
andigutmans authored
28 #include "zend_globals_macros.h"
29
573b460 @andigutmans Zend Library
andigutmans authored
30 #include "zend_stack.h"
31 #include "zend_ptr_stack.h"
32 #include "zend_hash.h"
33 #include "zend_llist.h"
b7a5b3c @zsuraski - Generalize the fast cache mechanism
zsuraski authored
34 #include "zend_fast_cache.h"
6608f07 @smalyshev Mega-commit: Enter the new object model
smalyshev authored
35 #include "zend_objects.h"
f75f3cf @smalyshev Generalize object storage and reference bookkeeping
smalyshev authored
36 #include "zend_objects_API.h"
573b460 @andigutmans Zend Library
andigutmans authored
37
ab9dcec @fujimoto - added script encoding support to Zend Engine 2.
fujimoto authored
38 #ifdef ZEND_MULTIBYTE
39 #include "zend_multibyte.h"
40 #endif /* ZEND_MULTIBYTE */
41
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles aga…
zsuraski authored
42 /* Define ZTS if you want a thread-safe Zend */
52fcaa4 @zsuraski Thread-safe project
zsuraski authored
43 /*#undef ZTS*/
573b460 @andigutmans Zend Library
andigutmans authored
44
45 #ifdef ZTS
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
46
47 BEGIN_EXTERN_C()
e06a1ed @zsuraski Thread safety fixes
zsuraski authored
48 ZEND_API extern int compiler_globals_id;
49 ZEND_API extern int executor_globals_id;
5864b57 @zsuraski This should enable people to use ALLOC_ZVAL() in code outside the php…
zsuraski authored
50 ZEND_API extern int alloc_globals_id;
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
51 END_EXTERN_C()
52
573b460 @andigutmans Zend Library
andigutmans authored
53 #endif
54
55 #define SYMTABLE_CACHE_SIZE 32
56
57
58 #include "zend_compile.h"
59
b510a6d More portability stuff
Sascha Schumann authored
60 /* excpt.h on Digital Unix 4.0 defines function_table */
61 #undef function_table
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
62
63
64 typedef struct _zend_declarables {
65 zval ticks;
66 } zend_declarables;
67
68
573b460 @andigutmans Zend Library
andigutmans authored
69 struct _zend_compiler_globals {
70 zend_stack bp_stack;
71 zend_stack switch_cond_stack;
22f066e @andigutmans - Add foreach() freeing code.
andigutmans authored
72 zend_stack foreach_copy_stack;
573b460 @andigutmans Zend Library
andigutmans authored
73 zend_stack object_stack;
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
74 zend_stack declare_stack;
573b460 @andigutmans Zend Library
andigutmans authored
75
26578c3 @andigutmans - Initial support for nested class definitions
andigutmans authored
76 zend_class_entry *active_class_entry;
573b460 @andigutmans Zend Library
andigutmans authored
77
78 /* variables for list() compilation */
79 zend_llist list_llist;
80 zend_llist dimension_llist;
43ebb86 @zsuraski Fix bug #10287 - avoid crashing under a bogus usage of list()
zsuraski authored
81 zend_stack list_stack;
573b460 @andigutmans Zend Library
andigutmans authored
82
83 zend_stack function_call_stack;
84
85 char *compiled_filename;
86
87 int zend_lineno;
86a0efc @zsuraski Fix #2744
zsuraski authored
88 int comment_start_line;
573b460 @andigutmans Zend Library
andigutmans authored
89 char *heredoc;
90 int heredoc_len;
91
92 zend_op_array *active_op_array;
93
94 HashTable *function_table; /* function symbol table */
95 HashTable *class_table; /* class table */
96
c34f41b @zsuraski Eliminate run-time leak with eval()'s
zsuraski authored
97 HashTable filenames_table;
573b460 @andigutmans Zend Library
andigutmans authored
98
9d11db1 @andigutmans - Merge new $_GET, $_POST etc. patch from Engine 1 tree
andigutmans authored
99 HashTable *auto_globals;
100
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
101 zend_bool in_compilation;
9ece796 @zsuraski define zend_bool
zsuraski authored
102 zend_bool short_tags;
103 zend_bool asp_tags;
ced9cee @zsuraski - Implement return by reference:
zsuraski authored
104 zend_bool allow_call_time_pass_reference;
573b460 @andigutmans Zend Library
andigutmans authored
105
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
106 zend_declarables declarables;
107
573b460 @andigutmans Zend Library
andigutmans authored
108 /* For extensions support */
9ece796 @zsuraski define zend_bool
zsuraski authored
109 zend_bool extended_info; /* generate extension information for debugger/profiler */
110 zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
111
9ece796 @zsuraski define zend_bool
zsuraski authored
112 zend_bool unclean_shutdown;
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
113
9596255 @zsuraski Final touches on the INI parser
zsuraski authored
114 zend_bool ini_parser_unbuffered_errors;
115
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
116 zend_llist open_files;
85b4df5 @zsuraski Improved interactive mode - it is now available in all builds, withou…
zsuraski authored
117
f1e8815 @andigutmans - Change exception handling to use the Java-like catch(MyException $e…
andigutmans authored
118 long catch_begin;
29f5dbe @andigutmans - Initial support for exceptions.
andigutmans authored
119
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
120 struct _zend_ini_parser_param *ini_parser_param;
121
85b4df5 @zsuraski Improved interactive mode - it is now available in all builds, withou…
zsuraski authored
122 int interactive;
7ade3b3 @zsuraski Fix an off by one lineno issue, in case of an implicit ;
zsuraski authored
123
cf05f34 @zsuraski MFZE1 - lineno fix
zsuraski authored
124 zend_uint start_lineno;
7ade3b3 @zsuraski Fix an off by one lineno issue, in case of an implicit ;
zsuraski authored
125 zend_bool increment_lineno;
b90d80b @andigutmans - Initial patch to support importing from class scopes (for Stig).
andigutmans authored
126
26dd849 @zsuraski Add support for interfaces
zsuraski authored
127 znode implementing_class;
e062dff @zsuraski - Implement public/protected/private methods.
zsuraski authored
128
471947b @zsuraski Reimplement PPP properties
zsuraski authored
129 zend_uint access_type;
bdd3b60 Implement a different way to catch documentation comments.
Andrei Zmievski authored
130
131 char *doc_comment;
132 zend_uint doc_comment_len;
ab9dcec @fujimoto - added script encoding support to Zend Engine 2.
fujimoto authored
133
134 #ifdef ZEND_MULTIBYTE
135 zend_encoding **script_encoding_list;
136 int script_encoding_list_size;
137
138 zend_encoding *internal_encoding;
139
140 /* multibyte utility functions */
141 zend_encoding_detector encoding_detector;
142 zend_encoding_converter encoding_converter;
143 zend_encoding_oddlen encoding_oddlen;
144 #endif /* ZEND_MULTIBYTE */
573b460 @andigutmans Zend Library
andigutmans authored
145 };
146
147
148 struct _zend_executor_globals {
ced9cee @zsuraski - Implement return by reference:
zsuraski authored
149 zval **return_value_ptr_ptr;
573b460 @andigutmans Zend Library
andigutmans authored
150
151 zval uninitialized_zval;
152 zval *uninitialized_zval_ptr;
153
154 zval error_zval;
155 zval *error_zval_ptr;
156
157 zend_function_state *function_state_ptr;
158 zend_ptr_stack arg_types_stack;
223c674 @zsuraski - Made things work again (Thies, everybody - please check the latest …
zsuraski authored
159
573b460 @andigutmans Zend Library
andigutmans authored
160 /* symbol table cache */
161 HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
162 HashTable **symtable_cache_limit;
163 HashTable **symtable_cache_ptr;
164
165 zend_op **opline_ptr;
166
167 HashTable *active_symbol_table;
168 HashTable symbol_table; /* main symbol table */
169
5951b16 @andigutmans - Quick way of supporting include_once().
andigutmans authored
170 HashTable included_files; /* files already included */
5463dd5 @andigutmans - Add use support (behaves like require, but will not use the same fi…
andigutmans authored
171
573b460 @andigutmans Zend Library
andigutmans authored
172 jmp_buf bailout;
173
174 int error_reporting;
fde2e61 @zsuraski error_reporting fix
zsuraski authored
175 int orig_error_reporting;
2ef6b68 Pass on the exit status
Sascha Schumann authored
176 int exit_status;
573b460 @andigutmans Zend Library
andigutmans authored
177
178 zend_op_array *active_op_array;
179
180 HashTable *function_table; /* function symbol table */
181 HashTable *class_table; /* class table */
182 HashTable *zend_constants; /* constants table */
183
90bd453 @andigutmans - Remove use of C++ reserved words namespace/this
andigutmans authored
184 zend_class_entry *scope;
4248619 @andigutmans - Initial work on changing namespace scope. Only methods & variables
andigutmans authored
185
90bd453 @andigutmans - Remove use of C++ reserved words namespace/this
andigutmans authored
186 zval *This;
a4248dd @andigutmans - Significantly improve the performance of method calls and $this->me…
andigutmans authored
187
573b460 @andigutmans Zend Library
andigutmans authored
188 long precision;
189
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
190 int ticks_count;
191
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
192 zend_bool in_execution;
55cf45a New autoload protection schema was implemented (Using HashTable inste…
Dmitry Stogov authored
193 HashTable *in_autoload;
931ebe0 @zsuraski Improve bailout mechanism, supports nesting of bailouts a-la try..catch
zsuraski authored
194 zend_bool bailout_set;
aecd5b8 @zsuraski MFZE1
zsuraski authored
195 zend_bool full_tables_cleanup;
eb6fd52 @zsuraski - Rename compatiblity mode to zend.ze2_compatibility_mode (it doesn't…
zsuraski authored
196 zend_bool ze1_compatibility_mode;
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
197
573b460 @andigutmans Zend Library
andigutmans authored
198 /* for extended information support */
741ca16 @andigutmans - Fixed various inheritance problems & Andrey's leak
andigutmans authored
199 zend_bool no_extensions;
573b460 @andigutmans Zend Library
andigutmans authored
200
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
201 #ifdef ZEND_WIN32
202 zend_bool timed_out;
203 #endif
204
573b460 @andigutmans Zend Library
andigutmans authored
205 HashTable regular_list;
206 HashTable persistent_list;
207
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
208 zend_ptr_stack argument_stack;
d12679a @andigutmans - Improve overall engine performance
andigutmans authored
209 zval *free_op1, *free_op2;
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
210 int (*unary_op)(zval *result, zval *op1);
8ce8324 @zsuraski More TSRMLS_FETCH annihilation
zsuraski authored
211 int (*binary_op)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
212
5bf89ce @andigutmans - Hopefully fix bug #11476 and improve garbage to be freed very quickly.
andigutmans authored
213 zval *garbage[2];
1c0f136 @andigutmans - Hooray. This might actually work. (I hope)
andigutmans authored
214 int garbage_ptr;
215
a72c1ab @zsuraski Added error mask to set_error_handler()
zsuraski authored
216 int user_error_handler_error_reporting;
67f6974 @zsuraski Initial support for trapping errors (not complete and disabled; will…
zsuraski authored
217 zval *user_error_handler;
04788f9 @- Added set_exception_handler() function for registering a global,
Stig Bakken authored
218 zval *user_exception_handler;
a72c1ab @zsuraski Added error mask to set_error_handler()
zsuraski authored
219 zend_stack user_error_handlers_error_reporting;
34c2b0a @zsuraski - Add restore_error_handler()
zsuraski authored
220 zend_ptr_stack user_error_handlers;
04788f9 @- Added set_exception_handler() function for registering a global,
Stig Bakken authored
221 zend_ptr_stack user_exception_handlers;
67f6974 @zsuraski Initial support for trapping errors (not complete and disabled; will…
zsuraski authored
222
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
223 /* timeout support */
224 int timeout_seconds;
225
0b7a9ce @zsuraski - Fix Win32 compilation (Use winsock2.h from now on)
zsuraski authored
226 int lambda_count;
227
8831b9c @andigutmans - MFZE1.
andigutmans authored
228 HashTable *ini_directives;
f75f3cf @smalyshev Generalize object storage and reference bookkeeping
smalyshev authored
229 zend_objects_store objects_store;
29f5dbe @andigutmans - Initial support for exceptions.
andigutmans authored
230 zval *exception;
9e60cb5 @zsuraski Rewrote exception support. Fixes a few limitations and bugs in the old
zsuraski authored
231 zend_op *opline_before_exception;
54d5305 @zsuraski Make the INI mechanism thread safe (or at least thread safer :)
zsuraski authored
232
7e5ec2d @andigutmans Initial support for built-in backtracing.
andigutmans authored
233 struct _zend_execute_data *current_execute_data;
234
9e60cb5 @zsuraski Rewrote exception support. Fixes a few limitations and bugs in the old
zsuraski authored
235
fce275e @zsuraski Improve PPP handling of properties
zsuraski authored
236 zend_property_info std_property_info;
237
e842ef9 MFZE1 (floats & locale issue)
Ilia Alshanetsky authored
238 /* locale stuff */
239 char float_separator[1];
240
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
241 void *reserved[ZEND_MAX_RESERVED_RESOURCES];
573b460 @andigutmans Zend Library
andigutmans authored
242 };
243
380c082 @andigutmans - Commit an initial version of a home made memory manager.
andigutmans authored
244 #include "zend_mm.h"
573b460 @andigutmans Zend Library
andigutmans authored
245
246 struct _zend_alloc_globals {
c517633 @zsuraski namespace protection
zsuraski authored
247 zend_mem_header *head; /* standard list */
573b460 @andigutmans Zend Library
andigutmans authored
248 void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
7f87a31 @smalyshev Make cache counters to be unsigned int
smalyshev authored
249 unsigned int cache_count[MAX_CACHED_MEMORY];
b7a5b3c @zsuraski - Generalize the fast cache mechanism
zsuraski authored
250 void *fast_cache_list_head[MAX_FAST_CACHE_TYPES];
573b460 @andigutmans Zend Library
andigutmans authored
251
66d9314 @zsuraski Implement fast memory allocation and reduced fragmentation under Wind…
zsuraski authored
252 #ifdef ZEND_WIN32
253 HANDLE memory_heap;
254 #endif
255
ebd4445 @zsuraski Add cache statistics support
zsuraski authored
256 #if ZEND_DEBUG
257 /* for performance tuning */
258 int cache_stats[MAX_CACHED_MEMORY][2];
b7a5b3c @zsuraski - Generalize the fast cache mechanism
zsuraski authored
259 int fast_cache_stats[MAX_FAST_CACHE_TYPES][2];
ebd4445 @zsuraski Add cache statistics support
zsuraski authored
260 #endif
2e9886d @zsuraski Get rid of php3_ini in Zend
zsuraski authored
261 #if MEMORY_LIMIT
262 unsigned int memory_limit;
573b460 @andigutmans Zend Library
andigutmans authored
263 unsigned int allocated_memory;
4c0d85b @zsuraski Commit missing fix
zsuraski authored
264 unsigned int allocated_memory_peak;
573b460 @andigutmans Zend Library
andigutmans authored
265 unsigned char memory_exhausted;
266 #endif
9e35171 @andigutmans - This was also supposed to be part of the previous ZEND_MM commit :)
andigutmans authored
267 #ifdef ZEND_MM
380c082 @andigutmans - Commit an initial version of a home made memory manager.
andigutmans authored
268 zend_mm_heap mm_heap;
269 #endif
573b460 @andigutmans Zend Library
andigutmans authored
270 };
271
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
272 struct _zend_scanner_globals {
e52aac9 @wez Implement simple stream support in the ZE scanners.
wez authored
273 zend_file_handle *yy_in;
274 zend_file_handle *yy_out;
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
275 int yy_leng;
276 char *yy_text;
277 struct yy_buffer_state *current_buffer;
278 char *c_buf_p;
279 int init;
280 int start;
fac8eaf MFZE1
Ilia Alshanetsky authored
281 int lineno;
1735281 @zsuraski MFZE1
zsuraski authored
282 char _yy_hold_char;
283 int yy_n_chars;
284 int _yy_did_buffer_switch_on_eof;
e42ab2c @zsuraski MFZE1
zsuraski authored
285 int _yy_last_accepting_state; /* Must be of the same type as yy_state_type,
286 * if for whatever reason it's no longer int!
287 */
1735281 @zsuraski MFZE1
zsuraski authored
288 char *_yy_last_accepting_cpos;
289 int _yy_more_flag;
290 int _yy_more_len;
0bb780b @zsuraski MFZE1
zsuraski authored
291 int yy_start_stack_ptr;
292 int yy_start_stack_depth;
293 int *yy_start_stack;
ab9dcec @fujimoto - added script encoding support to Zend Engine 2.
fujimoto authored
294
295 #ifdef ZEND_MULTIBYTE
296 /* original (unfiltered) script */
297 char *script_org;
298 int script_org_size;
299
300 /* filtered script */
301 char *script_filtered;
302 int script_filtered_size;
303
304 /* input/ouput filters */
305 zend_encoding_filter input_filter;
306 zend_encoding_filter output_filter;
307 zend_encoding *script_encoding;
308 zend_encoding *internal_encoding;
309 #endif /* ZEND_MULTIBYTE */
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
310 };
311
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
312 #endif /* ZEND_GLOBALS_H */
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
313
314 /*
315 * Local variables:
316 * tab-width: 4
317 * c-basic-offset: 4
318 * indent-tabs-mode: t
319 * End:
320 */
Something went wrong with that request. Please try again.