Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 321 lines (227 sloc) 7.294 kb
573b460 andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
831fbcf Xinchen Hui Happy New Year
laruence authored
5 | Copyright (c) 1998-2013 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 Zeev Suraski 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 Zeev Suraski 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 Zeev Suraski 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"
6608f07 Stanislav Malyshev Mega-commit: Enter the new object model
smalyshev authored
34 #include "zend_objects.h"
f75f3cf Stanislav Malyshev Generalize object storage and reference bookkeeping
smalyshev authored
35 #include "zend_objects_API.h"
5230321 - Fix Reflection class names
Marcus Boerger authored
36 #include "zend_modules.h"
573b460 andigutmans Zend Library
andigutmans authored
37
c3286f3 implemented again zend-multibyte for PHP 5.3
Rui Hirokawa authored
38 #ifdef ZEND_MULTIBYTE
39 #include "zend_multibyte.h"
40 #endif /* ZEND_MULTIBYTE */
41
7a87fcb Zeev Suraski Thread safety patch. We're still not quite there but it compiles again,...
zsuraski authored
42 /* Define ZTS if you want a thread-safe Zend */
52fcaa4 Zeev Suraski Thread-safe project
zsuraski authored
43 /*#undef ZTS*/
573b460 andigutmans Zend Library
andigutmans authored
44
45 #ifdef ZTS
1aa2c5c Zeev Suraski Ok, call me crazy, because I probably am.
zsuraski authored
46
47 BEGIN_EXTERN_C()
e06a1ed Zeev Suraski Thread safety fixes
zsuraski authored
48 ZEND_API extern int compiler_globals_id;
49 ZEND_API extern int executor_globals_id;
1aa2c5c Zeev Suraski Ok, call me crazy, because I probably am.
zsuraski authored
50 END_EXTERN_C()
51
573b460 andigutmans Zend Library
andigutmans authored
52 #endif
53
54 #define SYMTABLE_CACHE_SIZE 32
55
56
57 #include "zend_compile.h"
58
b510a6d More portability stuff
Sascha Schumann authored
59 /* excpt.h on Digital Unix 4.0 defines function_table */
60 #undef function_table
fafbf6d Zeev Suraski - Implement declare() with declarables framework
zsuraski authored
61
8c885b8 Implemented concept of "delayed early binding" that allows opcode caches...
Dmitry Stogov authored
62 #define ZEND_EARLY_BINDING_COMPILE_TIME 0
63 #define ZEND_EARLY_BINDING_DELAYED 1
64 #define ZEND_EARLY_BINDING_DELAYED_ALL 2
fafbf6d Zeev Suraski - Implement declare() with declarables framework
zsuraski authored
65
66 typedef struct _zend_declarables {
67 zval ticks;
68 } zend_declarables;
69
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored
70 typedef struct _zend_vm_stack *zend_vm_stack;
fafbf6d Zeev Suraski - Implement declare() with declarables framework
zsuraski authored
71
573b460 andigutmans Zend Library
andigutmans authored
72 struct _zend_compiler_globals {
73 zend_stack bp_stack;
74 zend_stack switch_cond_stack;
22f066e andigutmans - Add foreach() freeing code.
andigutmans authored
75 zend_stack foreach_copy_stack;
573b460 andigutmans Zend Library
andigutmans authored
76 zend_stack object_stack;
fafbf6d Zeev Suraski - Implement declare() with declarables framework
zsuraski authored
77 zend_stack declare_stack;
573b460 andigutmans Zend Library
andigutmans authored
78
26578c3 andigutmans - Initial support for nested class definitions
andigutmans authored
79 zend_class_entry *active_class_entry;
573b460 andigutmans Zend Library
andigutmans authored
80
81 /* variables for list() compilation */
82 zend_llist list_llist;
83 zend_llist dimension_llist;
43ebb86 Zeev Suraski Fix bug #10287 - avoid crashing under a bogus usage of list()
zsuraski authored
84 zend_stack list_stack;
573b460 andigutmans Zend Library
andigutmans authored
85
86 zend_stack function_call_stack;
87
88 char *compiled_filename;
89
90 int zend_lineno;
6f20cea Fixes to heredoc and cleanup of new re2c scanner. (Patch by Matt Wilmas)
Scott MacVicar authored
91
573b460 andigutmans Zend Library
andigutmans authored
92 char *heredoc;
93 int heredoc_len;
94
95 zend_op_array *active_op_array;
96
97 HashTable *function_table; /* function symbol table */
98 HashTable *class_table; /* class table */
99
c34f41b Zeev Suraski Eliminate run-time leak with eval()'s
zsuraski authored
100 HashTable filenames_table;
573b460 andigutmans Zend Library
andigutmans authored
101
9d11db1 andigutmans - Merge new $_GET, $_POST etc. patch from Engine 1 tree
andigutmans authored
102 HashTable *auto_globals;
103
b6197bc Zeev Suraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
104 zend_bool in_compilation;
9ece796 Zeev Suraski define zend_bool
zsuraski authored
105 zend_bool short_tags;
106 zend_bool asp_tags;
ced9cee Zeev Suraski - Implement return by reference:
zsuraski authored
107 zend_bool allow_call_time_pass_reference;
573b460 andigutmans Zend Library
andigutmans authored
108
fafbf6d Zeev Suraski - Implement declare() with declarables framework
zsuraski authored
109 zend_declarables declarables;
110
9ece796 Zeev Suraski define zend_bool
zsuraski authored
111 zend_bool unclean_shutdown;
87ba08d Zeev Suraski Avoid leaking fd's in case of failures
zsuraski authored
112
9596255 Zeev Suraski Final touches on the INI parser
zsuraski authored
113 zend_bool ini_parser_unbuffered_errors;
114
87ba08d Zeev Suraski Avoid leaking fd's in case of failures
zsuraski authored
115 zend_llist open_files;
85b4df5 Zeev Suraski Improved interactive mode - it is now available in all builds, without a...
zsuraski authored
116
f1e8815 andigutmans - Change exception handling to use the Java-like catch(MyException $exce...
andigutmans authored
117 long catch_begin;
29f5dbe andigutmans - Initial support for exceptions.
andigutmans authored
118
609d58a Zeev Suraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
119 struct _zend_ini_parser_param *ini_parser_param;
120
85b4df5 Zeev Suraski Improved interactive mode - it is now available in all builds, without a...
zsuraski authored
121 int interactive;
7ade3b3 Zeev Suraski Fix an off by one lineno issue, in case of an implicit ;
zsuraski authored
122
cf05f34 Zeev Suraski MFZE1 - lineno fix
zsuraski authored
123 zend_uint start_lineno;
7ade3b3 Zeev Suraski Fix an off by one lineno issue, in case of an implicit ;
zsuraski authored
124 zend_bool increment_lineno;
b90d80b andigutmans - Initial patch to support importing from class scopes (for Stig).
andigutmans authored
125
26dd849 Zeev Suraski Add support for interfaces
zsuraski authored
126 znode implementing_class;
e062dff Zeev Suraski - Implement public/protected/private methods.
zsuraski authored
127
471947b Zeev Suraski Reimplement PPP properties
zsuraski authored
128 zend_uint access_type;
bdd3b60 Implement a different way to catch documentation comments.
Andrei Zmievski authored
129
130 char *doc_comment;
131 zend_uint doc_comment_len;
ab9dcec Masaki Fujimoto - added script encoding support to Zend Engine 2.
fujimoto authored
132
8c885b8 Implemented concept of "delayed early binding" that allows opcode caches...
Dmitry Stogov authored
133 zend_uint compiler_options; /* set of ZEND_COMPILE_* constants */
134
f32ffe9 Namespaces
Dmitry Stogov authored
135 zval *current_namespace;
136 HashTable *current_import;
ea45b71 Added support for namespaces with brackets. (Greg)
Dmitry Stogov authored
137 zend_bool in_namespace;
138 zend_bool has_bracketed_namespaces;
f32ffe9 Namespaces
Dmitry Stogov authored
139
f66f55e Felipe Pena MFH: Implemented "jump label" operator (limited "goto")
felipensp authored
140 HashTable *labels;
141 zend_stack labels_stack;
142
c3286f3 implemented again zend-multibyte for PHP 5.3
Rui Hirokawa authored
143 #ifdef ZEND_MULTIBYTE
144 zend_encoding **script_encoding_list;
4f42ed3 - Revived zend multibyte
Moriyoshi Koizumi authored
145 size_t script_encoding_list_size;
c3286f3 implemented again zend-multibyte for PHP 5.3
Rui Hirokawa authored
146 zend_bool detect_unicode;
4f42ed3 - Revived zend multibyte
Moriyoshi Koizumi authored
147 zend_bool encoding_declared;
c3286f3 implemented again zend-multibyte for PHP 5.3
Rui Hirokawa authored
148
149 zend_encoding *internal_encoding;
150
151 /* multibyte utility functions */
152 zend_encoding_detector encoding_detector;
153 zend_encoding_converter encoding_converter;
154 zend_encoding_oddlen encoding_oddlen;
155 #endif /* ZEND_MULTIBYTE */
156
8768ab9 Fixed bug #34729 (Crash in ZTS mode under Apache)
Dmitry Stogov authored
157 #ifdef ZTS
158 HashTable **static_members;
159 int last_static_member;
160 #endif
573b460 andigutmans Zend Library
andigutmans authored
161 };
162
163
164 struct _zend_executor_globals {
ced9cee Zeev Suraski - Implement return by reference:
zsuraski authored
165 zval **return_value_ptr_ptr;
573b460 andigutmans Zend Library
andigutmans authored
166
167 zval uninitialized_zval;
168 zval *uninitialized_zval_ptr;
169
170 zval error_zval;
171 zval *error_zval_ptr;
172
173 zend_ptr_stack arg_types_stack;
223c674 Zeev Suraski - Made things work again (Thies, everybody - please check the latest CVS...
zsuraski authored
174
573b460 andigutmans Zend Library
andigutmans authored
175 /* symbol table cache */
176 HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
177 HashTable **symtable_cache_limit;
178 HashTable **symtable_cache_ptr;
179
180 zend_op **opline_ptr;
181
182 HashTable *active_symbol_table;
183 HashTable symbol_table; /* main symbol table */
184
5951b16 andigutmans - Quick way of supporting include_once().
andigutmans authored
185 HashTable included_files; /* files already included */
5463dd5 andigutmans - Add use support (behaves like require, but will not use the same file ...
andigutmans authored
186
10afe5d Rasmus Lerdorf Make the sigsetjmp change more robust. On systems that don't have
rlerdorf authored
187 JMP_BUF *bailout;
573b460 andigutmans Zend Library
andigutmans authored
188
189 int error_reporting;
fde2e61 Zeev Suraski error_reporting fix
zsuraski authored
190 int orig_error_reporting;
2ef6b68 Pass on the exit status
Sascha Schumann authored
191 int exit_status;
573b460 andigutmans Zend Library
andigutmans authored
192
193 zend_op_array *active_op_array;
194
195 HashTable *function_table; /* function symbol table */
196 HashTable *class_table; /* class table */
197 HashTable *zend_constants; /* constants table */
198
90bd453 andigutmans - Remove use of C++ reserved words namespace/this
andigutmans authored
199 zend_class_entry *scope;
166266d Added support for Late Static Binding. (Dmitry, Etienne Kneuss)
Dmitry Stogov authored
200 zend_class_entry *called_scope; /* Scope of the calling class */
4248619 andigutmans - Initial work on changing namespace scope. Only methods & variables
andigutmans authored
201
90bd453 andigutmans - Remove use of C++ reserved words namespace/this
andigutmans authored
202 zval *This;
a4248dd andigutmans - Significantly improve the performance of method calls and $this->membe...
andigutmans authored
203
573b460 andigutmans Zend Library
andigutmans authored
204 long precision;
205
fafbf6d Zeev Suraski - Implement declare() with declarables framework
zsuraski authored
206 int ticks_count;
207
b6197bc Zeev Suraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
208 zend_bool in_execution;
55cf45a New autoload protection schema was implemented (Using HashTable instead ...
Dmitry Stogov authored
209 HashTable *in_autoload;
b7a8297 - Boost up __autoload() calls by caching the lookup
Marcus Boerger authored
210 zend_function *autoload_func;
aecd5b8 Zeev Suraski MFZE1
zsuraski authored
211 zend_bool full_tables_cleanup;
b6197bc Zeev Suraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
212
573b460 andigutmans Zend Library
andigutmans authored
213 /* for extended information support */
741ca16 andigutmans - Fixed various inheritance problems & Andrey's leak
andigutmans authored
214 zend_bool no_extensions;
573b460 andigutmans Zend Library
andigutmans authored
215
84eb48f Zeev Suraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
216 #ifdef ZEND_WIN32
217 zend_bool timed_out;
f704a50 pierrejoye - add EG(windows_version_info), set at init time once per instance
pierrejoye authored
218 OSVERSIONINFOEX windows_version_info;
84eb48f Zeev Suraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
219 #endif
220
573b460 andigutmans Zend Library
andigutmans authored
221 HashTable regular_list;
222 HashTable persistent_list;
223
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored
224 zend_vm_stack argument_stack;
1c0f136 andigutmans - Hooray. This might actually work. (I hope)
andigutmans authored
225
a72c1ab Zeev Suraski Added error mask to set_error_handler()
zsuraski authored
226 int user_error_handler_error_reporting;
67f6974 Zeev Suraski Initial support for trapping errors (not complete and disabled; will be...
zsuraski authored
227 zval *user_error_handler;
04788f9 @- Added set_exception_handler() function for registering a global,
Stig Bakken authored
228 zval *user_exception_handler;
a72c1ab Zeev Suraski Added error mask to set_error_handler()
zsuraski authored
229 zend_stack user_error_handlers_error_reporting;
34c2b0a Zeev Suraski - Add restore_error_handler()
zsuraski authored
230 zend_ptr_stack user_error_handlers;
04788f9 @- Added set_exception_handler() function for registering a global,
Stig Bakken authored
231 zend_ptr_stack user_exception_handlers;
67f6974 Zeev Suraski Initial support for trapping errors (not complete and disabled; will be...
zsuraski authored
232
fd0d44f Felipe Pena User error handlers no longer catch supressed errors (patch by Etienne K...
felipensp authored
233 zend_error_handling_t error_handling;
234 zend_class_entry *exception_class;
235
ef0bd3d Zeev Suraski - Move timeout code to Zend
zsuraski authored
236 /* timeout support */
237 int timeout_seconds;
238
0b7a9ce Zeev Suraski - Fix Win32 compilation (Use winsock2.h from now on)
zsuraski authored
239 int lambda_count;
240
8831b9c andigutmans - MFZE1.
andigutmans authored
241 HashTable *ini_directives;
14cad8f Optimized shutdown sequence to iterate only over modified ini directives
Dmitry Stogov authored
242 HashTable *modified_ini_directives;
243
f75f3cf Stanislav Malyshev Generalize object storage and reference bookkeeping
smalyshev authored
244 zend_objects_store objects_store;
32f9d0e - MFH Improve exception linking
Marcus Boerger authored
245 zval *exception, *prev_exception;
9e60cb5 Zeev Suraski Rewrote exception support. Fixes a few limitations and bugs in the old
zsuraski authored
246 zend_op *opline_before_exception;
fa47e90 Changed exception handling. Now each op_array doesn't contain ZEND_HANDL...
Dmitry Stogov authored
247 zend_op exception_op[3];
54d5305 Zeev Suraski Make the INI mechanism thread safe (or at least thread safer :)
zsuraski authored
248
7e5ec2d andigutmans Initial support for built-in backtracing.
andigutmans authored
249 struct _zend_execute_data *current_execute_data;
250
5230321 - Fix Reflection class names
Marcus Boerger authored
251 struct _zend_module_entry *current_module;
9e60cb5 Zeev Suraski Rewrote exception support. Fixes a few limitations and bugs in the old
zsuraski authored
252
fce275e Zeev Suraski Improve PPP handling of properties
zsuraski authored
253 zend_property_info std_property_info;
254
d6ee9d4 Antony Dovgal MFH: fix #38779 (engine crashes when require()'ing file with syntax erro...
tony2001 authored
255 zend_bool active;
256
31c0af2 Fixed floating point mathematic speed degradation (Christian)
Dmitry Stogov authored
257 void *saved_fpu_cw;
258
b5f5e9a andigutmans - Optimize the execute stack a bit.
andigutmans authored
259 void *reserved[ZEND_MAX_RESERVED_RESOURCES];
573b460 andigutmans Zend Library
andigutmans authored
260 };
261
af31602 - Rewrite scanner to be based on re2c instead of flex
Marcus Boerger authored
262 struct _zend_ini_scanner_globals {
e52aac9 Wez Furlong Implement simple stream support in the ZE scanners.
wez authored
263 zend_file_handle *yy_in;
264 zend_file_handle *yy_out;
af31602 - Rewrite scanner to be based on re2c instead of flex
Marcus Boerger authored
265
4f42ed3 - Revived zend multibyte
Moriyoshi Koizumi authored
266 unsigned int yy_leng;
267 unsigned char *yy_start;
268 unsigned char *yy_text;
269 unsigned char *yy_cursor;
270 unsigned char *yy_marker;
271 unsigned char *yy_limit;
272 int yy_state;
273 zend_stack state_stack;
af31602 - Rewrite scanner to be based on re2c instead of flex
Marcus Boerger authored
274
275 char *filename;
fac8eaf MFZE1
Ilia Alshanetsky authored
276 int lineno;
af31602 - Rewrite scanner to be based on re2c instead of flex
Marcus Boerger authored
277
278 /* Modes are: ZEND_INI_SCANNER_NORMAL, ZEND_INI_SCANNER_RAW */
09b6f37 MFH:
Jani Taskinen authored
279 int scanner_mode;
af31602 - Rewrite scanner to be based on re2c instead of flex
Marcus Boerger authored
280 };
281
282 struct _zend_php_scanner_globals {
283 zend_file_handle *yy_in;
284 zend_file_handle *yy_out;
09b6f37 MFH:
Jani Taskinen authored
285
af31602 - Rewrite scanner to be based on re2c instead of flex
Marcus Boerger authored
286 unsigned int yy_leng;
287 unsigned char *yy_start;
288 unsigned char *yy_text;
289 unsigned char *yy_cursor;
290 unsigned char *yy_marker;
291 unsigned char *yy_limit;
292 int yy_state;
293 zend_stack state_stack;
294
c3286f3 implemented again zend-multibyte for PHP 5.3
Rui Hirokawa authored
295 #ifdef ZEND_MULTIBYTE
296 /* original (unfiltered) script */
4f42ed3 - Revived zend multibyte
Moriyoshi Koizumi authored
297 unsigned char *script_org;
298 size_t script_org_size;
c3286f3 implemented again zend-multibyte for PHP 5.3
Rui Hirokawa authored
299
300 /* filtered script */
4f42ed3 - Revived zend multibyte
Moriyoshi Koizumi authored
301 unsigned char *script_filtered;
302 size_t script_filtered_size;
c3286f3 implemented again zend-multibyte for PHP 5.3
Rui Hirokawa authored
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 Zeev Suraski 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.