Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 582 lines (439 sloc) 17.399 kB
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
6 +----------------------------------------------------------------------+
8d1de13 @zsuraski 0.91 update
zsuraski authored
7 | This source file is subject to version 0.91 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 |
8d1de13 @zsuraski 0.91 update
zsuraski authored
10 | http://www.zend.com/license/0_91.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
573b460 @andigutmans Zend Library
andigutmans authored
21 #ifndef _COMPILE_H
22 #define _COMPILE_H
23
24 #include "zend.h"
fa76f0c @zsuraski Compile fix
zsuraski authored
25
009025e * header file cleanup
Stig S. Bakken authored
26 #ifdef HAVE_STDARG_H
27 # include <stdarg.h>
fa76f0c @zsuraski Compile fix
zsuraski authored
28 #endif
29
573b460 @andigutmans Zend Library
andigutmans authored
30 #include "zend_llist.h"
31 #define YYSTYPE znode
32 #include "zend-parser.h"
33
34 #define DEBUG_ZEND 0
fcaf734 @andigutmans - Don't support interactive mode when thread safe.
andigutmans authored
35
36 #ifndef ZTS
009025e * header file cleanup
Stig S. Bakken authored
37 # define SUPPORT_INTERACTIVE 1
fcaf734 @andigutmans - Don't support interactive mode when thread safe.
andigutmans authored
38 #else
009025e * header file cleanup
Stig S. Bakken authored
39 # define SUPPORT_INTERACTIVE 0
fcaf734 @andigutmans - Don't support interactive mode when thread safe.
andigutmans authored
40 #endif
573b460 @andigutmans Zend Library
andigutmans authored
41
42 #define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
43 #define FREE_OP(op, should_free) if (should_free) zval_dtor(&Ts[(op)->u.var].tmp_var);
44
45
46 #if SUPPORT_INTERACTIVE
47 #define INC_BPC(op_array) ((op_array)->backpatch_count++)
48 #define DEC_BPC(op_array) ((op_array)->backpatch_count--)
49 #define HANDLE_INTERACTIVE() if (EG(interactive)) { execute_new_code(CLS_C); }
50 #else
51 #define INC_BPC(op_array)
52 #define DEC_BPC(op_array)
53 #define HANDLE_INTERACTIVE()
54 #endif
55
56 typedef struct _zend_op_array zend_op_array;
57
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
58 typedef struct _znode {
573b460 @andigutmans Zend Library
andigutmans authored
59 int op_type;
60 union {
61 zval constant;
62
63 int var;
64 int opline_num;
bbe27ff @andigutmans - Initialize extended value's and put the fetch_type in it's own vari…
andigutmans authored
65 int fetch_type;
573b460 @andigutmans Zend Library
andigutmans authored
66 zend_op_array *op_array;
67 struct {
68 int var; /* dummy */
69 int type;
70 } EA;
71 } u;
72 } znode;
73
74
75 typedef struct _zend_op {
76 int opcode;
77 znode result;
78 znode op1;
79 znode op2;
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored
80 ulong extended_value;
573b460 @andigutmans Zend Library
andigutmans authored
81 char *filename;
82 uint lineno;
83 } zend_op;
84
85
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
86 typedef struct _zend_brk_cont_element {
573b460 @andigutmans Zend Library
andigutmans authored
87 int cont;
88 int brk;
89 int parent;
90 } zend_brk_cont_element;
91
92
93 struct _zend_op_array {
94 int type; /* MUST be the first element of this struct! */
95
96 unsigned char *arg_types; /* MUST be the second element of this struct! */
97
98 int *refcount;
99
100 zend_op *opcodes;
101 int last, size;
102
103 int T;
104
105 char *function_name;
106
107 zend_brk_cont_element *brk_cont_array;
108 int last_brk_cont;
109 int current_brk_cont;
1b4b5c4 @zsuraski New $GLOBALS init
zsuraski authored
110 unsigned char uses_globals;
573b460 @andigutmans Zend Library
andigutmans authored
111
112 /* static variables support */
113 HashTable *static_variables;
114
115 #if SUPPORT_INTERACTIVE
116 int start_op_number, end_op_number;
117 int last_executed_op_number;
118 int backpatch_count;
119 #endif
120
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
121 void *reserved[ZEND_MAX_RESERVED_RESOURCES];
573b460 @andigutmans Zend Library
andigutmans authored
122 };
123
124
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
125 typedef struct _zend_internal_function {
573b460 @andigutmans Zend Library
andigutmans authored
126 int type; /* MUST be the first element of this struct! */
127
128 unsigned char *arg_types; /* MUST be the second element of this struct */
129
130 void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
131 char *function_name;
132 } zend_internal_function;
133
134
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
135 typedef union _zend_function {
573b460 @andigutmans Zend Library
andigutmans authored
136 int type; /* MUST be the first element of this struct! */
137 struct {
138 int type; /* never used */
139 unsigned char *arg_types;
140 } common;
141
142 zend_op_array op_array;
143 zend_internal_function internal_function;
144 } zend_function;
145
146
9cb2cf1 @zsuraski Optimize allocations into uninitialized_zval assignments
zsuraski authored
147 typedef struct _zend_function_state {
573b460 @andigutmans Zend Library
andigutmans authored
148 HashTable *function_symbol_table;
149 zend_function *function;
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
150 void *reserved[ZEND_MAX_RESERVED_RESOURCES];
573b460 @andigutmans Zend Library
andigutmans authored
151 } zend_function_state;
152
153
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
154 typedef struct _zend_switch_entry {
573b460 @andigutmans Zend Library
andigutmans authored
155 znode cond;
156 int default_case;
157 int control_var;
158 } zend_switch_entry;
159
160
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
161 typedef struct _list_llist_element {
573b460 @andigutmans Zend Library
andigutmans authored
162 znode var;
163 zend_llist dimensions;
164 znode value;
165 } list_llist_element;
166
167
39f9487 @andigutmans -Tiny patches
andigutmans authored
168 typedef struct _zend_file_handle {
573b460 @andigutmans Zend Library
andigutmans authored
169 int type;
170 char *filename;
171 union {
172 int fd;
173 FILE *fp;
174 #ifdef __cplusplus
175 istream *is;
176 #endif
177 } handle;
178 } zend_file_handle;
179
180
181 #include "zend_globals.h"
182
183 #define IS_CONST (1<<0)
184 #define IS_TMP_VAR (1<<1)
185 #define IS_VAR (1<<2)
186 #define IS_UNUSED (1<<3) /* Unused variable */
187
188
189 #define EXT_TYPE_UNUSED (1<<0)
190
191 void init_compiler(CLS_D ELS_DC);
192 void shutdown_compiler(CLS_D);
193
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
194 BEGIN_EXTERN_C()
39f9487 @andigutmans -Tiny patches
andigutmans authored
195 extern ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...);
573b460 @andigutmans Zend Library
andigutmans authored
196
ed06a70 @zsuraski * Centralized shutdown
zsuraski authored
197 void zend_activate(CLS_D ELS_DC);
198 void zend_deactivate(CLS_D ELS_DC);
199
573b460 @andigutmans Zend Library
andigutmans authored
200 int lex_scan(zval *zendlval CLS_DC);
201 void startup_scanner(CLS_D);
202 void shutdown_scanner(CLS_D);
203
07e0885 @andigutmans Make set_compiled_filename() return a pointer to the allocated file name
andigutmans authored
204 ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename);
573b460 @andigutmans Zend Library
andigutmans authored
205 ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename);
206 ZEND_API char *zend_get_compiled_filename();
207
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
208 #ifdef ZTS
209 const char *zend_get_zendtext(CLS_D);
210 int zend_get_zendleng(CLS_D);
211 #endif
212
213 END_EXTERN_C()
573b460 @andigutmans Zend Library
andigutmans authored
214
215 /* parser-driven code generators */
216 void do_binary_op(int op, znode *result, znode *op1, znode *op2 CLS_DC);
217 void do_unary_op(int op, znode *result, znode *op1 CLS_DC);
218 void do_binary_assign_op(int op, znode *result, znode *op1, znode *op2 CLS_DC);
219 void do_assign(znode *result, znode *variable, znode *value CLS_DC);
220 void do_assign_ref(znode *result, znode *lvar, znode *rvar CLS_DC);
221 void fetch_simple_variable(znode *result, znode *varname, int bp CLS_DC);
82c8a9e @andigutmans - Indirect references had all of the fetches by mistakenly backpatched.
andigutmans authored
222 void fetch_simple_variable_ex(znode *result, znode *varname, int bp, int op CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
223 void do_indirect_references(znode *result, znode *num_references, znode *variable CLS_DC);
224 void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type CLS_DC);
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles aga…
zsuraski authored
225 void do_fetch_globals(znode *varname CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
226
227 void fetch_array_begin(znode *result, znode *varname, znode *first_dim CLS_DC);
228 void fetch_array_dim(znode *result, znode *parent, znode *dim CLS_DC);
229 void do_print(znode *result, znode *arg CLS_DC);
230 void do_echo(znode *arg CLS_DC);
8802964 * fix some casts
Sascha Schumann authored
231 typedef int (*unary_op_type)(zval *, zval *);
232 ZEND_API unary_op_type get_unary_op(int opcode);
573b460 @andigutmans Zend Library
andigutmans authored
233 ZEND_API void *get_binary_op(int opcode);
234
235 void do_while_cond(znode *expr, znode *close_bracket_token CLS_DC);
236 void do_while_end(znode *while_token, znode *close_bracket_token CLS_DC);
237 void do_do_while_begin(CLS_D);
238 void do_do_while_end(znode *do_token, znode *expr CLS_DC);
239
240
241 void do_if_cond(znode *cond, znode *closing_bracket_token CLS_DC);
242 void do_if_after_statement(znode *closing_bracket_token, unsigned char initialize CLS_DC);
243 void do_if_end(CLS_D);
244
245 void do_for_cond(znode *expr, znode *second_semicolon_token CLS_DC);
246 void do_for_before_statement(znode *cond_start, znode *second_semicolon_token CLS_DC);
247 void do_for_end(znode *second_semicolon_token CLS_DC);
248
249 void do_pre_incdec(znode *result, znode *op1, int op CLS_DC);
250 void do_post_incdec(znode *result, znode *op1, int op CLS_DC);
251
252 void do_begin_variable_parse(CLS_D);
06d04d1 @andigutmans - Fix SEND_VAR problem after fetch'ing a variable and not knowing the…
andigutmans authored
253 void do_end_variable_parse(int type, int arg_offset CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
254
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
255 void do_free(znode *op1 CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
256
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles aga…
zsuraski authored
257 void do_init_string(znode *result CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
258 void do_add_char(znode *result, znode *op1, znode *op2 CLS_DC);
259 void do_add_string(znode *result, znode *op1, znode *op2 CLS_DC);
260 void do_add_variable(znode *result, znode *op1, znode *op2 CLS_DC);
261
262 void do_begin_function_declaration(znode *function_token, znode *function_name, int is_method CLS_DC);
263 void do_end_function_declaration(znode *function_token CLS_DC);
264 void do_receive_arg(int op, znode *var, znode *offset, znode *initialization, unsigned char pass_type CLS_DC);
739132e @andigutmans - Fixed a leak when doing inheritance. The parent class name wasn't b…
andigutmans authored
265 int do_begin_function_call(znode *function_name CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
266 void do_begin_dynamic_function_call(znode *function_name CLS_DC);
267 void do_begin_class_member_function_call(znode *class_name, znode *function_name CLS_DC);
739132e @andigutmans - Fixed a leak when doing inheritance. The parent class name wasn't b…
andigutmans authored
268 void do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
269 void do_return(znode *expr CLS_DC);
ef5b7e2 @zsuraski Generate better warnings for class/function redefinitions
zsuraski authored
270 ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time);
b0bfa45 @zsuraski * Fix all hash checks that checked Bucket.arKey for NULL, when it was…
zsuraski authored
271 void do_early_binding(CLS_D);
573b460 @andigutmans Zend Library
andigutmans authored
272
273 void do_pass_param(znode *param, int op, int offset CLS_DC);
274
275
276 void do_boolean_or_begin(znode *expr1, znode *op_token CLS_DC);
277 void do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC);
278 void do_boolean_and_begin(znode *expr1, znode *op_token CLS_DC);
279 void do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC);
280
281 void do_brk_cont(int op, znode *expr CLS_DC);
282
283 void do_switch_cond(znode *cond CLS_DC);
284 void do_switch_end(znode *case_list CLS_DC);
285 void do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr CLS_DC);
286 void do_case_after_statement(znode *result, znode *case_token CLS_DC);
287 void do_default_before_statement(znode *case_list, znode *default_token CLS_DC);
288
289 void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_DC);
290 void do_end_class_declaration(CLS_D);
291 void do_declare_property(znode *var_name, znode *value CLS_DC);
292
293 void do_fetch_property(znode *result, znode *object, znode *property CLS_DC);
294
295
296 void do_push_object(znode *object CLS_DC);
297 void do_pop_object(znode *object CLS_DC);
298
299
8f51f72 @andigutmans - Fix the new operator incompatibility.
andigutmans authored
300 void do_begin_new_object(znode *new_token, znode *class_name CLS_DC);
301 void do_end_new_object(znode *result, znode *class_name, znode *new_token, znode *argument_list CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
302
303 void do_fetch_constant(znode *result, znode *constant_name, int mode CLS_DC);
304
305 void do_shell_exec(znode *result, znode *cmd CLS_DC);
306
307 void do_init_array(znode *result, znode *expr, znode *offset CLS_DC);
308 void do_add_array_element(znode *result, znode *expr, znode *offset CLS_DC);
7ed4923 @andigutmans - Fix the static array() initializing
andigutmans authored
309 void do_add_static_array_element(znode *result, znode *offset, znode *expr);
573b460 @andigutmans Zend Library
andigutmans authored
310 void do_list_init();
311 void do_list_end(znode *result, znode *expr CLS_DC);
312 void do_add_list_element(znode *element CLS_DC);
313 void do_new_list_begin(CLS_D);
314 void do_new_list_end(CLS_D);
315
316 void do_cast(znode *result, znode *expr, int type CLS_DC);
317 void do_include_or_eval(int type, znode *result, znode *op1 CLS_DC);
318
319 void do_unset(znode *variable CLS_DC);
320 void do_isset_or_isempty(int type, znode *result, znode *variable CLS_DC);
321
322 void do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token CLS_DC);
323 void do_foreach_cont(znode *value, znode *key, znode *as_token CLS_DC);
324 void do_foreach_end(znode *foreach_token, znode *open_brackets_token CLS_DC);
325
326 void do_end_heredoc(CLS_D);
327
328 void do_exit(znode *result, znode *message CLS_DC);
329
330 void do_begin_silence(znode *strudel_token CLS_DC);
331 void do_end_silence(znode *strudel_token CLS_DC);
332
333 void do_begin_qm_op(znode *cond, znode *qm_token CLS_DC);
334 void do_qm_true(znode *true_value, znode *qm_token, znode *colon_token CLS_DC);
335 void do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token CLS_DC);
336
337 void do_extended_info(CLS_D);
338 void do_extended_fcall_begin(CLS_D);
339 void do_extended_fcall_end(CLS_D);
340
7c4a083 @zsuraski Various thread safety fixes and DLL updates
zsuraski authored
341 #define INITIAL_OP_ARRAY_SIZE 64
342
573b460 @andigutmans Zend Library
andigutmans authored
343
344 /* helper functions in zend-scanner.l */
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
345 BEGIN_EXTERN_C()
573b460 @andigutmans Zend Library
andigutmans authored
346 ZEND_API int require_file(zend_file_handle *file_handle CLS_DC);
347 ZEND_API int require_filename(char *filename CLS_DC);
348 ZEND_API zend_op_array *compile_files(int mark_as_ref CLS_DC, int file_count, ...);
7a87fcb @zsuraski Thread safety patch. We're still not quite there but it compiles aga…
zsuraski authored
349 ZEND_API zend_op_array *v_compile_files(int mark_as_ref CLS_DC, int file_count, va_list files);
573b460 @andigutmans Zend Library
andigutmans authored
350 ZEND_API zend_op_array *compile_string(zval *source_string CLS_DC);
351 ZEND_API zend_op_array *compile_filename(zval *filename CLS_DC);
7c4a083 @zsuraski Various thread safety fixes and DLL updates
zsuraski authored
352 ZEND_API inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
353 ZEND_API void init_op_array(zend_op_array *op_array, int initial_ops_size);
354 ZEND_API void destroy_op_array(zend_op_array *op_array);
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
355 ZEND_API void zend_close_file_handle(zend_file_handle *file_handle CLS_DC);
356 ZEND_API void zend_open_file_dtor(void *f);
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
357 END_EXTERN_C()
573b460 @andigutmans Zend Library
andigutmans authored
358
81d901b @zsuraski Step 1 in nuking the garbage collector:
zsuraski authored
359 ZEND_API int destroy_zend_function(zend_function *function);
360 ZEND_API int destroy_zend_class(zend_class_entry *ce);
7c4a083 @zsuraski Various thread safety fixes and DLL updates
zsuraski authored
361 void zend_class_add_ref(zend_class_entry *ce);
362
81d901b @zsuraski Step 1 in nuking the garbage collector:
zsuraski authored
363 #define ZEND_FUNCTION_DTOR (int (*)(void *)) destroy_zend_function
364 #define ZEND_CLASS_DTOR (int (*)(void *)) destroy_zend_class
365
573b460 @andigutmans Zend Library
andigutmans authored
366 zend_op *get_next_op(zend_op_array *op_array CLS_DC);
babad26 @andigutmans - First step in fixing locking problem. Array fetches are now always …
andigutmans authored
367 void init_op(zend_op *op CLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
368 int get_next_op_number(zend_op_array *op_array);
369 int print_class(zend_class_entry *class_entry);
370 void print_op_array(zend_op_array *op_array, int optimizations);
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
371 BEGIN_EXTERN_C()
573b460 @andigutmans Zend Library
andigutmans authored
372 int pass_two(zend_op_array *op_array);
373 void pass_include_eval(zend_op_array *op_array);
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
374 END_EXTERN_C()
573b460 @andigutmans Zend Library
andigutmans authored
375 zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
376
377
378 int zendlex(znode *zendlval CLS_DC);
379
380
381 #define ZEND_NOP 0
382
383 #define ZEND_ADD 1
384 #define ZEND_SUB 2
385 #define ZEND_MUL 3
386 #define ZEND_DIV 4
387 #define ZEND_MOD 5
388 #define ZEND_SL 6
389 #define ZEND_SR 7
390 #define ZEND_CONCAT 8
391 #define ZEND_BW_OR 9
392 #define ZEND_BW_AND 10
393 #define ZEND_BW_XOR 11
394 #define ZEND_BW_NOT 12
395 #define ZEND_BOOL_NOT 13
396 #define ZEND_BOOL_XOR 14
5a5806e @zsuraski Cleanups, remove old ts code
zsuraski authored
397 #define ZEND_IS_EQUAL 15
398 #define ZEND_IS_NOT_EQUAL 16
573b460 @andigutmans Zend Library
andigutmans authored
399 #define ZEND_IS_SMALLER 17
5a5806e @zsuraski Cleanups, remove old ts code
zsuraski authored
400 #define ZEND_IS_SMALLER_OR_EQUAL 18
573b460 @andigutmans Zend Library
andigutmans authored
401 #define ZEND_CAST 19
402 #define ZEND_QM_ASSIGN 20
403
5a5806e @zsuraski Cleanups, remove old ts code
zsuraski authored
404 #define ZEND_ASSIGN_ADD 21
405 #define ZEND_ASSIGN_SUB 22
406 #define ZEND_ASSIGN_MUL 23
407 #define ZEND_ASSIGN_DIV 24
408 #define ZEND_ASSIGN_MOD 25
409 #define ZEND_ASSIGN_SL 26
410 #define ZEND_ASSIGN_SR 27
411 #define ZEND_ASSIGN_CONCAT 28
412 #define ZEND_ASSIGN_BW_OR 29
413 #define ZEND_ASSIGN_BW_AND 30
414 #define ZEND_ASSIGN_BW_XOR 31
573b460 @andigutmans Zend Library
andigutmans authored
415
416 #define ZEND_PRE_INC 32
417 #define ZEND_PRE_DEC 33
418 #define ZEND_POST_INC 34
419 #define ZEND_POST_DEC 35
420
5a5806e @zsuraski Cleanups, remove old ts code
zsuraski authored
421 #define ZEND_ASSIGN 36
422 #define ZEND_ASSIGN_REF 37
573b460 @andigutmans Zend Library
andigutmans authored
423
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
424 #define ZEND_ECHO 38
425 #define ZEND_PRINT 39
573b460 @andigutmans Zend Library
andigutmans authored
426
427 #define ZEND_JMP 40
428 #define ZEND_JMPZ 41
429 #define ZEND_JMPNZ 42
430 #define ZEND_JMPZNZ 43
431 #define ZEND_JMPZ_EX 44
432 #define ZEND_JMPNZ_EX 45
433 #define ZEND_CASE 46
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
434 #define ZEND_SWITCH_FREE 47
435 #define ZEND_BRK 48
436 #define ZEND_CONT 49
437 #define ZEND_BOOL 50
438
439 #define ZEND_INIT_STRING 51
440 #define ZEND_ADD_CHAR 52
441 #define ZEND_ADD_STRING 53
442 #define ZEND_ADD_VAR 54
443
444 #define ZEND_BEGIN_SILENCE 55
445 #define ZEND_END_SILENCE 56
446
447 #define ZEND_INIT_FCALL_BY_NAME 57
448 #define ZEND_DO_FCALL 58
449 #define ZEND_DO_FCALL_BY_NAME 59
450 #define ZEND_RETURN 60
451
452 #define ZEND_RECV 61
453 #define ZEND_RECV_INIT 62
573b460 @andigutmans Zend Library
andigutmans authored
454
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
455 #define ZEND_SEND_VAL 63
456 #define ZEND_SEND_VAR 64
457 #define ZEND_SEND_REF 65
573b460 @andigutmans Zend Library
andigutmans authored
458
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
459 #define ZEND_NEW 66
460 #define ZEND_JMP_NO_CTOR 67
461 #define ZEND_FREE 68
573b460 @andigutmans Zend Library
andigutmans authored
462
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
463 #define ZEND_INIT_ARRAY 69
464 #define ZEND_ADD_ARRAY_ELEMENT 70
573b460 @andigutmans Zend Library
andigutmans authored
465
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
466 #define ZEND_INCLUDE_OR_EVAL 71
573b460 @andigutmans Zend Library
andigutmans authored
467
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
468 #define ZEND_UNSET_VAR 72
469 #define ZEND_UNSET_DIM_OBJ 73
470 #define ZEND_ISSET_ISEMPTY 74
573b460 @andigutmans Zend Library
andigutmans authored
471
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
472 #define ZEND_FE_RESET 75
473 #define ZEND_FE_FETCH 76
573b460 @andigutmans Zend Library
andigutmans authored
474
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
475 #define ZEND_EXIT 77
573b460 @andigutmans Zend Library
andigutmans authored
476
477
06d04d1 @andigutmans - Fix SEND_VAR problem after fetch'ing a variable and not knowing the…
andigutmans authored
478 /* the following 12 opcodes are 5 groups of 3 opcodes each, and must
573b460 @andigutmans Zend Library
andigutmans authored
479 * remain in that order!
480 */
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
481 #define ZEND_FETCH_R 78
482 #define ZEND_FETCH_DIM_R 79
483 #define ZEND_FETCH_OBJ_R 80
484 #define ZEND_FETCH_W 81
485 #define ZEND_FETCH_DIM_W 82
486 #define ZEND_FETCH_OBJ_W 83
487 #define ZEND_FETCH_RW 84
488 #define ZEND_FETCH_DIM_RW 85
489 #define ZEND_FETCH_OBJ_RW 86
490 #define ZEND_FETCH_IS 87
491 #define ZEND_FETCH_DIM_IS 88
492 #define ZEND_FETCH_OBJ_IS 89
06d04d1 @andigutmans - Fix SEND_VAR problem after fetch'ing a variable and not knowing the…
andigutmans authored
493 #define ZEND_FETCH_FUNC_ARG 90
494 #define ZEND_FETCH_DIM_FUNC_ARG 91
495 #define ZEND_FETCH_OBJ_FUNC_ARG 92
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
496
06d04d1 @andigutmans - Fix SEND_VAR problem after fetch'ing a variable and not knowing the…
andigutmans authored
497 #define ZEND_FETCH_DIM_TMP_VAR 93
498 #define ZEND_FETCH_CONSTANT 94
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
499
06d04d1 @andigutmans - Fix SEND_VAR problem after fetch'ing a variable and not knowing the…
andigutmans authored
500 #define ZEND_DECLARE_FUNCTION_OR_CLASS 95
1b6fae1 @zsuraski Thoroughly fix the SWITCH problem. No RETURN handling yet.
zsuraski authored
501
06d04d1 @andigutmans - Fix SEND_VAR problem after fetch'ing a variable and not knowing the…
andigutmans authored
502 #define ZEND_EXT_STMT 96
503 #define ZEND_EXT_FCALL_BEGIN 97
504 #define ZEND_EXT_FCALL_END 98
505 #define ZEND_EXT_NOP 99
573b460 @andigutmans Zend Library
andigutmans authored
506
507 /* end of block */
508
509
510
511
512 /* global/local fetches */
513 #define ZEND_FETCH_GLOBAL 0
514 #define ZEND_FETCH_LOCAL 1
515 #define ZEND_FETCH_STATIC 2
516
517 /* var status for backpatching */
06d04d1 @andigutmans - Fix SEND_VAR problem after fetch'ing a variable and not knowing the…
andigutmans authored
518 #define BP_VAR_R 0
519 #define BP_VAR_W 1
520 #define BP_VAR_RW 2
521 #define BP_VAR_IS 3
522 #define BP_VAR_NA 4 /* if not applicable */
523 #define BP_VAR_FUNC_ARG 5
573b460 @andigutmans Zend Library
andigutmans authored
524
525
526 #define ZEND_INTERNAL_FUNCTION 1
527 #define ZEND_USER_FUNCTION 2
528 #define ZEND_OVERLOADED_FUNCTION 3
2493f68 @zsuraski * Fix debugger+interactive mode bug
zsuraski authored
529 #define ZEND_EVAL_CODE 4
573b460 @andigutmans Zend Library
andigutmans authored
530
531 #define ZEND_INTERNAL_CLASS 1
532 #define ZEND_USER_CLASS 2
533
534 #define ZEND_EVAL (1<<0)
535 #define ZEND_INCLUDE (1<<1)
536
537 #define ZEND_ISSET (1<<0)
538 #define ZEND_ISEMPTY (1<<1)
539
540 #define ZEND_CT (1<<0)
541 #define ZEND_RT (1<<1)
542
543
544 #define ZEND_HANDLE_FILENAME 0
545 #define ZEND_HANDLE_FD 1
546 #define ZEND_HANDLE_FP 2
547 #define ZEND_HANDLE_ISTREAM 3
548
d894cf4 @zsuraski Support definition of classes that are derived from classes that are …
zsuraski authored
549 #define ZEND_DECLARE_CLASS 1
550 #define ZEND_DECLARE_FUNCTION 2
551 #define ZEND_DECLARE_INHERITED_CLASS 3
b0bfa45 @zsuraski * Fix all hash checks that checked Bucket.arKey for NULL, when it was…
zsuraski authored
552
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
553 #define ZEND_FETCH_STANDARD 0
cccd244 @zsuraski Get rid of AiCount completely
zsuraski authored
554 #define ZEND_FETCH_ADD_LOCK 1
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
555
741b816 @zsuraski * Support getThis() for internal functions.
zsuraski authored
556 #define ZEND_MEMBER_FUNC_CALL 1<<0
557 #define ZEND_CTOR_CALL 1<<1
558
6ec1acb @zsuraski Phase 3:
zsuraski authored
559
59d5462 @andigutmans - Stop using the locking mechanism and start using refcount.
andigutmans authored
560 #define AI_USE_PTR(ai) \
561 if ((ai).ptr_ptr) { \
562 (ai).ptr = *((ai).ptr_ptr); \
563 (ai).ptr_ptr = &((ai).ptr); \
564 } else { \
565 (ai).ptr = NULL; \
566 }
567
2a6da78 @zsuraski Step 4:
zsuraski authored
568 #define PZVAL_IS_REF(z) ((z)->EA.is_ref)
569 #define PZVAL_IS_LOCKED(z) ((z)->EA.locks>0)
570
59d5462 @andigutmans - Stop using the locking mechanism and start using refcount.
andigutmans authored
571 #if 0
2a6da78 @zsuraski Step 4:
zsuraski authored
572 #define PZVAL_LOCK(z) (z)->EA.locks++
573 #define PZVAL_UNLOCK(z) (z)->EA.locks--
720d32f @zsuraski Fix a few leaks
zsuraski authored
574 #define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
59d5462 @andigutmans - Stop using the locking mechanism and start using refcount.
andigutmans authored
575 #else
576 #define PZVAL_LOCK(z) ((z)->refcount++)
577 #define PZVAL_UNLOCK(z) ((z)->refcount--)
578 #define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
579 #endif
6ec1acb @zsuraski Phase 3:
zsuraski authored
580
573b460 @andigutmans Zend Library
andigutmans authored
581 #endif /* _COMPILE_H */
Something went wrong with that request. Please try again.