Permalink
Newer
Older
100644 811 lines (618 sloc) 26 KB
Apr 7, 1999
1
/*
2
+----------------------------------------------------------------------+
3
| Zend Engine |
4
+----------------------------------------------------------------------+
Dec 31, 2002
5
| Copyright (c) 1998-2003 Zend Technologies Ltd. (http://www.zend.com) |
Apr 7, 1999
6
+----------------------------------------------------------------------+
Dec 11, 2001
7
| This source file is subject to version 2.00 of the Zend license, |
Jul 16, 1999
8
| that is bundled with this package in the file LICENSE, and is |
9
| available through the world-wide-web at the following url: |
Dec 11, 2001
10
| http://www.zend.com/license/2_00.txt. |
Jul 16, 1999
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. |
Apr 7, 1999
14
+----------------------------------------------------------------------+
15
| Authors: Andi Gutmans <andi@zend.com> |
16
| Zeev Suraski <zeev@zend.com> |
17
+----------------------------------------------------------------------+
18
*/
19
Jul 16, 1999
21
22
#ifndef ZEND_COMPILE_H
23
#define ZEND_COMPILE_H
Apr 7, 1999
24
25
#include "zend.h"
Apr 14, 1999
26
Stig S. Bakken
Sep 6, 1999
27
#ifdef HAVE_STDARG_H
28
# include <stdarg.h>
Apr 14, 1999
29
#endif
30
Apr 7, 1999
31
#include "zend_llist.h"
32
33
#define DEBUG_ZEND 0
Apr 7, 1999
35
#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
36
#define FREE_OP(Ts, op, should_free) if (should_free) zval_dtor(should_free);
Apr 7, 1999
37
38
#define SET_UNUSED(op) (op).op_type = IS_UNUSED
Apr 7, 1999
39
40
#define INC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count++); }
41
#define DEC_BPC(op_array) if (CG(interactive)) { ((op_array)->backpatch_count--); }
42
#define HANDLE_INTERACTIVE() if (CG(interactive)) { execute_new_code(TSRMLS_C); }
Apr 7, 1999
43
44
#define RESET_DOC_COMMENT() \
Andrei Zmievski
Apr 2, 2003
45
{ \
46
CG(doc_comment) = NULL; \
47
CG(doc_comment_len) = 0; \
Andrei Zmievski
Apr 2, 2003
48
}
Apr 7, 1999
50
typedef struct _zend_op_array zend_op_array;
51
typedef struct _zend_op zend_op;
Apr 7, 1999
52
Apr 7, 1999
54
int op_type;
55
zend_llist *throw_list; /* Try and save this space later on */
Apr 7, 1999
56
union {
57
zval constant;
58
60
zend_uint opline_num; /* Needs to be signed */
Apr 7, 1999
61
zend_op_array *op_array;
Apr 7, 1999
63
struct {
64
zend_uint var; /* dummy */
65
zend_uint type;
Apr 7, 1999
66
} EA;
67
} u;
68
} znode;
69
70
typedef struct _zend_execute_data zend_execute_data;
71
72
#define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data, zend_op_array *op_array TSRMLS_DC
73
#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data, op_array TSRMLS_CC
74
75
typedef int (*opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
76
77
extern opcode_handler_t zend_opcode_handlers[512];
Apr 7, 1999
78
80
opcode_handler_t handler;
Apr 7, 1999
81
znode result;
82
znode op1;
83
znode op2;
Apr 7, 1999
85
uint lineno;
86
zend_uchar opcode;
Apr 7, 1999
88
89
90
typedef struct _zend_brk_cont_element {
Apr 7, 1999
91
int cont;
92
int brk;
93
int parent;
94
} zend_brk_cont_element;
95
96
97
#define ZEND_ACC_STATIC 0x01
98
#define ZEND_ACC_ABSTRACT 0x02
99
#define ZEND_ACC_FINAL 0x04
100
#define ZEND_ACC_INTERFACE 0x08
101
#define ZEND_ACC_ABSTRACT_CLASS 0x10
Marcus Boerger
Jun 21, 2003
102
#define ZEND_ACC_FINAL_CLASS 0x20
104
/* The order of those must be kept - public < protected < private */
105
#define ZEND_ACC_PUBLIC 0x100
106
#define ZEND_ACC_PROTECTED 0x200
107
#define ZEND_ACC_PRIVATE 0x400
108
#define ZEND_ACC_PPP_MASK (ZEND_ACC_PUBLIC | ZEND_ACC_PROTECTED | ZEND_ACC_PRIVATE)
110
#define ZEND_ACC_CHANGED 0x800
111
#define ZEND_ACC_IMPLICIT_PUBLIC 0x1000
113
#define ZEND_ACC_CTOR 0x2000
114
#define ZEND_ACC_DTOR 0x4000
115
116
#define ZEND_ACC_ALIAS 0x8000
117
118
char *zend_visibility_string(zend_uint fn_flags);
120
121
typedef struct _zend_property_info {
122
zend_uint flags;
123
char *name;
124
int name_length;
125
ulong h;
126
} zend_property_info;
127
128
129
typedef struct _zend_arg_info {
130
char *name;
131
zend_uint name_len;
132
char *class_name;
133
zend_uint class_name_len;
134
zend_bool allow_null;
135
zend_bool pass_by_reference;
136
} zend_arg_info;
137
Apr 7, 1999
138
struct _zend_op_array {
139
/* Common elements */
140
zend_uchar type;
141
char *function_name;
142
zend_class_entry *scope;
143
zend_uint fn_flags;
144
union _zend_function *prototype;
145
zend_uint num_args;
146
zend_arg_info *arg_info;
147
zend_bool pass_rest_by_reference;
Apr 7, 1999
149
Apr 7, 1999
151
152
zend_op *opcodes;
153
zend_uint last, size;
Apr 7, 1999
154
Apr 7, 1999
156
157
zend_brk_cont_element *brk_cont_array;
158
zend_uint last_brk_cont;
159
zend_uint current_brk_cont;
Apr 7, 1999
160
161
/* static variables support */
162
HashTable *static_variables;
163
Apr 7, 1999
165
int backpatch_count;
167
zend_bool return_reference;
Apr 7, 1999
170
Andrei Zmievski
Mar 31, 2003
172
zend_uint line_start;
173
zend_uint line_end;
174
char *doc_comment;
175
zend_uint doc_comment_len;
177
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
Apr 7, 1999
178
};
179
180
181
typedef struct _zend_internal_function {
182
/* Common elements */
183
zend_uchar type;
184
char *function_name;
185
zend_class_entry *scope;
186
zend_uint fn_flags;
187
union _zend_function *prototype;
188
zend_uint num_args;
189
zend_arg_info *arg_info;
190
zend_bool pass_rest_by_reference;
Apr 7, 1999
192
193
void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
194
} zend_internal_function;
195
196
#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name : "")
199
zend_uchar type; /* MUST be the first element of this struct! */
Apr 7, 1999
201
struct {
202
zend_uchar type; /* never used */
203
char *function_name;
204
zend_class_entry *scope;
205
zend_uint fn_flags;
206
union _zend_function *prototype;
207
zend_uint num_args;
208
zend_arg_info *arg_info;
209
zend_bool pass_rest_by_reference;
Apr 7, 1999
210
} common;
211
212
zend_op_array op_array;
213
zend_internal_function internal_function;
214
} zend_function;
215
216
217
typedef struct _zend_function_state {
Apr 7, 1999
218
HashTable *function_symbol_table;
219
zend_function *function;
220
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
Apr 7, 1999
221
} zend_function_state;
222
223
224
typedef struct _zend_switch_entry {
Apr 7, 1999
225
znode cond;
226
int default_case;
227
int control_var;
228
} zend_switch_entry;
229
230
231
typedef struct _list_llist_element {
Apr 7, 1999
232
znode var;
233
zend_llist dimensions;
234
znode value;
235
} list_llist_element;
236
237
union _temp_variable;
238
239
struct _zend_execute_data {
240
struct _zend_op *opline;
241
zend_function_state function_state;
242
zend_function *fbc; /* Function Being Called */
243
zend_function *fbc_constructor;
245
zval *object;
246
union _temp_variable *Ts;
247
zend_bool original_in_execution;
248
zend_class_entry *calling_scope;
249
struct _zend_execute_data *prev_execute_data;
250
};
Apr 7, 1999
251
252
#define EX(element) execute_data.element
253
Apr 7, 1999
254
255
#define IS_CONST (1<<0)
256
#define IS_TMP_VAR (1<<1)
257
#define IS_VAR (1<<2)
258
#define IS_UNUSED (1<<3) /* Unused variable */
259
260
#define EXT_TYPE_UNUSED (1<<0)
261
262
#include "zend_globals.h"
263
Jan 29, 2000
264
BEGIN_EXTERN_C()
265
266
void init_compiler(TSRMLS_D);
267
void shutdown_compiler(TSRMLS_D);
268
void zend_init_compiler_data_structures(TSRMLS_D);
Apr 7, 1999
269
270
extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC);
Apr 7, 1999
271
272
ZEND_API int lex_scan(zval *zendlval TSRMLS_DC);
273
void startup_scanner(TSRMLS_D);
274
void shutdown_scanner(TSRMLS_D);
Apr 7, 1999
275
276
ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename TSRMLS_DC);
277
ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename TSRMLS_DC);
278
ZEND_API char *zend_get_compiled_filename(TSRMLS_D);
279
ZEND_API int zend_get_compiled_lineno(TSRMLS_D);
Apr 7, 1999
280
282
const char *zend_get_zendtext(TSRMLS_D);
283
int zend_get_zendleng(TSRMLS_D);
Apr 7, 1999
286
287
/* parser-driven code generators */
288
void zend_do_fold_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
Apr 11, 2003
289
void zend_do_fold_constant(znode *result, znode *constant_name TSRMLS_DC);
Harald Radi
Apr 23, 2002
290
void zend_do_binary_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
291
void zend_do_unary_op(zend_uchar op, znode *result, znode *op1 TSRMLS_DC);
292
void zend_do_binary_assign_op(zend_uchar op, znode *result, znode *op1, znode *op2 TSRMLS_DC);
293
void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC);
294
void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC);
295
void fetch_simple_variable(znode *result, znode *varname, int bp TSRMLS_DC);
Harald Radi
Apr 23, 2002
296
void fetch_simple_variable_ex(znode *result, znode *varname, int bp, zend_uchar op TSRMLS_DC);
297
void zend_do_indirect_references(znode *result, znode *num_references, znode *variable TSRMLS_DC);
298
void zend_do_fetch_static_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC);
299
void zend_do_fetch_global_variable(znode *varname, znode *static_assignment, int fetch_type TSRMLS_DC);
300
301
void fetch_array_begin(znode *result, znode *varname, znode *first_dim TSRMLS_DC);
302
void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC);
303
void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC);
304
void zend_do_fetch_static_member(znode *class_znode TSRMLS_DC);
305
void zend_do_print(znode *result, znode *arg TSRMLS_DC);
306
void zend_do_echo(znode *arg TSRMLS_DC);
Sascha Schumann
May 30, 1999
307
typedef int (*unary_op_type)(zval *, zval *);
308
ZEND_API unary_op_type get_unary_op(int opcode);
Apr 7, 1999
309
ZEND_API void *get_binary_op(int opcode);
310
311
void zend_do_while_cond(znode *expr, znode *close_bracket_token TSRMLS_DC);
312
void zend_do_while_end(znode *while_token, znode *close_bracket_token TSRMLS_DC);
313
void zend_do_do_while_begin(TSRMLS_D);
314
void zend_do_do_while_end(znode *do_token, znode *expr_open_bracket, znode *expr TSRMLS_DC);
Apr 7, 1999
315
316
317
void zend_do_if_cond(znode *cond, znode *closing_bracket_token TSRMLS_DC);
318
void zend_do_if_after_statement(znode *closing_bracket_token, unsigned char initialize TSRMLS_DC);
319
void zend_do_if_end(TSRMLS_D);
Apr 7, 1999
320
321
void zend_do_for_cond(znode *expr, znode *second_semicolon_token TSRMLS_DC);
322
void zend_do_for_before_statement(znode *cond_start, znode *second_semicolon_token TSRMLS_DC);
323
void zend_do_for_end(znode *second_semicolon_token TSRMLS_DC);
Apr 7, 1999
324
Harald Radi
Apr 23, 2002
325
void zend_do_pre_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC);
326
void zend_do_post_incdec(znode *result, znode *op1, zend_uchar op TSRMLS_DC);
Apr 7, 1999
327
328
void zend_do_begin_variable_parse(TSRMLS_D);
329
void zend_do_end_variable_parse(int type, int arg_offset TSRMLS_DC);
Apr 7, 1999
330
331
void zend_check_writable_variable(znode *variable);
332
333
void zend_do_free(znode *op1 TSRMLS_DC);
Apr 7, 1999
334
335
void zend_do_init_string(znode *result TSRMLS_DC);
336
void zend_do_add_char(znode *result, znode *op1, znode *op2 TSRMLS_DC);
337
void zend_do_add_string(znode *result, znode *op1, znode *op2 TSRMLS_DC);
338
void zend_do_add_variable(znode *result, znode *op1, znode *op2 TSRMLS_DC);
Apr 7, 1999
339
340
int zend_do_verify_access_types(znode *current_access_type, znode *new_modifier);
341
void zend_do_begin_function_declaration(znode *function_token, znode *function_name, int is_method, int return_reference, znode *fn_flags_znode TSRMLS_DC);
342
void zend_do_end_function_declaration(znode *function_token TSRMLS_DC);
343
void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, znode *varname, zend_bool pass_by_reference TSRMLS_DC);
344
int zend_do_begin_function_call(znode *function_name TSRMLS_DC);
345
void zend_do_begin_method_call(znode *left_bracket TSRMLS_DC);
346
void zend_do_begin_dynamic_function_call(znode *function_name TSRMLS_DC);
347
void zend_do_fetch_class(znode *result, znode *class_name TSRMLS_DC);
348
void zend_do_fetch_class_name(znode *result, znode *class_entry, znode *class_name, zend_bool case_sensitive TSRMLS_DC);
349
void zend_do_begin_class_member_function_call(TSRMLS_D);
350
void zend_do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall TSRMLS_DC);
351
void zend_do_return(znode *expr, int do_end_vparse TSRMLS_DC);
353
void zend_do_try(znode *try_token TSRMLS_DC);
354
void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var, zend_bool first_catch TSRMLS_DC);
355
void zend_do_end_catch(znode *try_token TSRMLS_DC);
356
void zend_do_throw(znode *expr TSRMLS_DC);
358
ZEND_API int do_bind_function(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time);
359
ZEND_API zend_class_entry *do_bind_class(zend_op *opline, HashTable *function_table, HashTable *class_table TSRMLS_DC);
360
ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *function_table, HashTable *class_table, zend_class_entry *parent_ce TSRMLS_DC);
361
ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, zend_class_entry *ce2);
362
ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry *iface);
363
void zend_do_implements_interface(znode *interface_znode TSRMLS_DC);
365
void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce);
366
void zend_do_early_binding(TSRMLS_D);
Apr 7, 1999
367
Harald Radi
Apr 23, 2002
368
void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC);
Apr 7, 1999
369
370
371
void zend_do_boolean_or_begin(znode *expr1, znode *op_token TSRMLS_DC);
372
void zend_do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC);
373
void zend_do_boolean_and_begin(znode *expr1, znode *op_token TSRMLS_DC);
374
void zend_do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token TSRMLS_DC);
Apr 7, 1999
375
Harald Radi
Apr 23, 2002
376
void zend_do_brk_cont(zend_uchar op, znode *expr TSRMLS_DC);
Apr 7, 1999
377
378
void zend_do_switch_cond(znode *cond TSRMLS_DC);
379
void zend_do_switch_end(znode *case_list TSRMLS_DC);
380
void zend_do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr TSRMLS_DC);
381
void zend_do_case_after_statement(znode *result, znode *case_token TSRMLS_DC);
382
void zend_do_default_before_statement(znode *case_list, znode *default_token TSRMLS_DC);
Apr 7, 1999
383
384
void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znode *parent_class_name TSRMLS_DC);
385
void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRMLS_DC);
386
void zend_do_declare_property(znode *var_name, znode *value, zend_uint access_type TSRMLS_DC);
387
void zend_do_declare_implicit_property(TSRMLS_D);
388
void zend_do_declare_class_constant(znode *var_name, znode *value TSRMLS_DC);
Apr 7, 1999
389
390
void zend_do_fetch_property(znode *result, znode *object, znode *property TSRMLS_DC);
Apr 7, 1999
391
392
393
void zend_do_push_object(znode *object TSRMLS_DC);
394
void zend_do_pop_object(znode *object TSRMLS_DC);
Apr 7, 1999
395
396
397
void zend_do_begin_new_object(znode *new_token, znode *class_type TSRMLS_DC);
398
void zend_do_end_new_object(znode *result, znode *new_token, znode *argument_list TSRMLS_DC);
Apr 7, 1999
399
400
void zend_do_fetch_constant(znode *result, znode *constant_container, znode *constant_name, int mode TSRMLS_DC);
Apr 7, 1999
401
402
void zend_do_shell_exec(znode *result, znode *cmd TSRMLS_DC);
Apr 7, 1999
403
Harald Radi
Apr 23, 2002
404
void zend_do_init_array(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC);
405
void zend_do_add_array_element(znode *result, znode *expr, znode *offset, zend_bool is_ref TSRMLS_DC);
406
void zend_do_add_static_array_element(znode *result, znode *offset, znode *expr);
407
void zend_do_list_init(TSRMLS_D);
408
void zend_do_list_end(znode *result, znode *expr TSRMLS_DC);
409
void zend_do_add_list_element(znode *element TSRMLS_DC);
410
void zend_do_new_list_begin(TSRMLS_D);
411
void zend_do_new_list_end(TSRMLS_D);
Apr 7, 1999
412
413
void zend_do_cast(znode *result, znode *expr, int type TSRMLS_DC);
414
void zend_do_include_or_eval(int type, znode *result, znode *op1 TSRMLS_DC);
Apr 7, 1999
415
416
void zend_do_unset(znode *variable TSRMLS_DC);
417
void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC);
Apr 7, 1999
418
419
void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC);
421
void zend_do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token, int variable TSRMLS_DC);
422
void zend_do_foreach_cont(znode *value, znode *key, znode *as_token, znode *foreach_token TSRMLS_DC);
423
void zend_do_foreach_end(znode *foreach_token, znode *open_brackets_token TSRMLS_DC);
Apr 7, 1999
424
425
void zend_do_declare_begin(TSRMLS_D);
426
void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC);
427
void zend_do_declare_end(znode *declare_token TSRMLS_DC);
429
void zend_do_end_heredoc(TSRMLS_D);
Apr 7, 1999
430
431
void zend_do_exit(znode *result, znode *message TSRMLS_DC);
Apr 7, 1999
432
433
void zend_do_begin_silence(znode *strudel_token TSRMLS_DC);
434
void zend_do_end_silence(znode *strudel_token TSRMLS_DC);
Apr 7, 1999
435
436
void zend_do_begin_qm_op(znode *cond, znode *qm_token TSRMLS_DC);
437
void zend_do_qm_true(znode *true_value, znode *qm_token, znode *colon_token TSRMLS_DC);
438
void zend_do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token TSRMLS_DC);
Apr 7, 1999
439
440
void zend_do_extended_info(TSRMLS_D);
441
void zend_do_extended_fcall_begin(TSRMLS_D);
442
void zend_do_extended_fcall_end(TSRMLS_D);
Apr 7, 1999
443
444
void zend_do_ticks(TSRMLS_D);
446
void zend_do_abstract_method(znode *function_name, znode *modifiers, znode *body TSRMLS_DC);
Jun 13, 2000
448
ZEND_API void function_add_ref(zend_function *function);
450
#define INITIAL_OP_ARRAY_SIZE 64
451
Apr 7, 1999
452
453
/* helper functions in zend_language_scanner.l */
454
ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSRMLS_DC);
455
ZEND_API zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC);
456
ZEND_API zend_op_array *compile_filename(int type, zval *filename TSRMLS_DC);
Aug 31, 2001
457
ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...);
458
ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC);
Harald Radi
Apr 23, 2002
459
ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size TSRMLS_DC);
460
ZEND_API void destroy_op_array(zend_op_array *op_array TSRMLS_DC);
461
ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle TSRMLS_DC);
462
ZEND_API void zend_file_handle_dtor(zend_file_handle *fh);
463
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC);
464
ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC);
Apr 7, 1999
465
466
ZEND_API void destroy_zend_function(zend_function *function TSRMLS_DC);
467
ZEND_API void destroy_zend_class(zend_class_entry **pce);
468
void zend_class_add_ref(zend_class_entry **ce);
470
void mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal);
471
void unmangle_property_name(char *mangled_property, char **prop_name, char **class_name);
473
#define ZEND_FUNCTION_DTOR (void (*)(void *)) destroy_zend_function
474
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
476
zend_op *get_next_op(zend_op_array *op_array TSRMLS_DC);
477
void init_op(zend_op *op TSRMLS_DC);
Apr 7, 1999
478
int get_next_op_number(zend_op_array *op_array);
479
int print_class(zend_class_entry *class_entry TSRMLS_DC);
Apr 7, 1999
480
void print_op_array(zend_op_array *op_array, int optimizations);
481
int pass_two(zend_op_array *op_array TSRMLS_DC);
Apr 7, 1999
482
zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
483
ZEND_API zend_bool zend_is_compiling(TSRMLS_D);
484
ZEND_API char *zend_make_compiled_string_description(char *name TSRMLS_DC);
Feb 16, 2003
485
void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers TSRMLS_DC);
486
int zend_get_class_fetch_type(char *class_name, uint class_name_len);
488
typedef zend_bool (*zend_auto_global_callback)(char *name, uint name_len TSRMLS_DC);
489
typedef struct _zend_auto_global {
490
char *name;
491
uint name_len;
492
zend_auto_global_callback auto_global_callback;
493
zend_bool armed;
494
} zend_auto_global;
Apr 7, 1999
495
496
void zend_auto_global_dtor(zend_auto_global *auto_global);
497
ZEND_API int zend_register_auto_global(char *name, uint name_len, zend_auto_global_callback auto_global_callback TSRMLS_DC);
498
ZEND_API zend_bool zend_is_auto_global(char *name, uint name_len TSRMLS_DC);
500
int zendlex(znode *zendlval TSRMLS_DC);
Apr 7, 1999
501
Apr 7, 1999
503
#define ZEND_NOP 0
504
505
#define ZEND_ADD 1
506
#define ZEND_SUB 2
507
#define ZEND_MUL 3
508
#define ZEND_DIV 4
509
#define ZEND_MOD 5
510
#define ZEND_SL 6
511
#define ZEND_SR 7
512
#define ZEND_CONCAT 8
513
#define ZEND_BW_OR 9
514
#define ZEND_BW_AND 10
515
#define ZEND_BW_XOR 11
516
#define ZEND_BW_NOT 12
517
#define ZEND_BOOL_NOT 13
518
#define ZEND_BOOL_XOR 14
519
#define ZEND_IS_IDENTICAL 15
520
#define ZEND_IS_NOT_IDENTICAL 16
521
#define ZEND_IS_EQUAL 17
522
#define ZEND_IS_NOT_EQUAL 18
523
#define ZEND_IS_SMALLER 19
524
#define ZEND_IS_SMALLER_OR_EQUAL 20
525
#define ZEND_CAST 21
526
#define ZEND_QM_ASSIGN 22
527
528
#define ZEND_ASSIGN_ADD 23
529
#define ZEND_ASSIGN_SUB 24
530
#define ZEND_ASSIGN_MUL 25
531
#define ZEND_ASSIGN_DIV 26
532
#define ZEND_ASSIGN_MOD 27
533
#define ZEND_ASSIGN_SL 28
534
#define ZEND_ASSIGN_SR 29
535
#define ZEND_ASSIGN_CONCAT 30
536
#define ZEND_ASSIGN_BW_OR 31
537
#define ZEND_ASSIGN_BW_AND 32
538
#define ZEND_ASSIGN_BW_XOR 33
Apr 7, 1999
539
540
#define ZEND_PRE_INC 34
541
#define ZEND_PRE_DEC 35
542
#define ZEND_POST_INC 36
543
#define ZEND_POST_DEC 37
544
545
#define ZEND_ASSIGN 38
546
#define ZEND_ASSIGN_REF 39
547
548
#define ZEND_ECHO 40
549
#define ZEND_PRINT 41
550
551
#define ZEND_JMP 42
552
#define ZEND_JMPZ 43
553
#define ZEND_JMPNZ 44
554
#define ZEND_JMPZNZ 45
555
#define ZEND_JMPZ_EX 46
556
#define ZEND_JMPNZ_EX 47
557
#define ZEND_CASE 48
558
#define ZEND_SWITCH_FREE 49
559
#define ZEND_BRK 50
560
#define ZEND_CONT 51
561
#define ZEND_BOOL 52
562
563
#define ZEND_INIT_STRING 53
564
#define ZEND_ADD_CHAR 54
565
#define ZEND_ADD_STRING 55
566
#define ZEND_ADD_VAR 56
567
568
#define ZEND_BEGIN_SILENCE 57
569
#define ZEND_END_SILENCE 58
570
571
#define ZEND_INIT_FCALL_BY_NAME 59
572
#define ZEND_DO_FCALL 60
573
#define ZEND_DO_FCALL_BY_NAME 61
574
#define ZEND_RETURN 62
575
576
#define ZEND_RECV 63
577
#define ZEND_RECV_INIT 64
Apr 7, 1999
578
579
#define ZEND_SEND_VAL 65
580
#define ZEND_SEND_VAR 66
581
#define ZEND_SEND_REF 67
Apr 7, 1999
582
583
#define ZEND_NEW 68
584
#define ZEND_JMP_NO_CTOR 69
585
#define ZEND_FREE 70
Apr 7, 1999
586
587
#define ZEND_INIT_ARRAY 71
588
#define ZEND_ADD_ARRAY_ELEMENT 72
Apr 7, 1999
589
590
#define ZEND_INCLUDE_OR_EVAL 73
Apr 7, 1999
591
592
#define ZEND_UNSET_VAR 74
Jul 30, 2003
593
#define ZEND_UNSET_DIM_OBJ 75
Apr 7, 1999
594
595
#define ZEND_FE_RESET 77
596
#define ZEND_FE_FETCH 78
Apr 7, 1999
597
598
#define ZEND_EXIT 79
Apr 7, 1999
599
600
601
/* the following 18 opcodes are 6 groups of 3 opcodes each, and must
Apr 7, 1999
602
* remain in that order!
603
*/
604
#define ZEND_FETCH_R 80
605
#define ZEND_FETCH_DIM_R 81
606
#define ZEND_FETCH_OBJ_R 82
607
#define ZEND_FETCH_W 83
608
#define ZEND_FETCH_DIM_W 84
609
#define ZEND_FETCH_OBJ_W 85
610
#define ZEND_FETCH_RW 86
611
#define ZEND_FETCH_DIM_RW 87
612
#define ZEND_FETCH_OBJ_RW 88
613
#define ZEND_FETCH_IS 89
614
#define ZEND_FETCH_DIM_IS 90
615
#define ZEND_FETCH_OBJ_IS 91
616
#define ZEND_FETCH_FUNC_ARG 92
617
#define ZEND_FETCH_DIM_FUNC_ARG 93
618
#define ZEND_FETCH_OBJ_FUNC_ARG 94
619
#define ZEND_FETCH_UNSET 95
620
#define ZEND_FETCH_DIM_UNSET 96
621
#define ZEND_FETCH_OBJ_UNSET 97
622
623
#define ZEND_FETCH_DIM_TMP_VAR 98
624
#define ZEND_FETCH_CONSTANT 99
625
627
628
#define ZEND_EXT_STMT 101
629
#define ZEND_EXT_FCALL_BEGIN 102
630
#define ZEND_EXT_FCALL_END 103
631
#define ZEND_EXT_NOP 104
632
633
#define ZEND_TICKS 105
635
#define ZEND_SEND_VAR_NO_REF 106
636
637
#define ZEND_CATCH 107
638
#define ZEND_THROW 108
639
640
#define ZEND_FETCH_CLASS 109
641
642
#define ZEND_CLONE 110
644
#define ZEND_INIT_CTOR_CALL 111
645
#define ZEND_INIT_METHOD_CALL 112
646
#define ZEND_INIT_STATIC_METHOD_CALL 113
648
#define ZEND_ISSET_ISEMPTY_VAR 114
649
#define ZEND_ISSET_ISEMPTY_DIM_OBJ 115
651
#define ZEND_IMPORT_FUNCTION 116
652
#define ZEND_IMPORT_CLASS 117
653
#define ZEND_IMPORT_CONST 118
654
655
#define ZEND_PRE_INC_OBJ 132
656
#define ZEND_PRE_DEC_OBJ 133
657
#define ZEND_POST_INC_OBJ 134
658
#define ZEND_POST_DEC_OBJ 135
659
660
#define ZEND_ASSIGN_OBJ 136
661
#define ZEND_OP_DATA 137
665
#define ZEND_DECLARE_CLASS 139
666
#define ZEND_DECLARE_INHERITED_CLASS 140
667
#define ZEND_DECLARE_FUNCTION 141
668
669
#define ZEND_RAISE_ABSTRACT_ERROR 142
670
673
#define ZEND_ADD_INTERFACE 144
674
#define ZEND_VERIFY_ABSTRACT_CLASS 146
Apr 7, 1999
678
/* end of block */
Apr 7, 1999
680
681
682
683
684
/* global/local fetches */
685
#define ZEND_FETCH_GLOBAL 0
686
#define ZEND_FETCH_LOCAL 1
687
#define ZEND_FETCH_STATIC 2
688
#define ZEND_FETCH_STATIC_MEMBER 3
Apr 7, 1999
689
Jul 30, 2003
690
691
/* obj/dim unsets */
692
#define ZEND_UNSET_DIM 1
693
#define ZEND_UNSET_OBJ 2
694
695
/* class fetches */
696
#define ZEND_FETCH_CLASS_DEFAULT 0
697
#define ZEND_FETCH_CLASS_SELF 1
698
#define ZEND_FETCH_CLASS_PARENT 2
699
#define ZEND_FETCH_CLASS_MAIN 3
700
#define ZEND_FETCH_CLASS_GLOBAL 4
701
#define ZEND_FETCH_CLASS_AUTO 5
704
/* variable parsing type (compile-time) */
705
#define ZEND_PARSED_MEMBER (1<<0)
706
#define ZEND_PARSED_METHOD_CALL (1<<1)
707
#define ZEND_PARSED_STATIC_MEMBER (1<<2)
708
#define ZEND_PARSED_FUNCTION_CALL (1<<3)
709
#define ZEND_PARSED_VARIABLE (1<<4)
710
#define ZEND_PARSED_REFERENCE_VARIABLE (1<<5)
713
/* unset types */
714
#define ZEND_UNSET_REG 0
715
Apr 7, 1999
716
/* var status for backpatching */
717
#define BP_VAR_R 0
718
#define BP_VAR_W 1
719
#define BP_VAR_RW 2
720
#define BP_VAR_IS 3
721
#define BP_VAR_NA 4 /* if not applicable */
722
#define BP_VAR_FUNC_ARG 5