Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 1013 lines (786 sloc) 32.187 kb
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
fc33f52 @laruence bump year
laruence authored
5 | Copyright (c) 1998-2015 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, |
493f39d - MFH: Fix bug #37212 (Access to protected property of common base cl…
Marcus Boerger authored
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
9 | available through the world-wide-web at the following url: |
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
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
20 /* $Id$ */
b5b1117 @zsuraski License update
zsuraski authored
21
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
22 #ifndef ZEND_COMPILE_H
23 #define ZEND_COMPILE_H
573b460 @andigutmans Zend Library
andigutmans authored
24
25 #include "zend.h"
2361745 @bwoebi Working commit for constant scalar expressions (with constants).
bwoebi authored
26 #include "zend_ast.h"
fa76f0c @zsuraski Compile fix
zsuraski authored
27
009025e * header file cleanup
Stig S. Bakken authored
28 #ifdef HAVE_STDARG_H
29 # include <stdarg.h>
fa76f0c @zsuraski Compile fix
zsuraski authored
30 #endif
31
573b460 @andigutmans Zend Library
andigutmans authored
32 #include "zend_llist.h"
33
34 #define DEBUG_ZEND 0
fcaf734 @andigutmans - Don't support interactive mode when thread safe.
andigutmans authored
35
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
36 #define SET_UNUSED(op) op ## _type = IS_UNUSED
573b460 @andigutmans Zend Library
andigutmans authored
37
c8576c5 @morrisonlevi Implement return types
morrisonlevi authored
38 #define MAKE_NOP(opline) do { \
39 opline->opcode = ZEND_NOP; \
40 memset(&opline->result, 0, sizeof(opline->result)); \
41 memset(&opline->op1, 0, sizeof(opline->op1)); \
42 memset(&opline->op2, 0, sizeof(opline->op2)); \
43 opline->result_type = opline->op1_type = opline->op2_type = IS_UNUSED; \
44 } while (0)
45
38c4125 @nikic Cleanup dead/duplicate code
nikic authored
46 #define RESET_DOC_COMMENT() do { \
47 if (CG(doc_comment)) { \
6db293d @nikic Merge remote-tracking branch 'php-src/master' into ast
nikic authored
48 zend_string_release(CG(doc_comment)); \
38c4125 @nikic Cleanup dead/duplicate code
nikic authored
49 CG(doc_comment) = NULL; \
50 } \
51 } while (0)
bdd3b60 Implement a different way to catch documentation comments.
Andrei Zmievski authored
52
573b460 @andigutmans Zend Library
andigutmans authored
53 typedef struct _zend_op_array zend_op_array;
8010931 @andigutmans - Improve performance of part of the jmps. More to follow.
andigutmans authored
54 typedef struct _zend_op zend_op;
573b460 @andigutmans Zend Library
andigutmans authored
55
0381c1b @nikic Fixed bug #69388
nikic authored
56 /* On 64-bit systems less optimal, but more compact VM code leads to better
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
57 * performance. So on 32-bit systems we use absolute addresses for jump
58 * targets and constants, but on 64-bit systems realtive 32-bit offsets */
59 #if SIZEOF_SIZE_T == 4
60 # define ZEND_USE_ABS_JMP_ADDR 1
61 # define ZEND_USE_ABS_CONST_ADDR 1
62 # define ZEND_EX_USE_LITERALS 0
63 # define ZEND_EX_USE_RUN_TIME_CACHE 1
64 #else
65 # define ZEND_USE_ABS_JMP_ADDR 0
66 # define ZEND_USE_ABS_CONST_ADDR 0
67 # define ZEND_EX_USE_LITERALS 1
68 # define ZEND_EX_USE_RUN_TIME_CACHE 1
69 #endif
70
24e0b99 @igorw Merge remote-tracking branch 'upstream/PHP-5.6' into use-function
igorw authored
71 typedef union _znode_op {
6f9f0bf @weltling master renames phase 2
weltling authored
72 uint32_t constant;
73 uint32_t var;
74 uint32_t num;
75 uint32_t opline_num; /* Needs to be signed */
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
76 #if ZEND_USE_ABS_JMP_ADDR
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
77 zend_op *jmp_addr;
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
78 #else
79 uint32_t jmp_offset;
80 #endif
81 #if ZEND_USE_ABS_CONST_ADDR
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
82 zval *zv;
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
83 #endif
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
84 } znode_op;
85
24e0b99 @igorw Merge remote-tracking branch 'upstream/PHP-5.6' into use-function
igorw authored
86 typedef struct _znode { /* used only during compilation */
97fe15d @dstogov Fix "forech" statemt behaviour according to https://wiki.php.net/rfc/…
dstogov authored
87 zend_uchar op_type;
88 zend_uchar flag;
573b460 @andigutmans Zend Library
andigutmans authored
89 union {
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
90 znode_op op;
91 zval constant; /* replaced by literal/zv */
573b460 @andigutmans Zend Library
andigutmans authored
92 } u;
93 } znode;
94
258a733 @nikic AST-based compiler: Stage 1
nikic authored
95 /* Temporarily defined here, to avoid header ordering issues */
96 typedef struct _zend_ast_znode {
55ab55c @nikic Add ability to specify additional attr in AST
nikic authored
97 zend_ast_kind kind;
98 zend_ast_attr attr;
6db293d @nikic Merge remote-tracking branch 'php-src/master' into ast
nikic authored
99 uint32_t lineno;
258a733 @nikic AST-based compiler: Stage 1
nikic authored
100 znode node;
101 } zend_ast_znode;
102 ZEND_API zend_ast *zend_ast_create_znode(znode *node);
103
5185baa @dstogov Changed "inline" into "zend_always_inline"
dstogov authored
104 static zend_always_inline znode *zend_ast_get_znode(zend_ast *ast) {
258a733 @nikic AST-based compiler: Stage 1
nikic authored
105 return &((zend_ast_znode *) ast)->node;
106 }
107
d2607a0 @nikic Move more stuff to file_context
nikic authored
108 typedef struct _zend_declarables {
109 zend_long ticks;
110 } zend_declarables;
111
112 /* Compilation context that is different for each op array. */
113 typedef struct _zend_oparray_context {
114 uint32_t opcodes_size;
115 int vars_size;
116 int literals_size;
117 int current_brk_cont;
118 int backpatch_count;
119 int in_finally;
120 uint32_t fast_call_var;
121 HashTable *labels;
122 } zend_oparray_context;
123
124 /* Compilation context that is different for each file, but shared between op arrays. */
125 typedef struct _zend_file_context {
126 zend_declarables declarables;
127 znode implementing_class;
128
129 zend_string *current_namespace;
130 zend_bool in_namespace;
131 zend_bool has_bracketed_namespaces;
132
133 HashTable *imports;
134 HashTable *imports_function;
135 HashTable *imports_const;
136 } zend_file_context;
137
bea85f5 @nikic Use more specific parser stack nodes
nikic authored
138 typedef union _zend_parser_stack_elem {
139 zend_ast *ast;
140 zend_string *str;
141 zend_ulong num;
142 } zend_parser_stack_elem;
143
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
144 void zend_compile_top_stmt(zend_ast *ast);
145 void zend_compile_stmt(zend_ast *ast);
146 void zend_compile_expr(znode *node, zend_ast *ast);
147 void zend_compile_var(znode *node, zend_ast *ast, uint32_t type);
148 void zend_eval_const_expr(zend_ast **ast_ptr);
149 void zend_const_expr_to_zval(zval *result, zend_ast *ast);
258a733 @nikic AST-based compiler: Stage 1
nikic authored
150
6289f7e @dstogov Executor cleanup: fix GOTO and SWITCH VMs, remove aility to build add…
dstogov authored
151 typedef int (*user_opcode_handler_t) (zend_execute_data *execute_data);
573b460 @andigutmans Zend Library
andigutmans authored
152
8010931 @andigutmans - Improve performance of part of the jmps. More to follow.
andigutmans authored
153 struct _zend_op {
6289f7e @dstogov Executor cleanup: fix GOTO and SWITCH VMs, remove aility to build add…
dstogov authored
154 const void *handler;
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
155 znode_op op1;
156 znode_op op2;
157 znode_op result;
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
158 uint32_t extended_value;
159 uint32_t lineno;
6f9bfe5 @andigutmans - Shift around zend_op members
andigutmans authored
160 zend_uchar opcode;
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
161 zend_uchar op1_type;
162 zend_uchar op2_type;
163 zend_uchar result_type;
8010931 @andigutmans - Improve performance of part of the jmps. More to follow.
andigutmans authored
164 };
573b460 @andigutmans Zend Library
andigutmans authored
165
166
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
167 typedef struct _zend_brk_cont_element {
cd6537e Fixed bugs #34065 and #38623 (throw in foreach/switch causes memory l…
Dmitry Stogov authored
168 int start;
573b460 @andigutmans Zend Library
andigutmans authored
169 int cont;
170 int brk;
171 int parent;
172 } zend_brk_cont_element;
173
f66f55e @felipensp MFH: Implemented "jump label" operator (limited "goto")
felipensp authored
174 typedef struct _zend_label {
175 int brk_cont;
6f9f0bf @weltling master renames phase 2
weltling authored
176 uint32_t opline_num;
f66f55e @felipensp MFH: Implemented "jump label" operator (limited "goto")
felipensp authored
177 } zend_label;
573b460 @andigutmans Zend Library
andigutmans authored
178
9e60cb5 @zsuraski Rewrote exception support. Fixes a few limitations and bugs in the old
zsuraski authored
179 typedef struct _zend_try_catch_element {
6f9f0bf @weltling master renames phase 2
weltling authored
180 uint32_t try_op;
181 uint32_t catch_op; /* ketchup! */
182 uint32_t finally_op;
183 uint32_t finally_end;
9e60cb5 @zsuraski Rewrote exception support. Fixes a few limitations and bugs in the old
zsuraski authored
184 } zend_try_catch_element;
185
50ee116 Clearify the different method/class flags (as discussed with Andi).
Marcus Boerger authored
186 /* method flags (types) */
0338111 @zsuraski Require abstract classes to be explicitly declared 'abstract', in ord…
zsuraski authored
187 #define ZEND_ACC_STATIC 0x01
188 #define ZEND_ACC_ABSTRACT 0x02
189 #define ZEND_ACC_FINAL 0x04
50ee116 Clearify the different method/class flags (as discussed with Andi).
Marcus Boerger authored
190 #define ZEND_ACC_IMPLEMENTED_ABSTRACT 0x08
6020ffd Simplify detection of methods that must be called dynamic (with object)
Marcus Boerger authored
191
50ee116 Clearify the different method/class flags (as discussed with Andi).
Marcus Boerger authored
192 /* class flags (types) */
193 /* ZEND_ACC_IMPLICIT_ABSTRACT_CLASS is used for abstract classes (since it is set by any abstract method even interfaces MAY have it set, too). */
194 /* ZEND_ACC_EXPLICIT_ABSTRACT_CLASS denotes that a class was explicitly defined as abstract by using the keyword. */
195 #define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS 0x10
196 #define ZEND_ACC_EXPLICIT_ABSTRACT_CLASS 0x20
8c81d80 Made ZEND_ACC_TRAIT a saner value
Guilherme Blanco authored
197 #define ZEND_ACC_INTERFACE 0x40
198 #define ZEND_ACC_TRAIT 0x80
49608e0 @krakjoe Rebase Joe's anon classes implementation
krakjoe authored
199 #define ZEND_ACC_ANON_CLASS 0x100
200 #define ZEND_ACC_ANON_BOUND 0x200
e8214a3 @andigutmans - Commit Marcus' cleanup of abstract and static inheritance and improve
andigutmans authored
201
50ee116 Clearify the different method/class flags (as discussed with Andi).
Marcus Boerger authored
202 /* method flags (visibility) */
32b100e @zsuraski - Allow variables to have both 'static' modifier and an access level.
zsuraski authored
203 /* The order of those must be kept - public < protected < private */
0338111 @zsuraski Require abstract classes to be explicitly declared 'abstract', in ord…
zsuraski authored
204 #define ZEND_ACC_PUBLIC 0x100
205 #define ZEND_ACC_PROTECTED 0x200
206 #define ZEND_ACC_PRIVATE 0x400
dc5c790 @zsuraski Treat the absence of an access type just as if 'public' was supplied
zsuraski authored
207 #define ZEND_ACC_PPP_MASK (ZEND_ACC_PUBLIC | ZEND_ACC_PROTECTED | ZEND_ACC_PRIVATE)
e062dff @zsuraski - Implement public/protected/private methods.
zsuraski authored
208
0338111 @zsuraski Require abstract classes to be explicitly declared 'abstract', in ord…
zsuraski authored
209 #define ZEND_ACC_CHANGED 0x800
210 #define ZEND_ACC_IMPLICIT_PUBLIC 0x1000
77208ec @zsuraski Fix incorrect linkage of access-levels, when using private methods
zsuraski authored
211
50ee116 Clearify the different method/class flags (as discussed with Andi).
Marcus Boerger authored
212 /* method flags (special method detection) */
fbda310 - Flag ctor/dtor methods
Marcus Boerger authored
213 #define ZEND_ACC_CTOR 0x2000
7c2e02d Disallow static declaration of clone
Marcus Boerger authored
214 #define ZEND_ACC_DTOR 0x4000
215 #define ZEND_ACC_CLONE 0x8000
1c2512d - Add fn_flag ZEND_ACC_ALIAS
Marcus Boerger authored
216
50ee116 Clearify the different method/class flags (as discussed with Andi).
Marcus Boerger authored
217 /* method flag (bc only), any method that has this flag can be used statically and non statically. */
218 #define ZEND_ACC_ALLOW_STATIC 0x10000
219
2cb5215 @smalyshev MF50: fix #29689 and more private property problems
smalyshev authored
220 /* shadow of parent's private method/property */
221 #define ZEND_ACC_SHADOW 0x20000
222
941b065 - MFH: Function deprecation flag
Marcus Boerger authored
223 /* deprecation flag */
224 #define ZEND_ACC_DEPRECATED 0x40000
225
0f2247a Fixed bug #44414 (Incomplete reporting about abstract methods)
Dmitry Stogov authored
226 /* class implement interface(s) flag */
227 #define ZEND_ACC_IMPLEMENT_INTERFACES 0x80000
cd6415f Implemented Traits for PHP as proposed in the RFC [TRAITS]
Stefan Marr authored
228 #define ZEND_ACC_IMPLEMENT_TRAITS 0x400000
0f2247a Fixed bug #44414 (Incomplete reporting about abstract methods)
Dmitry Stogov authored
229
f2df6a4 - Improved memory usage
Dmitry Stogov authored
230 /* class constants updated */
231 #define ZEND_ACC_CONSTANTS_UPDATED 0x100000
232
1a1178a eliminated unnecessary iterations during request startup/shutdown
Dmitry Stogov authored
233 /* user class has methods with static variables */
234 #define ZEND_HAS_STATIC_IN_METHODS 0x800000
235
236
d5ef2f4 Added support for lambda functions and closures
Dmitry Stogov authored
237 #define ZEND_ACC_CLOSURE 0x100000
252f623 @nikic Add flag for generator functions
nikic authored
238 #define ZEND_ACC_GENERATOR 0x800000
d5ef2f4 Added support for lambda functions and closures
Dmitry Stogov authored
239
5e8133f @dstogov Squashed commit of the following:
dstogov authored
240 /* call through user function trampoline. e.g. __call, __callstatic */
241 #define ZEND_ACC_CALL_VIA_TRAMPOLINE 0x200000
242
243 /* call through internal function handler. e.g. Closure::invoke() */
244 #define ZEND_ACC_CALL_VIA_HANDLER ZEND_ACC_CALL_VIA_TRAMPOLINE
0f2247a Fixed bug #44414 (Incomplete reporting about abstract methods)
Dmitry Stogov authored
245
cacf363 Fixed bug #60104 (Segmentation Fault in pdo_sqlite when using sqliteC…
Dmitry Stogov authored
246 /* disable inline caching */
247 #define ZEND_ACC_NEVER_CACHE 0x400000
248
0d7a638 @nikic Implement variadic function syntax
nikic authored
249 #define ZEND_ACC_VARIADIC 0x1000000
f2df6a4 - Improved memory usage
Dmitry Stogov authored
250
251 #define ZEND_ACC_RETURN_REFERENCE 0x4000000
252 #define ZEND_ACC_DONE_PASS_TWO 0x8000000
253
9e70d76 @dstogov Move zend_object->guards into additional slot of zend_object->propert…
dstogov authored
254 /* class has magic methods __get/__set/__unset/__isset that use guards */
255 #define ZEND_ACC_USE_GUARDS 0x1000000
256
57c1335 @dstogov Don't check argument types for internal functions without type hinting
dstogov authored
257 /* function has arguments with type hinting */
258 #define ZEND_ACC_HAS_TYPE_HINTS 0x10000000
259
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
260 /* op_array has finally blocks */
261 #define ZEND_ACC_HAS_FINALLY_BLOCK 0x20000000
262
7cef08c @dstogov Allocate copies of internal functions inherited in user classes at CG…
dstogov authored
263 /* internal function is allocated at arena */
264 #define ZEND_ACC_ARENA_ALLOCATED 0x20000000
265
c8576c5 @morrisonlevi Implement return types
morrisonlevi authored
266 /* Function has a return type hint (or class has such non-private function) */
267 #define ZEND_ACC_HAS_RETURN_TYPE 0x40000000
268
7044f9c @ircmaxell Refactor as to not use call info, but add the flag to the op_array.
ircmaxell authored
269 /* op_array uses strict mode types */
270 #define ZEND_ACC_STRICT_TYPES 0x80000000
271
6db293d @nikic Merge remote-tracking branch 'php-src/master' into ast
nikic authored
272 char *zend_visibility_string(uint32_t fn_flags);
471947b @zsuraski Reimplement PPP properties
zsuraski authored
273
274 typedef struct _zend_property_info {
7504137 @dstogov Improved object property access.
dstogov authored
275 uint32_t offset; /* property offset for object properties or
276 property index for static properties */
6f9f0bf @weltling master renames phase 2
weltling authored
277 uint32_t flags;
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
278 zend_string *name;
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
279 zend_string *doc_comment;
493f39d - MFH: Fix bug #37212 (Access to protected property of common base cl…
Marcus Boerger authored
280 zend_class_entry *ce;
471947b @zsuraski Reimplement PPP properties
zsuraski authored
281 } zend_property_info;
282
7504137 @dstogov Improved object property access.
dstogov authored
283 #define OBJ_PROP(obj, offset) \
284 ((zval*)((char*)(obj) + offset))
285 #define OBJ_PROP_NUM(obj, num) \
286 (&(obj)->properties_table[(num)])
287 #define OBJ_PROP_TO_OFFSET(num) \
288 ((uint32_t)(zend_uintptr_t)OBJ_PROP_NUM(((zend_object*)NULL), num))
289 #define OBJ_PROP_TO_NUM(offset) \
290 ((offset - OBJ_PROP_TO_OFFSET(0)) / sizeof(zval))
291
5dd427e @dstogov Use zend_string* for op_array->arg_info[]->name and op_array->arg_inf…
dstogov authored
292 /* arg_info for internal functions */
b7a7b1a @smalyshev trailing whitespace removal
smalyshev authored
293 typedef struct _zend_internal_arg_info {
5dd427e @dstogov Use zend_string* for op_array->arg_info[]->name and op_array->arg_inf…
dstogov authored
294 const char *name;
295 const char *class_name;
296 zend_uchar type_hint;
297 zend_uchar pass_by_reference;
298 zend_bool allow_null;
299 zend_bool is_variadic;
300 } zend_internal_arg_info;
301
302 /* arg_info for user functions */
f8bbafd @zsuraski ntroduce infrastructure for supplying information about arguments,
zsuraski authored
303 typedef struct _zend_arg_info {
5dd427e @dstogov Use zend_string* for op_array->arg_info[]->name and op_array->arg_inf…
dstogov authored
304 zend_string *name;
305 zend_string *class_name;
a09b713 Used more sutable type. Reduced memory usage.
Dmitry Stogov authored
306 zend_uchar type_hint;
0d7a638 @nikic Implement variadic function syntax
nikic authored
307 zend_uchar pass_by_reference;
f8bbafd @zsuraski ntroduce infrastructure for supplying information about arguments,
zsuraski authored
308 zend_bool allow_null;
0d7a638 @nikic Implement variadic function syntax
nikic authored
309 zend_bool is_variadic;
f8bbafd @zsuraski ntroduce infrastructure for supplying information about arguments,
zsuraski authored
310 } zend_arg_info;
311
5dd427e @dstogov Use zend_string* for op_array->arg_info[]->name and op_array->arg_inf…
dstogov authored
312 /* the following structure repeats the layout of zend_internal_arg_info,
24e0b99 @igorw Merge remote-tracking branch 'upstream/PHP-5.6' into use-function
igorw authored
313 * but its fields have different meaning. It's used as the first element of
f2df6a4 - Improved memory usage
Dmitry Stogov authored
314 * arg_info array to define properties of internal functions.
c8576c5 @morrisonlevi Implement return types
morrisonlevi authored
315 * It's also used for return type hinting.
f2df6a4 - Improved memory usage
Dmitry Stogov authored
316 */
317 typedef struct _zend_internal_function_info {
5dd427e @dstogov Use zend_string* for op_array->arg_info[]->name and op_array->arg_inf…
dstogov authored
318 zend_uintptr_t required_num_args;
c8576c5 @morrisonlevi Implement return types
morrisonlevi authored
319 const char *class_name;
320 zend_uchar type_hint;
f2df6a4 - Improved memory usage
Dmitry Stogov authored
321 zend_bool return_reference;
c8576c5 @morrisonlevi Implement return types
morrisonlevi authored
322 zend_bool allow_null;
0d7a638 @nikic Implement variadic function syntax
nikic authored
323 zend_bool _is_variadic;
f2df6a4 - Improved memory usage
Dmitry Stogov authored
324 } zend_internal_function_info;
325
573b460 @andigutmans Zend Library
andigutmans authored
326 struct _zend_op_array {
5097be3 @zsuraski Initial support for enforcing prototype of abstract/interface method …
zsuraski authored
327 /* Common elements */
328 zend_uchar type;
15a5f61 @dstogov Use fast method to check if first arguments should be passed by refer…
dstogov authored
329 zend_uchar arg_flags[3]; /* bitset of arg_info.pass_by_reference */
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
330 uint32_t fn_flags;
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
331 zend_string *function_name;
5097be3 @zsuraski Initial support for enforcing prototype of abstract/interface method …
zsuraski authored
332 zend_class_entry *scope;
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
333 zend_function *prototype;
6f9f0bf @weltling master renames phase 2
weltling authored
334 uint32_t num_args;
335 uint32_t required_num_args;
f8bbafd @zsuraski ntroduce infrastructure for supplying information about arguments,
zsuraski authored
336 zend_arg_info *arg_info;
5097be3 @zsuraski Initial support for enforcing prototype of abstract/interface method …
zsuraski authored
337 /* END of common elements */
573b460 @andigutmans Zend Library
andigutmans authored
338
6f9f0bf @weltling master renames phase 2
weltling authored
339 uint32_t *refcount;
573b460 @andigutmans Zend Library
andigutmans authored
340
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
341 uint32_t this_var;
342
6f9f0bf @weltling master renames phase 2
weltling authored
343 uint32_t last;
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
344 zend_op *opcodes;
573b460 @andigutmans Zend Library
andigutmans authored
345
f2df6a4 - Improved memory usage
Dmitry Stogov authored
346 int last_var;
6f9f0bf @weltling master renames phase 2
weltling authored
347 uint32_t T;
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
348 zend_string **vars;
573b460 @andigutmans Zend Library
andigutmans authored
349
f8f26de @felipensp Fix for segfault on 64bit platform
felipensp authored
350 int last_brk_cont;
9e60cb5 @zsuraski Rewrote exception support. Fixes a few limitations and bugs in the old
zsuraski authored
351 int last_try_catch;
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
352 zend_brk_cont_element *brk_cont_array;
353 zend_try_catch_element *try_catch_array;
9e60cb5 @zsuraski Rewrote exception support. Fixes a few limitations and bugs in the old
zsuraski authored
354
573b460 @andigutmans Zend Library
andigutmans authored
355 /* static variables support */
356 HashTable *static_variables;
357
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
358 zend_string *filename;
6f9f0bf @weltling master renames phase 2
weltling authored
359 uint32_t line_start;
360 uint32_t line_end;
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
361 zend_string *doc_comment;
6f9f0bf @weltling master renames phase 2
weltling authored
362 uint32_t early_binding; /* the linked list of delayed declarations */
c06692e @zsuraski The patch we promised - redesigned the compilation/execution API:
zsuraski authored
363
f2df6a4 - Improved memory usage
Dmitry Stogov authored
364 int last_literal;
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
365 zval *literals;
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
366
5f278e4 @dstogov Use cache_slot offsets instead of indexes (simplify run-time instruct…
dstogov authored
367 int cache_size;
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
368 void **run_time_cache;
c5237d8 Added caches to eliminate repeatable run-time bindings of functions, …
Dmitry Stogov authored
369
b5f5e9a @andigutmans - Optimize the execute stack a bit.
andigutmans authored
370 void *reserved[ZEND_MAX_RESERVED_RESOURCES];
573b460 @andigutmans Zend Library
andigutmans authored
371 };
372
373
e7e0f7d @zsuraski - Check return-by-reference bit when implementing interface prototypes
zsuraski authored
374 #define ZEND_RETURN_VALUE 0
375 #define ZEND_RETURN_REFERENCE 1
376
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
377 typedef struct _zend_internal_function {
5097be3 @zsuraski Initial support for enforcing prototype of abstract/interface method …
zsuraski authored
378 /* Common elements */
379 zend_uchar type;
15a5f61 @dstogov Use fast method to check if first arguments should be passed by refer…
dstogov authored
380 zend_uchar arg_flags[3]; /* bitset of arg_info.pass_by_reference */
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
381 uint32_t fn_flags;
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
382 zend_string* function_name;
5097be3 @zsuraski Initial support for enforcing prototype of abstract/interface method …
zsuraski authored
383 zend_class_entry *scope;
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
384 zend_function *prototype;
6f9f0bf @weltling master renames phase 2
weltling authored
385 uint32_t num_args;
386 uint32_t required_num_args;
5dd427e @dstogov Use zend_string* for op_array->arg_info[]->name and op_array->arg_inf…
dstogov authored
387 zend_internal_arg_info *arg_info;
5097be3 @zsuraski Initial support for enforcing prototype of abstract/interface method …
zsuraski authored
388 /* END of common elements */
573b460 @andigutmans Zend Library
andigutmans authored
389
390 void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
637a404 - MFH as discussed
Marcus Boerger authored
391 struct _zend_module_entry *module;
573b460 @andigutmans Zend Library
andigutmans authored
392 } zend_internal_function;
393
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
394 #define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name->val : "")
e8214a3 @andigutmans - Commit Marcus' cleanup of abstract and static inheritance and improve
andigutmans authored
395
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
396 union _zend_function {
e92f6f1 @andigutmans - define zend_uint and zend_uchar and use them in a few places
andigutmans authored
397 zend_uchar type; /* MUST be the first element of this struct! */
d1eea3d @andigutmans - Fix bug in nested try/catch's
andigutmans authored
398
573b460 @andigutmans Zend Library
andigutmans authored
399 struct {
e92f6f1 @andigutmans - define zend_uint and zend_uchar and use them in a few places
andigutmans authored
400 zend_uchar type; /* never used */
15a5f61 @dstogov Use fast method to check if first arguments should be passed by refer…
dstogov authored
401 zend_uchar arg_flags[3]; /* bitset of arg_info.pass_by_reference */
ee552b6 @dstogov Reorder fields for better nenory consumtion and data locality on 64-b…
dstogov authored
402 uint32_t fn_flags;
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
403 zend_string *function_name;
d1eea3d @andigutmans - Fix bug in nested try/catch's
andigutmans authored
404 zend_class_entry *scope;
5097be3 @zsuraski Initial support for enforcing prototype of abstract/interface method …
zsuraski authored
405 union _zend_function *prototype;
6f9f0bf @weltling master renames phase 2
weltling authored
406 uint32_t num_args;
407 uint32_t required_num_args;
f8bbafd @zsuraski ntroduce infrastructure for supplying information about arguments,
zsuraski authored
408 zend_arg_info *arg_info;
573b460 @andigutmans Zend Library
andigutmans authored
409 } common;
637a404 - MFH as discussed
Marcus Boerger authored
410
573b460 @andigutmans Zend Library
andigutmans authored
411 zend_op_array op_array;
412 zend_internal_function internal_function;
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
413 };
573b460 @andigutmans Zend Library
andigutmans authored
414
1da14c9 @dstogov Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" …
dstogov authored
415 typedef enum _zend_call_kind {
416 ZEND_CALL_NESTED_FUNCTION, /* stackless VM call to function */
417 ZEND_CALL_NESTED_CODE, /* stackless VM call to include/require/eval */
418 ZEND_CALL_TOP_FUNCTION, /* direct VM call to function from external C code */
419 ZEND_CALL_TOP_CODE /* direct VM call to "main" code from external C code */
420 } zend_call_kind;
ea2e1bb @dstogov Optimized zend_leave_helper()
dstogov authored
421
1327480 @andigutmans - Fix compile warning.
andigutmans authored
422 struct _zend_execute_data {
f2b0370 @dstogov Use 'const' qualifier for pointrs to code used at run-time (the code …
dstogov authored
423 const zend_op *opline; /* executed opline */
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
424 zend_execute_data *call; /* current call */
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
425 zval *return_value;
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
426 zend_function *func; /* executed op_array */
bd9a234 @dstogov Replaced EG(This) and EX(object) with EX(This).
dstogov authored
427 zval This;
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
428 #if ZEND_EX_USE_RUN_TIME_CACHE
429 void **run_time_cache;
430 #endif
431 #if ZEND_EX_USE_LITERALS
432 zval *literals;
433 #endif
75b5dc6 @dstogov Reorder fields for better alignment on both 32-bit and 64-bit systems
dstogov authored
434 zend_class_entry *called_scope;
65e2ed6 @dstogov Redesigned zend_execute_data layout now EX(object), EX(scope) and EX(…
dstogov authored
435 zend_execute_data *prev_execute_data;
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
436 zend_array *symbol_table;
1327480 @andigutmans - Fix compile warning.
andigutmans authored
437 };
573b460 @andigutmans Zend Library
andigutmans authored
438
1da14c9 @dstogov Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" …
dstogov authored
439 #define ZEND_CALL_FUNCTION (0 << 0)
440 #define ZEND_CALL_CODE (1 << 0)
441 #define ZEND_CALL_NESTED (0 << 1)
442 #define ZEND_CALL_TOP (1 << 1)
ab0b15b @dstogov Optimized destruction of extra arguments passed to user functions.
dstogov authored
443 #define ZEND_CALL_FREE_EXTRA_ARGS (1 << 2) /* equal to IS_TYPE_REFCOUNTED */
444 #define ZEND_CALL_CTOR (1 << 3)
445 #define ZEND_CALL_CTOR_RESULT_UNUSED (1 << 4)
a759967 @dstogov Mark call frames to closures with ZEND_CALL_CLOSURE flag to avoid exp…
dstogov authored
446 #define ZEND_CALL_CLOSURE (1 << 5)
ab4ccff @dstogov Avoid unnecessary reference counter incrementation on $this when call…
dstogov authored
447 #define ZEND_CALL_RELEASE_THIS (1 << 6)
0586702 @dstogov Mark first call frames of stack segment with ZEND_CALL_ALLOCATED flag…
dstogov authored
448 #define ZEND_CALL_ALLOCATED (1 << 7)
427ecdc @ircmaxell Fix return type separation with references. It now includes a check i…
ircmaxell authored
449
1da14c9 @dstogov Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" …
dstogov authored
450 #define ZEND_CALL_INFO(call) \
451 (Z_TYPE_INFO((call)->This) >> 24)
33e137d @dstogov Merged EX(frame_kind) and EX(flags) into single word
dstogov authored
452
a759967 @dstogov Mark call frames to closures with ZEND_CALL_CLOSURE flag to avoid exp…
dstogov authored
453 #define ZEND_CALL_KIND_EX(call_info) \
454 (call_info & (ZEND_CALL_CODE | ZEND_CALL_TOP))
455
1da14c9 @dstogov Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" …
dstogov authored
456 #define ZEND_CALL_KIND(call) \
a759967 @dstogov Mark call frames to closures with ZEND_CALL_CLOSURE flag to avoid exp…
dstogov authored
457 ZEND_CALL_KIND_EX(ZEND_CALL_INFO(call))
1da14c9 @dstogov Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" …
dstogov authored
458
459 #define ZEND_SET_CALL_INFO(call, info) do { \
460 Z_TYPE_INFO((call)->This) = IS_OBJECT_EX | ((info) << 24); \
461 } while (0)
b7a7b1a @smalyshev trailing whitespace removal
smalyshev authored
462
a759967 @dstogov Mark call frames to closures with ZEND_CALL_CLOSURE flag to avoid exp…
dstogov authored
463 #define ZEND_ADD_CALL_FLAG_EX(call_info, flag) do { \
464 call_info |= ((flag) << 24); \
465 } while (0)
466
467 #define ZEND_ADD_CALL_FLAG(call, flag) do { \
468 ZEND_ADD_CALL_FLAG_EX(Z_TYPE_INFO((call)->This), flag); \
1da14c9 @dstogov Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" …
dstogov authored
469 } while (0)
470
471 #define ZEND_CALL_NUM_ARGS(call) \
472 (call)->This.u2.num_args
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
473
474 #define ZEND_CALL_FRAME_SLOT \
79354ba @weltling fix integral constant overflow warning
weltling authored
475 ((int)((ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval))))
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
476
dcfe587 @dstogov Rename EX_VAR_2() into ZEND_CALL_VAR() and EX_VAR_NUM_2() into ZEND_C…
dstogov authored
477 #define ZEND_CALL_VAR(call, n) \
478 ((zval*)(((char*)(call)) + ((int)(n))))
479
480 #define ZEND_CALL_VAR_NUM(call, n) \
481 (((zval*)(call)) + (ZEND_CALL_FRAME_SLOT + ((int)(n))))
482
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
483 #define ZEND_CALL_ARG(call, n) \
dcfe587 @dstogov Rename EX_VAR_2() into ZEND_CALL_VAR() and EX_VAR_NUM_2() into ZEND_C…
dstogov authored
484 ZEND_CALL_VAR_NUM(call, ((int)(n)) - 1)
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
485
bd9a234 @dstogov Replaced EG(This) and EX(object) with EX(This).
dstogov authored
486 #define EX(element) ((execute_data)->element)
b66c89c @andigutmans - More debug backtrace work. It still doesn't work very well...
andigutmans authored
487
1da14c9 @dstogov Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" …
dstogov authored
488 #define EX_CALL_INFO() ZEND_CALL_INFO(execute_data)
489 #define EX_CALL_KIND() ZEND_CALL_KIND(execute_data)
490 #define EX_NUM_ARGS() ZEND_CALL_NUM_ARGS(execute_data)
7044f9c @ircmaxell Refactor as to not use call info, but add the flag to the op_array.
ircmaxell authored
491
5935612 @dstogov Improved type hinting:
dstogov authored
492 #define ZEND_CALL_USES_STRICT_TYPES(call) \
493 (((call)->func->common.fn_flags & ZEND_ACC_STRICT_TYPES) != 0)
494
495 #define EX_USES_STRICT_TYPES() \
496 ZEND_CALL_USES_STRICT_TYPES(execute_data)
497
498 #define ZEND_ARG_USES_STRICT_TYPES() \
499 (EG(current_execute_data)->prev_execute_data && \
500 EG(current_execute_data)->prev_execute_data->func && \
501 ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data)->prev_execute_data))
502
503 #define ZEND_RET_USES_STRICT_TYPES() \
504 ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))
1da14c9 @dstogov Pack EX(frame_info) into EX(This).u1.v.reserved. Rename "frame"kind" …
dstogov authored
505
dcfe587 @dstogov Rename EX_VAR_2() into ZEND_CALL_VAR() and EX_VAR_NUM_2() into ZEND_C…
dstogov authored
506 #define EX_VAR(n) ZEND_CALL_VAR(execute_data, n)
507 #define EX_VAR_NUM(n) ZEND_CALL_VAR_NUM(execute_data, n)
573b460 @andigutmans Zend Library
andigutmans authored
508
dcfe587 @dstogov Rename EX_VAR_2() into ZEND_CALL_VAR() and EX_VAR_NUM_2() into ZEND_C…
dstogov authored
509 #define EX_VAR_TO_NUM(n) (ZEND_CALL_VAR(NULL, n) - ZEND_CALL_VAR_NUM(NULL, 0))
9a8fbdf @dstogov Use CV variable offset instead of CV variable number
dstogov authored
510
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
511 #define ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, opline_num) \
512 ((char*)&(op_array)->opcodes[opline_num] - (char*)(opline))
513
514 #define ZEND_OFFSET_TO_OPLINE(base, offset) \
515 ((zend_op*)(((char*)(base)) + (int)offset))
516
517 #define ZEND_OFFSET_TO_OPLINE_NUM(op_array, base, offset) \
518 (ZEND_OFFSET_TO_OPLINE(base, offset) - op_array->opcodes)
519
520 #if ZEND_USE_ABS_JMP_ADDR
521
522 /* run-time jump target */
523 # define OP_JMP_ADDR(opline, node) \
524 (node).jmp_addr
525
526 /* convert jump target from compile-time to run-time */
527 # define ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, node) do { \
528 (node).jmp_addr = (op_array)->opcodes + (node).opline_num; \
529 } while (0)
530
531 /* convert jump target back from run-time to compile-time */
532 # define ZEND_PASS_TWO_UNDO_JMP_TARGET(op_array, opline, node) do { \
533 (node).opline_num = (node).jmp_addr - (op_array)->opcodes; \
534 } while (0)
535
536 #else
537
538 /* run-time jump target */
539 # define OP_JMP_ADDR(opline, node) \
540 ZEND_OFFSET_TO_OPLINE(opline, (node).jmp_offset)
541
542 /* convert jump target from compile-time to run-time */
543 # define ZEND_PASS_TWO_UPDATE_JMP_TARGET(op_array, opline, node) do { \
544 (node).jmp_offset = ZEND_OPLINE_NUM_TO_OFFSET(op_array, opline, (node).opline_num); \
545 } while (0)
546
547 /* convert jump target back from run-time to compile-time */
548 # define ZEND_PASS_TWO_UNDO_JMP_TARGET(op_array, opline, node) do { \
549 (node).opline_num = ZEND_OFFSET_TO_OPLINE_NUM(op_array, opline, (node).jmp_offset); \
b7a7b1a @smalyshev trailing whitespace removal
smalyshev authored
550 } while (0)
14e29f5 @dstogov Reduced size of zend_op on 64-bit systems.
dstogov authored
551
552 #endif
553
554 /* constant-time constant */
555 # define CT_CONSTANT_EX(op_array, num) \
556 ((op_array)->literals + (num))
557
558 # define CT_CONSTANT(node) \
559 CT_CONSTANT_EX(CG(active_op_array), (node).constant)
560
561 #if ZEND_USE_ABS_CONST_ADDR
562
563 /* run-time constant */
564 # define RT_CONSTANT_EX(base, node) \
565 (node).zv
566
567 /* convert constant from compile-time to run-time */
568 # define ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, node) do { \
569 (node).zv = CT_CONSTANT_EX(op_array, (node).constant); \
570 } while (0)
571
572 /* convert constant back from run-time to compile-time */
573 # define ZEND_PASS_TWO_UNDO_CONSTANT(op_array, node) do { \
574 (node).constant = (node).zv - (op_array)->literals; \
575 } while (0)
576
577 #else
578
579 /* run-time constant */
580 # define RT_CONSTANT_EX(base, node) \
581 ((zval*)(((char*)(base)) + (node).constant))
582
583 /* convert constant from compile-time to run-time */
584 # define ZEND_PASS_TWO_UPDATE_CONSTANT(op_array, node) do { \
585 (node).constant *= sizeof(zval); \
586 } while (0)
587
588 /* convert constant back from run-time to compile-time (do nothing) */
589 # define ZEND_PASS_TWO_UNDO_CONSTANT(op_array, node) do { \
590 (node).constant /= sizeof(zval); \
591 } while (0)
592
593 #endif
594
595 #if ZEND_EX_USE_LITERALS
596
597 # define EX_LITERALS() \
598 EX(literals)
599
600 # define EX_LOAD_LITERALS(op_array) do { \
601 EX(literals) = (op_array)->literals; \
602 } while (0)
603
604 #else
605
606 # define EX_LITERALS() \
607 EX(func)->op_array.literals
608
609 # define EX_LOAD_LITERALS(op_array) do { \
610 } while (0)
611
612 #endif
613
614 /* run-time constant */
615 #define RT_CONSTANT(op_array, node) \
616 RT_CONSTANT_EX((op_array)->literals, node)
617
618 /* constant in currently executed function */
619 #define EX_CONSTANT(node) \
620 RT_CONSTANT_EX(EX_LITERALS(), node)
621
622 #if ZEND_EX_USE_RUN_TIME_CACHE
623
624 # define EX_RUN_TIME_CACHE() \
625 EX(run_time_cache)
626
627 # define EX_LOAD_RUN_TIME_CACHE(op_array) do { \
628 EX(run_time_cache) = (op_array)->run_time_cache; \
629 } while (0)
630
631 #else
632
633 # define EX_RUN_TIME_CACHE() \
634 EX(func)->op_array.run_time_cache
635
636 # define EX_LOAD_RUN_TIME_CACHE(op_array) do { \
637 } while (0)
638
639 #endif
640
573b460 @andigutmans Zend Library
andigutmans authored
641 #define IS_CONST (1<<0)
642 #define IS_TMP_VAR (1<<1)
643 #define IS_VAR (1<<2)
644 #define IS_UNUSED (1<<3) /* Unused variable */
db507dd @andigutmans - Commit the variable fetch optimization.
andigutmans authored
645 #define IS_CV (1<<4) /* Compiled variable */
573b460 @andigutmans Zend Library
andigutmans authored
646
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
647 #define EXT_TYPE_UNUSED (1<<5)
573b460 @andigutmans Zend Library
andigutmans authored
648
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored
649 #include "zend_globals.h"
650
ad115d2 @zsuraski Fix require()
zsuraski authored
651 BEGIN_EXTERN_C()
652
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
653 void init_compiler(void);
654 void shutdown_compiler(void);
655 void zend_init_compiler_data_structures(void);
0381c1b @nikic Fixed bug #69388
nikic authored
656
657 void zend_oparray_context_begin(zend_oparray_context *prev_context);
658 void zend_oparray_context_end(zend_oparray_context *prev_context);
659 void zend_file_context_begin(zend_file_context *prev_context);
660 void zend_file_context_end(zend_file_context *prev_context);
573b460 @andigutmans Zend Library
andigutmans authored
661
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
662 extern ZEND_API zend_op_array *(*zend_compile_file)(zend_file_handle *file_handle, int type);
663 extern ZEND_API zend_op_array *(*zend_compile_string)(zval *source_string, char *filename);
573b460 @andigutmans Zend Library
andigutmans authored
664
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
665 ZEND_API int lex_scan(zval *zendlval);
666 void startup_scanner(void);
667 void shutdown_scanner(void);
573b460 @andigutmans Zend Library
andigutmans authored
668
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
669 ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filename);
670 ZEND_API void zend_restore_compiled_filename(zend_string *original_compiled_filename);
671 ZEND_API zend_string *zend_get_compiled_filename(void);
672 ZEND_API int zend_get_compiled_lineno(void);
673 ZEND_API size_t zend_get_scanned_file_offset(void);
573b460 @andigutmans Zend Library
andigutmans authored
674
6f9f0bf @weltling master renames phase 2
weltling authored
675 ZEND_API zend_string *zend_get_compiled_variable_name(const zend_op_array *op_array, uint32_t var);
8838c0f @andigutmans - Two new API calls for Derick (retreive CV name and value) by Dmitry
andigutmans authored
676
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
677 #ifdef ZTS
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
678 const char *zend_get_zendtext(void);
679 int zend_get_zendleng(void);
1aa2c5c @zsuraski Ok, call me crazy, because I probably am.
zsuraski authored
680 #endif
681
e78971c @weltling fix syntax for the Visual studio compat
weltling authored
682 typedef int (ZEND_FASTCALL *unary_op_type)(zval *, zval *);
683 typedef int (ZEND_FASTCALL *binary_op_type)(zval *, zval *, zval *);
573b460 @andigutmans Zend Library
andigutmans authored
684
8802964 * fix some casts
Sascha Schumann authored
685 ZEND_API unary_op_type get_unary_op(int opcode);
22a5aea MFH: - Updated unary_op_type typedef with TSRMLS_DC
Matt Wilmas authored
686 ZEND_API binary_op_type get_binary_op(int opcode);
573b460 @andigutmans Zend Library
andigutmans authored
687
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
688 void zend_stop_lexing(void);
689 void zend_emit_final_return(zval *zv);
df42793 @nikic Create namespace_name via AST
nikic authored
690 zend_ast *zend_ast_append_str(zend_ast *left, zend_ast *right);
f48c232 Decoupled class declaration statement into more granular pieces.
Guilherme Blanco authored
691 uint32_t zend_add_class_modifier(uint32_t flags, uint32_t new_flag);
6db293d @nikic Merge remote-tracking branch 'php-src/master' into ast
nikic authored
692 uint32_t zend_add_member_modifier(uint32_t flags, uint32_t new_flag);
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
693 zend_ast *zend_ast_append_doc_comment(zend_ast *list);
694 void zend_handle_encoding_declaration(zend_ast *ast);
ac7ed46 @andigutmans - Start adding parsed variable checks.
andigutmans authored
695
0eab81f @nikic Remove bits of dead code
nikic authored
696 /* parser-driven code generators */
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
697 void zend_do_free(znode *op1);
573b460 @andigutmans Zend Library
andigutmans authored
698
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
699 ZEND_API int do_bind_function(const zend_op_array *op_array, const zend_op *opline, HashTable *function_table, zend_bool compile_time);
700 ZEND_API zend_class_entry *do_bind_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_bool compile_time);
701 ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array, const zend_op *opline, HashTable *class_table, zend_class_entry *parent_ce, zend_bool compile_time);
702 ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array);
573b460 @andigutmans Zend Library
andigutmans authored
703
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
704 void zend_do_extended_info(void);
705 void zend_do_extended_fcall_begin(void);
706 void zend_do_extended_fcall_end(void);
573b460 @andigutmans Zend Library
andigutmans authored
707
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
708 void zend_verify_namespace(void);
8991ed0 @lstrojny Class Name Resolution As Scalar Via "class" Keyword
lstrojny authored
709
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
710 void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline, int pass2);
f66f55e @felipensp MFH: Implemented "jump label" operator (limited "goto")
felipensp authored
711
727398b @andigutmans Add to the API
andigutmans authored
712 ZEND_API void function_add_ref(zend_function *function);
0b7a9ce @zsuraski - Fix Win32 compilation (Use winsock2.h from now on)
zsuraski authored
713
7c4a083 @zsuraski Various thread safety fixes and DLL updates
zsuraski authored
714 #define INITIAL_OP_ARRAY_SIZE 64
715
573b460 @andigutmans Zend Library
andigutmans authored
716
7b0d92d @zsuraski Unify the names of these last 3 files...
zsuraski authored
717 /* helper functions in zend_language_scanner.l */
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
718 ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type);
719 ZEND_API zend_op_array *compile_string(zval *source_string, char *filename);
720 ZEND_API zend_op_array *compile_filename(int type, zval *filename);
721 ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...);
722 ZEND_API int open_file_for_scanning(zend_file_handle *file_handle);
723 ZEND_API void init_op_array(zend_op_array *op_array, zend_uchar type, int initial_ops_size);
724 ZEND_API void destroy_op_array(zend_op_array *op_array);
725 ZEND_API void zend_destroy_file_handle(zend_file_handle *file_handle);
726 ZEND_API void zend_cleanup_user_class_data(zend_class_entry *ce);
727 ZEND_API void zend_cleanup_internal_class_data(zend_class_entry *ce);
728 ZEND_API void zend_cleanup_internal_classes(void);
f71da39 @dstogov Use ZEND_HASH_FOEACH_* instead of zend_hash_apply_*
dstogov authored
729 ZEND_API void zend_cleanup_op_array_data(zend_op_array *op_array);
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
730 ZEND_API int clean_non_persistent_function_full(zval *zv);
731 ZEND_API int clean_non_persistent_class_full(zval *zv);
573b460 @andigutmans Zend Library
andigutmans authored
732
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
733 ZEND_API void destroy_zend_function(zend_function *function);
2b9b9af @dstogov Use better data structures (incomplete)
dstogov authored
734 ZEND_API void zend_function_dtor(zval *zv);
735 ZEND_API void destroy_zend_class(zval *zv);
736 void zend_class_add_ref(zval *zv);
7c4a083 @zsuraski Various thread safety fixes and DLL updates
zsuraski authored
737
079409b @nikic Switch (un)mangle property name to size_t and zend_string
nikic authored
738 ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_length, const char *src2, size_t src2_length, int internal);
739 #define zend_unmangle_property_name(mangled_property, class_name, prop_name) \
740 zend_unmangle_property_name_ex(mangled_property, class_name, prop_name, NULL)
741 ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char **class_name, const char **prop_name, size_t *prop_len);
471947b @zsuraski Reimplement PPP properties
zsuraski authored
742
2b9b9af @dstogov Use better data structures (incomplete)
dstogov authored
743 #define ZEND_FUNCTION_DTOR zend_function_dtor
744 #define ZEND_CLASS_DTOR destroy_zend_class
81d901b @zsuraski Step 1 in nuking the garbage collector:
zsuraski authored
745
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
746 zend_op *get_next_op(zend_op_array *op_array);
747 void init_op(zend_op *op);
573b460 @andigutmans Zend Library
andigutmans authored
748 int get_next_op_number(zend_op_array *op_array);
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
749 int print_class(zend_class_entry *class_entry);
573b460 @andigutmans Zend Library
andigutmans authored
750 void print_op_array(zend_op_array *op_array, int optimizations);
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
751 ZEND_API int pass_two(zend_op_array *op_array);
573b460 @andigutmans Zend Library
andigutmans authored
752 zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
753 ZEND_API zend_bool zend_is_compiling(void);
754 ZEND_API char *zend_make_compiled_string_description(const char *name);
755 ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify_handlers);
6db293d @nikic Merge remote-tracking branch 'php-src/master' into ast
nikic authored
756 uint32_t zend_get_class_fetch_type(zend_string *name);
c2c78dc @dstogov Added specialized versions of DO_FCALL handler:
dstogov authored
757 ZEND_API zend_uchar zend_get_call_op(zend_uchar init_op, zend_function *fbc);
c17c7a2 @zsuraski Centralize class initialization
zsuraski authored
758
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
759 typedef zend_bool (*zend_auto_global_callback)(zend_string *name);
f7b7800 @zsuraski Add infrastructure for JIT initialization of auto globals
zsuraski authored
760 typedef struct _zend_auto_global {
f4cfaf3 @dstogov Use better data structures (incomplete)
dstogov authored
761 zend_string *name;
f7b7800 @zsuraski Add infrastructure for JIT initialization of auto globals
zsuraski authored
762 zend_auto_global_callback auto_global_callback;
f0c8366 - use interned strings for auto globals
Dmitry Stogov authored
763 zend_bool jit;
f7b7800 @zsuraski Add infrastructure for JIT initialization of auto globals
zsuraski authored
764 zend_bool armed;
765 } zend_auto_global;
573b460 @andigutmans Zend Library
andigutmans authored
766
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
767 ZEND_API int zend_register_auto_global(zend_string *name, zend_bool jit, zend_auto_global_callback auto_global_callback);
768 ZEND_API void zend_activate_auto_globals(void);
769 ZEND_API zend_bool zend_is_auto_global(zend_string *name);
da7d94c @laruence Merge branch 'PHP-5.6'
laruence authored
770 ZEND_API zend_bool zend_is_auto_global_str(char *name, size_t len);
fd597dc @smalyshev [DOC] Add compile-time __DIR__ constant which implements dirname(__FI…
smalyshev authored
771 ZEND_API size_t zend_dirname(char *path, size_t len);
f2435bd @KalleZ Fixed compiler warning
KalleZ authored
772 ZEND_API void zend_set_function_arg_flags(zend_function *func);
9d11db1 @andigutmans - Merge new $_GET, $_POST etc. patch from Engine 1 tree
andigutmans authored
773
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
774 int zendlex(zend_parser_stack_elem *elem);
573b460 @andigutmans Zend Library
andigutmans authored
775
bdeb220 @weltling first shot remove TSRMLS_* things
weltling authored
776 int zend_add_literal(zend_op_array *op_array, zval *zv);
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
777
c7719ab @TazeTSchnitzel Refactor typehint lookup
TazeTSchnitzel authored
778 ZEND_API void zend_assert_valid_class_name(const zend_string *const_name);
779
5ae7fa4 add markers that make this file easy to parse for external sources
Sterling Hughes authored
780 /* BEGIN: OPCODES */
f7f5a5e @smalyshev MEGA-patch: namespaces are R.I.P.
smalyshev authored
781
a904c1d @andigutmans - Improve comments, docs, code...
andigutmans authored
782 #include "zend_vm_opcodes.h"
a4c3b2c @smalyshev Namespace patch. Big changes:
smalyshev authored
783
5ae7fa4 add markers that make this file easy to parse for external sources
Sterling Hughes authored
784 /* END: OPCODES */
573b460 @andigutmans Zend Library
andigutmans authored
785
74efc41 @andigutmans - Make classes have scope and function/constant lookups default to th…
andigutmans authored
786 /* class fetches */
787 #define ZEND_FETCH_CLASS_DEFAULT 0
788 #define ZEND_FETCH_CLASS_SELF 1
b3fd2fa @andigutmans - Support parent:: again
andigutmans authored
789 #define ZEND_FETCH_CLASS_PARENT 2
4a3e501 @dstogov cleanup
dstogov authored
790 #define ZEND_FETCH_CLASS_STATIC 3
791 #define ZEND_FETCH_CLASS_AUTO 4
792 #define ZEND_FETCH_CLASS_INTERFACE 5
793 #define ZEND_FETCH_CLASS_TRAIT 6
eb0c56a Fixed bug #42820 (defined() on constant with namespace prefixes tries…
Dmitry Stogov authored
794 #define ZEND_FETCH_CLASS_MASK 0x0f
9305339 Changed "instanceof" and "catch" operators, is_a() and is_subclass_of…
Dmitry Stogov authored
795 #define ZEND_FETCH_CLASS_NO_AUTOLOAD 0x80
eb0c56a Fixed bug #42820 (defined() on constant with namespace prefixes tries…
Dmitry Stogov authored
796 #define ZEND_FETCH_CLASS_SILENT 0x0100
ec760d8 @dstogov Convert fatal errors into EngineExceptions
dstogov authored
797 #define ZEND_FETCH_CLASS_EXCEPTION 0x0200
74efc41 @andigutmans - Make classes have scope and function/constant lookups default to th…
andigutmans authored
798
880e7d8 @andigutmans - Framework for knowing what kind of variable we just parsed.
andigutmans authored
799 /* variable parsing type (compile-time) */
03b6af0 @zsuraski Support references in foreach()
zsuraski authored
800 #define ZEND_PARSED_MEMBER (1<<0)
801 #define ZEND_PARSED_METHOD_CALL (1<<1)
802 #define ZEND_PARSED_STATIC_MEMBER (1<<2)
803 #define ZEND_PARSED_FUNCTION_CALL (1<<3)
804 #define ZEND_PARSED_VARIABLE (1<<4)
805 #define ZEND_PARSED_REFERENCE_VARIABLE (1<<5)
44325e6 Fixed bug #45178 (memory corruption on assignment result of "new" by …
Dmitry Stogov authored
806 #define ZEND_PARSED_NEW (1<<6)
35951d4 @laruence Support list in foreach
laruence authored
807 #define ZEND_PARSED_LIST_EXPR (1<<7)
880e7d8 @andigutmans - Framework for knowing what kind of variable we just parsed.
andigutmans authored
808
1ee3277 @nikic Port parameter defs
nikic authored
809 #define ZEND_PARAM_REF (1<<0)
810 #define ZEND_PARAM_VARIADIC (1<<1)
811
cc0bef6 @nikic Fix namespace\, maybe
nikic authored
812 #define ZEND_NAME_FQ 0
813 #define ZEND_NAME_NOT_FQ 1
814 #define ZEND_NAME_RELATIVE 2
880e7d8 @andigutmans - Framework for knowing what kind of variable we just parsed.
andigutmans authored
815
5af7770 @andigutmans - Sync Engine2 CVS with latest Engine CVS
andigutmans authored
816 /* unset types */
817 #define ZEND_UNSET_REG 0
818
573b460 @andigutmans Zend Library
andigutmans authored
819 /* var status for backpatching */
06d04d1 @andigutmans - Fix SEND_VAR problem after fetch'ing a variable and not knowing the…
andigutmans authored
820 #define BP_VAR_R 0
821 #define BP_VAR_W 1
822 #define BP_VAR_RW 2
823 #define BP_VAR_IS 3
258a733 @nikic AST-based compiler: Stage 1
nikic authored
824 #define BP_VAR_FUNC_ARG 4
825 #define BP_VAR_UNSET 5
826 #define BP_VAR_REF 6 /* right-hand side of by-ref assignment */
827
828 /* Bottom 3 bits are the type, top bits are arg num for BP_VAR_FUNC_ARG */
829 #define BP_VAR_SHIFT 3
830 #define BP_VAR_MASK 7
573b460 @andigutmans Zend Library
andigutmans authored
831
832
49c4866 @zsuraski - Improve tracking
zsuraski authored
833 #define ZEND_INTERNAL_FUNCTION 1
834 #define ZEND_USER_FUNCTION 2
835 #define ZEND_OVERLOADED_FUNCTION 3
836 #define ZEND_EVAL_CODE 4
837 #define ZEND_OVERLOADED_FUNCTION_TEMPORARY 5
573b460 @andigutmans Zend Library
andigutmans authored
838
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
839 /* A quick check (type == ZEND_USER_FUNCTION || type == ZEND_EVAL_CODE) */
840 #define ZEND_USER_CODE(type) ((type & 1) == 0)
841
62f9eb8 Split ZEND_NAMESPACE into user and internal namespaces. Hope this is
Andrei Zmievski authored
842 #define ZEND_INTERNAL_CLASS 1
843 #define ZEND_USER_CLASS 2
573b460 @andigutmans Zend Library
andigutmans authored
844
845 #define ZEND_EVAL (1<<0)
846 #define ZEND_INCLUDE (1<<1)
9cc7044 @andigutmans - Cleanup old IMPORT stuff
andigutmans authored
847 #define ZEND_INCLUDE_ONCE (1<<2)
67b4b3a @zsuraski - require() of a dynamic expression now has the standard require() se…
zsuraski authored
848 #define ZEND_REQUIRE (1<<3)
c06692e @zsuraski The patch we promised - redesigned the compilation/execution API:
zsuraski authored
849 #define ZEND_REQUIRE_ONCE (1<<4)
573b460 @andigutmans Zend Library
andigutmans authored
850
851 #define ZEND_CT (1<<0)
852 #define ZEND_RT (1<<1)
853
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored
854 /* global/local fetches */
855 #define ZEND_FETCH_GLOBAL 0x00000000
856 #define ZEND_FETCH_LOCAL 0x10000000
857 #define ZEND_FETCH_STATIC 0x20000000
858 #define ZEND_FETCH_STATIC_MEMBER 0x30000000
859 #define ZEND_FETCH_GLOBAL_LOCK 0x40000000
860 #define ZEND_FETCH_LEXICAL 0x50000000
861
862 #define ZEND_FETCH_TYPE_MASK 0x70000000
863
864 #define ZEND_FETCH_STANDARD 0x00000000
865
866 #define ZEND_ISSET 0x02000000
867 #define ZEND_ISEMPTY 0x01000000
868 #define ZEND_ISSET_ISEMPTY_MASK (ZEND_ISSET | ZEND_ISEMPTY)
869 #define ZEND_QUICK_SET 0x00800000
870
871 #define ZEND_FETCH_ARG_MASK 0x000fffff
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
872
741b816 @zsuraski * Support getThis() for internal functions.
zsuraski authored
873 #define ZEND_MEMBER_FUNC_CALL 1<<0
874
8d90825 @andigutmans - Allow passing references which are returned from functions and new
andigutmans authored
875 #define ZEND_ARG_SEND_BY_REF (1<<0)
876 #define ZEND_ARG_COMPILE_TIME_BOUND (1<<1)
21e071b Fixed bug #33257 (array_splice() inconsistent when passed function in…
Dmitry Stogov authored
877 #define ZEND_ARG_SEND_FUNCTION (1<<2)
666bf10 Removed wrong warning message
Dmitry Stogov authored
878 #define ZEND_ARG_SEND_SILENT (1<<3)
6ec1acb @zsuraski Phase 3:
zsuraski authored
879
ebd4ab4 Fixed bug #25359 (array_multisort() doesn't work in a function if arr…
Dmitry Stogov authored
880 #define ZEND_SEND_BY_VAL 0
881 #define ZEND_SEND_BY_REF 1
882 #define ZEND_SEND_PREFER_REF 2
883
f1bf531 @dstogov Replaced macro with better optimized inline function
dstogov authored
884 static zend_always_inline int zend_check_arg_send_type(const zend_function *zf, uint32_t arg_num, uint32_t mask)
885 {
2646f7b @dstogov Don't count variadic argument in zend_func.common.num_args. This allo…
dstogov authored
886 arg_num--;
887 if (UNEXPECTED(arg_num >= zf->common.num_args)) {
f1bf531 @dstogov Replaced macro with better optimized inline function
dstogov authored
888 if (EXPECTED((zf->common.fn_flags & ZEND_ACC_VARIADIC) == 0)) {
889 return 0;
890 }
891 arg_num = zf->common.num_args;
892 }
2646f7b @dstogov Don't count variadic argument in zend_func.common.num_args. This allo…
dstogov authored
893 return UNEXPECTED((zf->common.arg_info[arg_num].pass_by_reference & mask) != 0);
f1bf531 @dstogov Replaced macro with better optimized inline function
dstogov authored
894 }
c3272ab Fixed bug #38808 ("maybe ref" issue for current() and others)
Dmitry Stogov authored
895
896 #define ARG_MUST_BE_SENT_BY_REF(zf, arg_num) \
f1bf531 @dstogov Replaced macro with better optimized inline function
dstogov authored
897 zend_check_arg_send_type(zf, arg_num, ZEND_SEND_BY_REF)
c3272ab Fixed bug #38808 ("maybe ref" issue for current() and others)
Dmitry Stogov authored
898
899 #define ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \
f1bf531 @dstogov Replaced macro with better optimized inline function
dstogov authored
900 zend_check_arg_send_type(zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF)
c3272ab Fixed bug #38808 ("maybe ref" issue for current() and others)
Dmitry Stogov authored
901
902 #define ARG_MAY_BE_SENT_BY_REF(zf, arg_num) \
f1bf531 @dstogov Replaced macro with better optimized inline function
dstogov authored
903 zend_check_arg_send_type(zf, arg_num, ZEND_SEND_PREFER_REF)
f8bbafd @zsuraski ntroduce infrastructure for supplying information about arguments,
zsuraski authored
904
15a5f61 @dstogov Use fast method to check if first arguments should be passed by refer…
dstogov authored
905 /* Quick API to check firat 12 arguments */
906 #define MAX_ARG_FLAG_NUM 12
907
908 #ifdef WORDS_BIGENDIAN
909 # define ZEND_SET_ARG_FLAG(zf, arg_num, mask) do { \
910 *(uint32_t*)&(zf)->type |= ((mask) << ((arg_num) - 1) * 2); \
911 } while (0)
912 # define ZEND_CHECK_ARG_FLAG(zf, arg_num, mask) \
913 (((*((uint32_t*)&((zf)->type))) >> (((arg_num) - 1) * 2)) & (mask))
914 #else
915 # define ZEND_SET_ARG_FLAG(zf, arg_num, mask) do { \
916 *(uint32_t*)&(zf)->type |= (((mask) << 6) << (arg_num) * 2); \
917 } while (0)
918 # define ZEND_CHECK_ARG_FLAG(zf, arg_num, mask) \
919 (((*(uint32_t*)&(zf)->type) >> (((arg_num) + 3) * 2)) & (mask))
920 #endif
921
922 #define QUICK_ARG_MUST_BE_SENT_BY_REF(zf, arg_num) \
923 ZEND_CHECK_ARG_FLAG(zf, arg_num, ZEND_SEND_BY_REF)
924
925 #define QUICK_ARG_SHOULD_BE_SENT_BY_REF(zf, arg_num) \
926 ZEND_CHECK_ARG_FLAG(zf, arg_num, ZEND_SEND_BY_REF|ZEND_SEND_PREFER_REF)
927
928 #define QUICK_ARG_MAY_BE_SENT_BY_REF(zf, arg_num) \
929 ZEND_CHECK_ARG_FLAG(zf, arg_num, ZEND_SEND_PREFER_REF)
930
ced9cee @zsuraski - Implement return by reference:
zsuraski authored
931 #define ZEND_RETURN_VAL 0
932 #define ZEND_RETURN_REF 1
933
3a42bab @zsuraski Fix behavior of return-by-reference functions. Remove erroneous warn…
zsuraski authored
934
935 #define ZEND_RETURNS_FUNCTION 1<<0
4d3e4d3 @nikic Remove assignment of new by reference
nikic authored
936 #define ZEND_RETURNS_VALUE 1<<1
3a42bab @zsuraski Fix behavior of return-by-reference functions. Remove erroneous warn…
zsuraski authored
937
eb4825b @dstogov Improved "finally" im[plementation
dstogov authored
938 #define ZEND_FAST_RET_TO_CATCH 1
939 #define ZEND_FAST_RET_TO_FINALLY 2
940
8ff00e6 @laruence Improve fix for #66608
laruence authored
941 #define ZEND_FAST_CALL_FROM_CATCH 1
942 #define ZEND_FAST_CALL_FROM_FINALLY 2
de433d4 @laruence Fixed bug #66608 (Incorrect behavior with nested "finally" blocks)
laruence authored
943
7e424f5 @dstogov Use symbolic names instead of magic constants + optimization
dstogov authored
944 #define ZEND_ARRAY_ELEMENT_REF (1<<0)
945 #define ZEND_ARRAY_NOT_PACKED (1<<1)
946 #define ZEND_ARRAY_SIZE_SHIFT 2
947
8542bef @nikic Remove ZEND_BRK/ZEND_CONT from VM
nikic authored
948 /* Pseudo-opcodes that are used only temporarily during compilation */
949 #define ZEND_BRK 254
950 #define ZEND_CONT 255
951
952
ad115d2 @zsuraski Fix require()
zsuraski authored
953 END_EXTERN_C()
954
d8651c8 @smalyshev Support for __get, __set and __call in classes.
smalyshev authored
955 #define ZEND_CLONE_FUNC_NAME "__clone"
956 #define ZEND_CONSTRUCTOR_FUNC_NAME "__construct"
957 #define ZEND_DESTRUCTOR_FUNC_NAME "__destruct"
958 #define ZEND_GET_FUNC_NAME "__get"
959 #define ZEND_SET_FUNC_NAME "__set"
637a404 - MFH as discussed
Marcus Boerger authored
960 #define ZEND_UNSET_FUNC_NAME "__unset"
961 #define ZEND_ISSET_FUNC_NAME "__isset"
d8651c8 @smalyshev Support for __get, __set and __call in classes.
smalyshev authored
962 #define ZEND_CALL_FUNC_NAME "__call"
b20ed0d Added support for __callstatic() magic method. (Sara)
Dmitry Stogov authored
963 #define ZEND_CALLSTATIC_FUNC_NAME "__callstatic"
637a404 - MFH as discussed
Marcus Boerger authored
964 #define ZEND_TOSTRING_FUNC_NAME "__tostring"
5f0433d MFB: Enforce protocol on magic methods/functions
Marcus Boerger authored
965 #define ZEND_AUTOLOAD_FUNC_NAME "__autoload"
01049ca @laruence Fixed bug #61025 (__invoke() visibility not honored)
laruence authored
966 #define ZEND_INVOKE_FUNC_NAME "__invoke"
1e752ce @sgolemon Add __debugInfo() magic method
sgolemon authored
967 #define ZEND_DEBUGINFO_FUNC_NAME "__debuginfo"
d8651c8 @smalyshev Support for __get, __set and __call in classes.
smalyshev authored
968
8c885b8 Implemented concept of "delayed early binding" that allows opcode cac…
Dmitry Stogov authored
969 /* The following constants may be combined in CG(compiler_options)
970 * to change the default compiler behavior */
971
972 /* generate extended debug information */
973 #define ZEND_COMPILE_EXTENDED_INFO (1<<0)
974
975 /* call op_array handler of extendions */
976 #define ZEND_COMPILE_HANDLE_OP_ARRAY (1<<1)
977
b7715c7 @dstogov Refactored parameter passing mechanism.
dstogov authored
978 /* generate ZEND_INIT_FCALL_BY_NAME for internal functions instead of ZEND_INIT_FCALL */
8c885b8 Implemented concept of "delayed early binding" that allows opcode cac…
Dmitry Stogov authored
979 #define ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS (1<<2)
980
981 /* don't perform early binding for classes inherited form internal ones;
982 * in namespaces assume that internal class that doesn't exist at compile-time
983 * may apper in run-time */
984 #define ZEND_COMPILE_IGNORE_INTERNAL_CLASSES (1<<3)
985
986 /* generate ZEND_DECLARE_INHERITED_CLASS_DELAYED opcode to delay early binding */
987 #define ZEND_COMPILE_DELAYED_BINDING (1<<4)
988
ed2d3e4 Substitute persistent constants by their values at compile time. (Matt)
Dmitry Stogov authored
989 /* disable constant substitution at compile-time */
990 #define ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION (1<<5)
991
6c8db86 @dstogov Implemented builtin instruction for strlen()
dstogov authored
992 /* disable usage of builtin instruction for strlen() */
993 #define ZEND_COMPILE_NO_BUILTIN_STRLEN (1<<6)
994
2b3bebf @bwoebi Revert removal of two ReflectionParameter functions
bwoebi authored
995 /* disable substitution of persistent constants at compile-time */
996 #define ZEND_COMPILE_NO_PERSISTENT_CONSTANT_SUBSTITUTION (1<<7)
997
8c885b8 Implemented concept of "delayed early binding" that allows opcode cac…
Dmitry Stogov authored
998 /* The default value for CG(compiler_options) */
999 #define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY
1000
1001 /* The default value for CG(compiler_options) during eval() */
1002 #define ZEND_COMPILE_DEFAULT_FOR_EVAL 0
1003
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored
1004 #endif /* ZEND_COMPILE_H */
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
1005
1006 /*
1007 * Local variables:
1008 * tab-width: 4
1009 * c-basic-offset: 4
1010 * indent-tabs-mode: t
1011 * End:
1012 */
Something went wrong with that request. Please try again.