Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 257 lines (183 sloc) 6.07 kB
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
62dc854 Happy New Year.
Sebastian Bergmann authored
5 | Copyright (c) 1998-2002 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 |
9 | available at through the world-wide-web at |
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
b5b1117 @zsuraski License update
zsuraski authored
20
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
21 #ifndef ZEND_GLOBALS_H
22 #define ZEND_GLOBALS_H
573b460 @andigutmans Zend Library
andigutmans authored
23
99947a2 @andigutmans - Shift around header files.
andigutmans authored
24
573b460 @andigutmans Zend Library
andigutmans authored
25 #include <setjmp.h>
26
99947a2 @andigutmans - Shift around header files.
andigutmans authored
27 #include "zend_globals_macros.h"
28
573b460 @andigutmans Zend Library
andigutmans authored
29 #include "zend_stack.h"
30 #include "zend_ptr_stack.h"
31 #include "zend_hash.h"
32 #include "zend_llist.h"
b7a5b3c @zsuraski - Generalize the fast cache mechanism
zsuraski authored
33 #include "zend_fast_cache.h"
6608f07 @smalyshev Mega-commit: Enter the new object model
smalyshev authored
34 #include "zend_objects.h"
573b460 @andigutmans Zend Library
andigutmans authored
35
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles aga…
zsuraski authored
36 /* Define ZTS if you want a thread-safe Zend */
52fcaa4 @zsuraski Thread-safe project
zsuraski authored
37 /*#undef ZTS*/
573b460 @andigutmans Zend Library
andigutmans authored
38
39 #ifdef ZTS
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
40
41 BEGIN_EXTERN_C()
e06a1ed @zsuraski Thread safety fixes
zsuraski authored
42 ZEND_API extern int compiler_globals_id;
43 ZEND_API extern int executor_globals_id;
5864b57 @zsuraski This should enable people to use ALLOC_ZVAL() in code outside the php…
zsuraski authored
44 ZEND_API extern int alloc_globals_id;
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
45 END_EXTERN_C()
46
573b460 @andigutmans Zend Library
andigutmans authored
47 #endif
48
49 #define SYMTABLE_CACHE_SIZE 32
50
51
52 #include "zend_compile.h"
53
b510a6d More portability stuff
Sascha Schumann authored
54 /* excpt.h on Digital Unix 4.0 defines function_table */
55 #undef function_table
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
56
57
58 typedef struct _zend_declarables {
59 zval ticks;
60 } zend_declarables;
61
62
573b460 @andigutmans Zend Library
andigutmans authored
63 struct _zend_compiler_globals {
64 zend_stack bp_stack;
65 zend_stack switch_cond_stack;
22f066e @andigutmans - Add foreach() freeing code.
andigutmans authored
66 zend_stack foreach_copy_stack;
573b460 @andigutmans Zend Library
andigutmans authored
67 zend_stack object_stack;
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
68 zend_stack declare_stack;
573b460 @andigutmans Zend Library
andigutmans authored
69
26578c3 @andigutmans - Initial support for nested class definitions
andigutmans authored
70 zend_class_entry *active_class_entry;
cb0d277 @zsuraski parent::methodname() now works better with runtime classes (fix bug #…
zsuraski authored
71 zval active_ce_parent_class_name;
573b460 @andigutmans Zend Library
andigutmans authored
72
73 /* variables for list() compilation */
74 zend_llist list_llist;
75 zend_llist dimension_llist;
43ebb86 @zsuraski Fix bug #10287 - avoid crashing under a bogus usage of list()
zsuraski authored
76 zend_stack list_stack;
573b460 @andigutmans Zend Library
andigutmans authored
77
78 zend_stack function_call_stack;
79
80 char *compiled_filename;
81
82 int zend_lineno;
86a0efc @zsuraski Fix #2744
zsuraski authored
83 int comment_start_line;
573b460 @andigutmans Zend Library
andigutmans authored
84 char *heredoc;
85 int heredoc_len;
86
87 zend_op_array *active_op_array;
88
ce98c73 @andigutmans - Infrastructure changes for allowing to access the global scope from
andigutmans authored
89 zend_class_entry main_class;
573b460 @andigutmans Zend Library
andigutmans authored
90 HashTable *function_table; /* function symbol table */
91 HashTable *class_table; /* class table */
92
c34f41b @zsuraski Eliminate run-time leak with eval()'s
zsuraski authored
93 HashTable filenames_table;
573b460 @andigutmans Zend Library
andigutmans authored
94
9d11db1 @andigutmans - Merge new $_GET, $_POST etc. patch from Engine 1 tree
andigutmans authored
95 HashTable *auto_globals;
96
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
97 zend_bool in_compilation;
9ece796 @zsuraski define zend_bool
zsuraski authored
98 zend_bool short_tags;
99 zend_bool asp_tags;
ced9cee @zsuraski - Implement return by reference:
zsuraski authored
100 zend_bool allow_call_time_pass_reference;
573b460 @andigutmans Zend Library
andigutmans authored
101
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
102 zend_declarables declarables;
103
573b460 @andigutmans Zend Library
andigutmans authored
104 /* For extensions support */
9ece796 @zsuraski define zend_bool
zsuraski authored
105 zend_bool extended_info; /* generate extension information for debugger/profiler */
106 zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
107
9ece796 @zsuraski define zend_bool
zsuraski authored
108 zend_bool unclean_shutdown;
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
109
9596255 @zsuraski Final touches on the INI parser
zsuraski authored
110 zend_bool ini_parser_unbuffered_errors;
111
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
112 zend_llist open_files;
85b4df5 @zsuraski Improved interactive mode - it is now available in all builds, withou…
zsuraski authored
113
29f5dbe @andigutmans - Initial support for exceptions.
andigutmans authored
114 zend_llist *throw_list;
f1e8815 @andigutmans - Change exception handling to use the Java-like catch(MyException $e…
andigutmans authored
115 long catch_begin;
29f5dbe @andigutmans - Initial support for exceptions.
andigutmans authored
116
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
117 struct _zend_ini_parser_param *ini_parser_param;
118
85b4df5 @zsuraski Improved interactive mode - it is now available in all builds, withou…
zsuraski authored
119 int interactive;
7ade3b3 @zsuraski Fix an off by one lineno issue, in case of an implicit ;
zsuraski authored
120
121 zend_bool increment_lineno;
b90d80b @andigutmans - Initial patch to support importing from class scopes (for Stig).
andigutmans authored
122
123 zend_llist import_commands;
573b460 @andigutmans Zend Library
andigutmans authored
124 };
125
126
127 struct _zend_executor_globals {
ced9cee @zsuraski - Implement return by reference:
zsuraski authored
128 zval **return_value_ptr_ptr;
573b460 @andigutmans Zend Library
andigutmans authored
129
130 zval uninitialized_zval;
131 zval *uninitialized_zval_ptr;
132
133 zval error_zval;
134 zval *error_zval_ptr;
135
136 zend_function_state *function_state_ptr;
137 zend_ptr_stack arg_types_stack;
223c674 @zsuraski - Made things work again (Thies, everybody - please check the latest …
zsuraski authored
138
573b460 @andigutmans Zend Library
andigutmans authored
139 /* symbol table cache */
140 HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
141 HashTable **symtable_cache_limit;
142 HashTable **symtable_cache_ptr;
143
144 zend_op **opline_ptr;
145
146 HashTable *active_symbol_table;
147 HashTable symbol_table; /* main symbol table */
148
5951b16 @andigutmans - Quick way of supporting include_once().
andigutmans authored
149 HashTable included_files; /* files already included */
5463dd5 @andigutmans - Add use support (behaves like require, but will not use the same fi…
andigutmans authored
150
573b460 @andigutmans Zend Library
andigutmans authored
151 jmp_buf bailout;
152
153 int error_reporting;
fde2e61 @zsuraski error_reporting fix
zsuraski authored
154 int orig_error_reporting;
2ef6b68 Pass on the exit status
Sascha Schumann authored
155 int exit_status;
573b460 @andigutmans Zend Library
andigutmans authored
156
157 zend_op_array *active_op_array;
158
159 HashTable *function_table; /* function symbol table */
160 HashTable *class_table; /* class table */
161 HashTable *zend_constants; /* constants table */
162
90bd453 @andigutmans - Remove use of C++ reserved words namespace/this
andigutmans authored
163 zend_class_entry *scope;
f4b832d @andigutmans - Fix crash bug in startup code.
andigutmans authored
164 zend_class_entry *main_class_ptr;
4248619 @andigutmans - Initial work on changing namespace scope. Only methods & variables
andigutmans authored
165
90bd453 @andigutmans - Remove use of C++ reserved words namespace/this
andigutmans authored
166 zval *This;
a4248dd @andigutmans - Significantly improve the performance of method calls and $this->me…
andigutmans authored
167
573b460 @andigutmans Zend Library
andigutmans authored
168 long precision;
169
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
170 int ticks_count;
171
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
172 zend_bool in_execution;
931ebe0 @zsuraski Improve bailout mechanism, supports nesting of bailouts a-la try..catch
zsuraski authored
173 zend_bool bailout_set;
aecd5b8 @zsuraski MFZE1
zsuraski authored
174 zend_bool full_tables_cleanup;
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
175
573b460 @andigutmans Zend Library
andigutmans authored
176 /* for extended information support */
741ca16 @andigutmans - Fixed various inheritance problems & Andrey's leak
andigutmans authored
177 zend_bool no_extensions;
573b460 @andigutmans Zend Library
andigutmans authored
178
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
179 #ifdef ZEND_WIN32
180 zend_bool timed_out;
181 #endif
182
573b460 @andigutmans Zend Library
andigutmans authored
183 HashTable regular_list;
184 HashTable persistent_list;
185
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
186 zend_ptr_stack argument_stack;
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
187 int free_op1, free_op2;
188 int (*unary_op)(zval *result, zval *op1);
8ce8324 @zsuraski More TSRMLS_FETCH annihilation
zsuraski authored
189 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
190
5bf89ce @andigutmans - Hopefully fix bug #11476 and improve garbage to be freed very quickly.
andigutmans authored
191 zval *garbage[2];
1c0f136 @andigutmans - Hooray. This might actually work. (I hope)
andigutmans authored
192 int garbage_ptr;
193
67f6974 @zsuraski Initial support for trapping errors (not complete and disabled; will…
zsuraski authored
194 zval *user_error_handler;
34c2b0a @zsuraski - Add restore_error_handler()
zsuraski authored
195 zend_ptr_stack user_error_handlers;
67f6974 @zsuraski Initial support for trapping errors (not complete and disabled; will…
zsuraski authored
196
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
197 /* timeout support */
198 int timeout_seconds;
199
0b7a9ce @zsuraski - Fix Win32 compilation (Use winsock2.h from now on)
zsuraski authored
200 int lambda_count;
201
54d5305 @zsuraski Make the INI mechanism thread safe (or at least thread safer :)
zsuraski authored
202 HashTable ini_directives;
5af7770 @andigutmans - Sync Engine2 CVS with latest Engine CVS
andigutmans authored
203 zend_objects objects;
29f5dbe @andigutmans - Initial support for exceptions.
andigutmans authored
204 zval *exception;
54d5305 @zsuraski Make the INI mechanism thread safe (or at least thread safer :)
zsuraski authored
205
7e5ec2d @andigutmans Initial support for built-in backtracing.
andigutmans authored
206 struct _zend_execute_data *current_execute_data;
207
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
208 void *reserved[ZEND_MAX_RESERVED_RESOURCES];
573b460 @andigutmans Zend Library
andigutmans authored
209 };
210
211
212 struct _zend_alloc_globals {
c517633 @zsuraski namespace protection
zsuraski authored
213 zend_mem_header *head; /* standard list */
214 zend_mem_header *phead; /* persistent list */
573b460 @andigutmans Zend Library
andigutmans authored
215 void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
7f87a31 @smalyshev Make cache counters to be unsigned int
smalyshev authored
216 unsigned int cache_count[MAX_CACHED_MEMORY];
b7a5b3c @zsuraski - Generalize the fast cache mechanism
zsuraski authored
217 void *fast_cache_list_head[MAX_FAST_CACHE_TYPES];
573b460 @andigutmans Zend Library
andigutmans authored
218
66d9314 @zsuraski Implement fast memory allocation and reduced fragmentation under Wind…
zsuraski authored
219 #ifdef ZEND_WIN32
220 HANDLE memory_heap;
221 #endif
222
ebd4445 @zsuraski Add cache statistics support
zsuraski authored
223 #if ZEND_DEBUG
224 /* for performance tuning */
225 int cache_stats[MAX_CACHED_MEMORY][2];
b7a5b3c @zsuraski - Generalize the fast cache mechanism
zsuraski authored
226 int fast_cache_stats[MAX_FAST_CACHE_TYPES][2];
ebd4445 @zsuraski Add cache statistics support
zsuraski authored
227 #endif
2e9886d @zsuraski Get rid of php3_ini in Zend
zsuraski authored
228 #if MEMORY_LIMIT
229 unsigned int memory_limit;
573b460 @andigutmans Zend Library
andigutmans authored
230 unsigned int allocated_memory;
4c0d85b @zsuraski Commit missing fix
zsuraski authored
231 unsigned int allocated_memory_peak;
573b460 @andigutmans Zend Library
andigutmans authored
232 unsigned char memory_exhausted;
233 #endif
234 };
235
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
236 struct _zend_scanner_globals {
483fc4c @zsuraski MFZE1
zsuraski authored
237 FILE *yy_in;
238 FILE *yy_out;
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
239 int yy_leng;
240 char *yy_text;
241 struct yy_buffer_state *current_buffer;
242 char *c_buf_p;
243 int init;
244 int start;
1735281 @zsuraski MFZE1
zsuraski authored
245 char _yy_hold_char;
246 int yy_n_chars;
247 int _yy_did_buffer_switch_on_eof;
e42ab2c @zsuraski MFZE1
zsuraski authored
248 int _yy_last_accepting_state; /* Must be of the same type as yy_state_type,
249 * if for whatever reason it's no longer int!
250 */
1735281 @zsuraski MFZE1
zsuraski authored
251 char *_yy_last_accepting_cpos;
252 int _yy_more_flag;
253 int _yy_more_len;
609d58a @zsuraski Merge from branch - move to standard C scanners in thread safe mode
zsuraski authored
254 };
255
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
256 #endif /* ZEND_GLOBALS_H */
Something went wrong with that request. Please try again.