Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 225 lines (158 sloc) 5.379 kb
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
d2c9e80 @andigutmans - Update copyright year
andigutmans authored
5 | Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
573b460 @andigutmans Zend Library
andigutmans authored
6 +----------------------------------------------------------------------+
5e55e47 @zsuraski It's official now...
zsuraski authored
7 | This source file is subject to version 0.92 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 |
5e55e47 @zsuraski It's official now...
zsuraski authored
10 | http://www.zend.com/license/0_92.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"
573b460 @andigutmans Zend Library
andigutmans authored
34
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles again,...
zsuraski authored
35 /* Define ZTS if you want a thread-safe Zend */
52fcaa4 @zsuraski Thread-safe project
zsuraski authored
36 /*#undef ZTS*/
573b460 @andigutmans Zend Library
andigutmans authored
37
38 #ifdef ZTS
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles again,...
zsuraski authored
39 #include "../TSRM/TSRM.h"
573b460 @andigutmans Zend Library
andigutmans authored
40
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
41 #ifdef __cplusplus
42 class ZendFlexLexer;
6b4c369 @zsuraski Generalization work
zsuraski authored
43 class ZendIniFlexLexer;
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
44 #endif
45
46 BEGIN_EXTERN_C()
e06a1ed @zsuraski Thread safety fixes
zsuraski authored
47 ZEND_API extern int compiler_globals_id;
48 ZEND_API extern int executor_globals_id;
5864b57 @zsuraski This should enable people to use ALLOC_ZVAL() in code outside the php4.d...
zsuraski authored
49 ZEND_API extern int alloc_globals_id;
1aa2c5c @zsuraski 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 @zsuraski - Implement declare() with declarables framework
zsuraski authored
61
62
63 typedef struct _zend_declarables {
64 zval ticks;
65 } zend_declarables;
66
67
573b460 @andigutmans Zend Library
andigutmans authored
68 struct _zend_compiler_globals {
69 zend_stack bp_stack;
70 zend_stack switch_cond_stack;
22f066e @andigutmans - Add foreach() freeing code.
andigutmans authored
71 zend_stack foreach_copy_stack;
573b460 @andigutmans Zend Library
andigutmans authored
72 zend_stack object_stack;
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
73 zend_stack declare_stack;
573b460 @andigutmans Zend Library
andigutmans authored
74
75 zend_class_entry class_entry, *active_class_entry;
cb0d277 @zsuraski parent::methodname() now works better with runtime classes (fix bug #115...
zsuraski authored
76 zval active_ce_parent_class_name;
573b460 @andigutmans Zend Library
andigutmans authored
77
78 /* variables for list() compilation */
79 zend_llist list_llist;
80 zend_llist dimension_llist;
81
82 zend_stack function_call_stack;
83
84 char *compiled_filename;
85
86 int zend_lineno;
86a0efc @zsuraski Fix #2744
zsuraski authored
87 int comment_start_line;
573b460 @andigutmans Zend Library
andigutmans authored
88 char *heredoc;
89 int heredoc_len;
90
91 zend_op_array *active_op_array;
92
93 HashTable *function_table; /* function symbol table */
94 HashTable *class_table; /* class table */
95
c34f41b @zsuraski Eliminate run-time leak with eval()'s
zsuraski authored
96 HashTable filenames_table;
573b460 @andigutmans Zend Library
andigutmans authored
97
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
98 zend_bool in_compilation;
9ece796 @zsuraski define zend_bool
zsuraski authored
99 zend_bool short_tags;
100 zend_bool asp_tags;
ced9cee @zsuraski - Implement return by reference:
zsuraski authored
101 zend_bool allow_call_time_pass_reference;
573b460 @andigutmans Zend Library
andigutmans authored
102
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
103 zend_declarables declarables;
104
573b460 @andigutmans Zend Library
andigutmans authored
105 /* For extensions support */
9ece796 @zsuraski define zend_bool
zsuraski authored
106 zend_bool extended_info; /* generate extension information for debugger/profiler */
107 zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
108
9ece796 @zsuraski define zend_bool
zsuraski authored
109 zend_bool unclean_shutdown;
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
110
9596255 @zsuraski Final touches on the INI parser
zsuraski authored
111 zend_bool ini_parser_unbuffered_errors;
112
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
113 zend_llist open_files;
85b4df5 @zsuraski Improved interactive mode - it is now available in all builds, without a...
zsuraski authored
114
6b4c369 @zsuraski Generalization work
zsuraski authored
115 #if defined(ZTS) && defined(__cplusplus)
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
116 ZendFlexLexer *ZFL;
6b4c369 @zsuraski Generalization work
zsuraski authored
117 ZendIniFlexLexer *ini_scanner;
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
118 #else
119 void *ZFL;
6b4c369 @zsuraski Generalization work
zsuraski authored
120 void *ini_parser;
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
121 #endif
85b4df5 @zsuraski Improved interactive mode - it is now available in all builds, without a...
zsuraski authored
122
123 int interactive;
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 CVS...
zsuraski authored
138
139 /* for global return() support */
140 zval *global_return_value_ptr;
573b460 @andigutmans Zend Library
andigutmans authored
141
142 /* symbol table cache */
143 HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
144 HashTable **symtable_cache_limit;
145 HashTable **symtable_cache_ptr;
146
147 zend_op **opline_ptr;
148
149 HashTable *active_symbol_table;
150 HashTable symbol_table; /* main symbol table */
151
5951b16 @andigutmans - Quick way of supporting include_once().
andigutmans authored
152 HashTable included_files; /* files already included */
5463dd5 @andigutmans - Add use support (behaves like require, but will not use the same file ...
andigutmans authored
153
573b460 @andigutmans Zend Library
andigutmans authored
154 jmp_buf bailout;
155
156 int error_reporting;
fde2e61 @zsuraski error_reporting fix
zsuraski authored
157 int orig_error_reporting;
2ef6b68 Pass on the exit status
Sascha Schumann authored
158 int exit_status;
573b460 @andigutmans Zend Library
andigutmans authored
159
160 zend_op_array *active_op_array;
161
162 HashTable *function_table; /* function symbol table */
163 HashTable *class_table; /* class table */
164 HashTable *zend_constants; /* constants table */
165
166 long precision;
167
fafbf6d @zsuraski - Implement declare() with declarables framework
zsuraski authored
168 int ticks_count;
169
b6197bc @zsuraski Maintain a state of whether we're compiling and/or executing
zsuraski authored
170 zend_bool in_execution;
171
573b460 @andigutmans Zend Library
andigutmans authored
172 /* for extended information support */
741ca16 @andigutmans - Fixed various inheritance problems & Andrey's leak
andigutmans authored
173 zend_bool no_extensions;
573b460 @andigutmans Zend Library
andigutmans authored
174
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored
175 #ifdef ZEND_WIN32
176 zend_bool timed_out;
177 #endif
178
573b460 @andigutmans Zend Library
andigutmans authored
179 HashTable regular_list;
180 HashTable persistent_list;
181
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
182 zend_ptr_stack argument_stack;
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
183 int free_op1, free_op2;
184 int (*unary_op)(zval *result, zval *op1);
185 int (*binary_op)(zval *result, zval *op1, zval *op2);
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
186
5bf89ce @andigutmans - Hopefully fix bug #11476 and improve garbage to be freed very quickly.
andigutmans authored
187 zval *garbage[2];
1c0f136 @andigutmans - Hooray. This might actually work. (I hope)
andigutmans authored
188 int garbage_ptr;
189
67f6974 @zsuraski Initial support for trapping errors (not complete and disabled; will be...
zsuraski authored
190 zval *user_error_handler;
34c2b0a @zsuraski - Add restore_error_handler()
zsuraski authored
191 zend_ptr_stack user_error_handlers;
67f6974 @zsuraski Initial support for trapping errors (not complete and disabled; will be...
zsuraski authored
192
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored
193 /* timeout support */
194 int timeout_seconds;
195
0b7a9ce @zsuraski - Fix Win32 compilation (Use winsock2.h from now on)
zsuraski authored
196 int lambda_count;
197
54d5305 @zsuraski Make the INI mechanism thread safe (or at least thread safer :)
zsuraski authored
198 HashTable ini_directives;
199
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
200 void *reserved[ZEND_MAX_RESERVED_RESOURCES];
573b460 @andigutmans Zend Library
andigutmans authored
201 };
202
203
204 struct _zend_alloc_globals {
c517633 @zsuraski namespace protection
zsuraski authored
205 zend_mem_header *head; /* standard list */
206 zend_mem_header *phead; /* persistent list */
573b460 @andigutmans Zend Library
andigutmans authored
207 void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
7f87a31 @smalyshev Make cache counters to be unsigned int
smalyshev authored
208 unsigned int cache_count[MAX_CACHED_MEMORY];
b7a5b3c @zsuraski - Generalize the fast cache mechanism
zsuraski authored
209 void *fast_cache_list_head[MAX_FAST_CACHE_TYPES];
573b460 @andigutmans Zend Library
andigutmans authored
210
ebd4445 @zsuraski Add cache statistics support
zsuraski authored
211 #if ZEND_DEBUG
212 /* for performance tuning */
213 int cache_stats[MAX_CACHED_MEMORY][2];
b7a5b3c @zsuraski - Generalize the fast cache mechanism
zsuraski authored
214 int fast_cache_stats[MAX_FAST_CACHE_TYPES][2];
ebd4445 @zsuraski Add cache statistics support
zsuraski authored
215 #endif
2e9886d @zsuraski Get rid of php3_ini in Zend
zsuraski authored
216 #if MEMORY_LIMIT
217 unsigned int memory_limit;
573b460 @andigutmans Zend Library
andigutmans authored
218 unsigned int allocated_memory;
4c0d85b @zsuraski Commit missing fix
zsuraski authored
219 unsigned int allocated_memory_peak;
573b460 @andigutmans Zend Library
andigutmans authored
220 unsigned char memory_exhausted;
221 #endif
222 };
223
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
224 #endif /* ZEND_GLOBALS_H */
Something went wrong with that request. Please try again.