Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 234 lines (178 sloc) 5.798 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 #include "zend_compile.h"
114 #include "zend_execute.h"
115
116 struct _zend_compiler_globals {
117 zend_stack bp_stack;
118 zend_stack switch_cond_stack;
119 zend_stack object_stack;
120
121 zend_class_entry class_entry, *active_class_entry;
122
123 /* variables for list() compilation */
124 zend_llist list_llist;
125 zend_llist dimension_llist;
126
127 zend_stack function_call_stack;
128
129 char *compiled_filename;
130
131 int zend_lineno;
132 char *heredoc;
133 int heredoc_len;
134
135 zend_op_array *active_op_array;
136
137 HashTable *function_table; /* function symbol table */
138 HashTable *class_table; /* class table */
139
140 zend_llist filenames_list;
141
142 unsigned char short_tags;
143 unsigned char asp_tags;
144
145 /* For extensions support */
146 unsigned char extended_info; /* generate extension information for debugger/profiler */
147 unsigned char handle_op_arrays; /* run op_arrays through op_array handlers */
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
148
473d1d7 @zsuraski * Fix a bug that occured in case of parse errors. We need to restore…
zsuraski authored
149 unsigned char unclean_shutdown;
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
150
151 zend_llist open_files;
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
152 #ifdef ZTS
153 #ifdef __cplusplus
154 ZendFlexLexer *ZFL;
155 #else
156 void *ZFL;
157 #endif
158 #endif
573b460 @andigutmans Zend Library
andigutmans authored
159 };
160
161
162 struct _zend_executor_globals {
163 zval *return_value;
164
165 zval uninitialized_zval;
166 zval *uninitialized_zval_ptr;
167
168 zval error_zval;
169 zval *error_zval_ptr;
170
171 zend_function_state *function_state_ptr;
172 zend_ptr_stack arg_types_stack;
173 zend_stack overloaded_objects_stack;
174 zval global_return_value;
175
176 /* symbol table cache */
177 HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
178 HashTable **symtable_cache_limit;
179 HashTable **symtable_cache_ptr;
180
181 zend_op **opline_ptr;
182
183 HashTable *active_symbol_table;
184 HashTable symbol_table; /* main symbol table */
185
186 jmp_buf bailout;
187
188 int error_reporting;
189
190 zend_op_array *active_op_array;
191 zend_op_array *main_op_array;
192
193 HashTable *function_table; /* function symbol table */
194 HashTable *class_table; /* class table */
195 HashTable *zend_constants; /* constants table */
196
197 long precision;
198
199 unsigned int AiCount;
200
201 zend_ptr_stack garbage;
202
203 /* for extended information support */
204 unsigned char no_extensions;
205
206 HashTable regular_list;
207 HashTable persistent_list;
208
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
209 zend_ptr_stack argument_stack;
210
342c6e0 @zsuraski Whatnot:
zsuraski authored
211 void *reserved[4];
573b460 @andigutmans Zend Library
andigutmans authored
212 #if SUPPORT_INTERACTIVE
213 int interactive;
214 #endif
215 };
216
217
218
219 struct _zend_alloc_globals {
220 mem_header *head; /* standard list */
221 mem_header *phead; /* persistent list */
222 void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
223 unsigned char cache_count[MAX_CACHED_MEMORY];
224
2e9886d @zsuraski Get rid of php3_ini in Zend
zsuraski authored
225 #if MEMORY_LIMIT
226 unsigned int memory_limit;
573b460 @andigutmans Zend Library
andigutmans authored
227 unsigned int allocated_memory;
228 unsigned char memory_exhausted;
229 #endif
230 };
231
232
551fe77 @zsuraski Make token names uniform, they all begin with T_ now.
zsuraski authored
233 #endif /* _T_GLOBALS_H */
Something went wrong with that request. Please try again.