Skip to content
Newer
Older
100644 467 lines (386 sloc) 14.8 KB
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
8775a37 @felipensp - Year++
felipensp authored Jan 1, 2012
5 | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
6 +----------------------------------------------------------------------+
d863d52 @sebastianbergmann Update headers.
sebastianbergmann authored Dec 11, 2001
7 | This source file is subject to version 2.00 of the Zend license, |
b5b1117 @zsuraski License update
zsuraski authored Jul 16, 1999
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored Jun 10, 2003
9 | available through the world-wide-web at the following url: |
d863d52 @sebastianbergmann Update headers.
sebastianbergmann authored Dec 11, 2001
10 | http://www.zend.com/license/2_00.txt. |
b5b1117 @zsuraski License update
zsuraski authored 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. |
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
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 Feb 1, 2003
20 /* $Id$ */
b5b1117 @zsuraski License update
zsuraski authored Jul 16, 1999
21
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored Jul 3, 2000
22 #ifndef ZEND_EXECUTE_H
23 #define ZEND_EXECUTE_H
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
24
25 #include "zend_compile.h"
26 #include "zend_hash.h"
51b9245 @andigutmans - More object junk
andigutmans authored Jul 29, 2001
27 #include "zend_operators.h"
637a404 - MFH as discussed
Marcus Boerger authored May 9, 2006
28 #include "zend_variables.h"
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
29
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored May 22, 1999
30 typedef union _temp_variable {
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
31 zval tmp_var;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored Sep 26, 1999
32 struct {
33 zval **ptr_ptr;
b56fd46 @andigutmans - First part of the patch which makes reads use ptr and not ptr_ptr.
andigutmans authored Sep 28, 1999
34 zval *ptr;
3a42bab @zsuraski Fix behavior of return-by-reference functions. Remove erroneous warni…
zsuraski authored Dec 14, 2003
35 zend_bool fcall_returned_reference;
4fff038 @andigutmans - Changed Ts{}.var to Ts{}.var.ptr_ptr.
andigutmans authored Sep 26, 1999
36 } var;
21f0964 @andigutmans - Hopefully fix bug #26696.
andigutmans authored Jan 19, 2004
37 struct {
68e154b reduced size of temp_variariable
Dmitry Stogov authored Oct 22, 2010
38 zval **ptr_ptr; /* shared with var.ptr_ptr */
21f0964 @andigutmans - Hopefully fix bug #26696.
andigutmans authored Jan 19, 2004
39 zval *str;
40 zend_uint offset;
41 } str_offset;
e470e22 - Fixed bug #35106 (nested foreach fails when array variable has a re…
Dmitry Stogov authored Jan 10, 2007
42 struct {
68e154b reduced size of temp_variariable
Dmitry Stogov authored Oct 22, 2010
43 zval **ptr_ptr; /* shared with var.ptr_ptr */
44 zval *ptr; /* shared with var.ptr */
e470e22 - Fixed bug #35106 (nested foreach fails when array variable has a re…
Dmitry Stogov authored Jan 10, 2007
45 HashPointer fe_pos;
46 } fe;
e94e3e1 @zsuraski Some cleanup
zsuraski authored Dec 14, 2003
47 zend_class_entry *class_entry;
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
48 } temp_variable;
49
50
0450ab9 @zsuraski MFZE1 (Expose more C++ APIs)
zsuraski authored May 20, 2002
51 BEGIN_EXTERN_C()
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored Jul 27, 2001
52 ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
2c44fab - Ported the zend_execute_internal hook to ZendEngine2.
Derick Rethans authored Jan 11, 2003
53 ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
54
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored Jul 28, 2001
55 void init_executor(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored Jul 27, 2001
56 void shutdown_executor(TSRMLS_D);
0cd2da0 - Execute destructors earlier (Florian Schaper, fschaper at intux org)
Marcus Boerger authored Jul 25, 2004
57 void shutdown_destructors(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored Jul 27, 2001
58 ZEND_API void execute(zend_op_array *op_array TSRMLS_DC);
f627be5 @nikic Add support for executing a zend_execute_data
nikic authored May 26, 2012
59 ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
2c44fab - Ported the zend_execute_internal hook to ZendEngine2.
Derick Rethans authored Jan 11, 2003
60 ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
61 ZEND_API int zend_is_true(zval *op);
3df0288 Improove debug capabilities
Marcus Boerger authored Jan 18, 2004
62 #define safe_free_zval_ptr(p) safe_free_zval_ptr_rel(p ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
63 static zend_always_inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
64 {
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored Jul 27, 2001
65 TSRMLS_FETCH();
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
66
67 if (p!=EG(uninitialized_zval_ptr)) {
3df0288 Improove debug capabilities
Marcus Boerger authored Jan 18, 2004
68 FREE_ZVAL_REL(p);
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
69 }
70 }
6c810b0 Improved memory usage by movig constants to read only memory. (Dmitry…
Dmitry Stogov authored Sep 27, 2007
71 ZEND_API int zend_lookup_class(const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored Apr 20, 2010
72 ZEND_API int zend_lookup_class_ex(const char *name, int name_length, const zend_literal *key, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored Jul 28, 2001
73 ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
d553002 MFH: Added zend_eval_stringl and made create_function(), etc. binary-…
Matt Wilmas authored Jun 5, 2009
74 ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC);
d3473d1 - Provide a unified way to display uncaught exceptions, which shows
Marcus Boerger authored Aug 24, 2003
75 ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
d553002 MFH: Added zend_eval_stringl and made create_function(), etc. binary-…
Matt Wilmas authored Jun 5, 2009
76 ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
6608f07 @smalyshev Mega-commit: Enter the new object model
smalyshev authored Feb 7, 2002
77
0e24a7c - Strip out the typehint *checks* only. They are still parsed, and th…
Derick Rethans authored Oct 19, 2010
78 ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC);
e43ff13 Fixed ZE specific compile warnings (Bug #55629)
Dmitry Stogov authored Sep 13, 2011
79 ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC);
0e24a7c - Strip out the typehint *checks* only. They are still parsed, and th…
Derick Rethans authored Oct 19, 2010
80
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
81 static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC)
82 {
83 if (!Z_DELREF_P(zval_ptr)) {
84 TSRMLS_FETCH();
85
86 if (zval_ptr != &EG(uninitialized_zval)) {
87 GC_REMOVE_ZVAL_FROM_BUFFER(zval_ptr);
88 zval_dtor(zval_ptr);
89 efree_rel(zval_ptr);
90 }
91 } else {
92 TSRMLS_FETCH();
93
94 if (Z_REFCOUNT_P(zval_ptr) == 1) {
95 Z_UNSET_ISREF_P(zval_ptr);
96 }
97
98 GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
99 }
100 }
101
102 static zend_always_inline int i_zend_is_true(zval *op)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
103 {
104 int result;
105
637a404 - MFH as discussed
Marcus Boerger authored May 9, 2006
106 switch (Z_TYPE_P(op)) {
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
107 case IS_NULL:
108 result = 0;
109 break;
110 case IS_LONG:
111 case IS_BOOL:
112 case IS_RESOURCE:
637a404 - MFH as discussed
Marcus Boerger authored May 9, 2006
113 result = (Z_LVAL_P(op)?1:0);
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
114 break;
115 case IS_DOUBLE:
637a404 - MFH as discussed
Marcus Boerger authored May 9, 2006
116 result = (Z_DVAL_P(op) ? 1 : 0);
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
117 break;
118 case IS_STRING:
637a404 - MFH as discussed
Marcus Boerger authored May 9, 2006
119 if (Z_STRLEN_P(op) == 0
120 || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
121 result = 0;
122 } else {
123 result = 1;
124 }
125 break;
126 case IS_ARRAY:
637a404 - MFH as discussed
Marcus Boerger authored May 9, 2006
127 result = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
128 break;
129 case IS_OBJECT:
97e7ce7 @smalyshev fix the fix
smalyshev authored Mar 4, 2004
130 if(IS_ZEND_STD_OBJECT(*op)) {
f9c6520 @smalyshev Fix object true value: if we are in compat mode and it's Zend object -
smalyshev authored Mar 4, 2004
131 TSRMLS_FETCH();
9d1f2f3 Fixed bug #34199 (if($obj)/if(!$obj) inconsistency)
Dmitry Stogov authored Sep 12, 2005
132
133 if (Z_OBJ_HT_P(op)->cast_object) {
134 zval tmp;
637a404 - MFH as discussed
Marcus Boerger authored May 9, 2006
135 if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL TSRMLS_CC) == SUCCESS) {
9d1f2f3 Fixed bug #34199 (if($obj)/if(!$obj) inconsistency)
Dmitry Stogov authored Sep 12, 2005
136 result = Z_LVAL(tmp);
137 break;
138 }
139 } else if (Z_OBJ_HT_P(op)->get) {
140 zval *tmp = Z_OBJ_HT_P(op)->get(op TSRMLS_CC);
141 if(Z_TYPE_P(tmp) != IS_OBJECT) {
142 /* for safety - avoid loop */
143 convert_to_boolean(tmp);
144 result = Z_LVAL_P(tmp);
145 zval_ptr_dtor(&tmp);
146 break;
147 }
148 }
f9c6520 @smalyshev Fix object true value: if we are in compat mode and it's Zend object -
smalyshev authored Mar 4, 2004
149 }
2b10c53 @felipensp MFH: Dropped zend.ze1_compatibility_mode
felipensp authored Mar 18, 2008
150 result = 1;
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
151 break;
152 default:
153 result = 0;
154 break;
155 }
156 return result;
157 }
158
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 31, 2001
159 ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
79d2aaf @felipensp - Fixed bug #51905 (ReflectionParameter fails if default value is an …
felipensp authored May 26, 2010
160 ZEND_API int zval_update_constant_inline_change(zval **pp, void *arg TSRMLS_DC);
161 ZEND_API int zval_update_constant_no_inline_change(zval **pp, void *arg TSRMLS_DC);
dcf2490 @johannes - MFH: Fix #38465 (ReflectionParameter fails if default value is an a…
johannes authored Oct 18, 2006
162 ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
163
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored Apr 12, 1999
164 /* dedicated Zend executor functions - do not use! */
d3efe97 Reduced initial VM stack size to fit into zend_mm segment and elimina…
Dmitry Stogov authored Jul 7, 2010
165 #define ZEND_VM_STACK_PAGE_SIZE ((16 * 1024) - 16)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
166
167 struct _zend_vm_stack {
168 void **top;
169 void **end;
170 zend_vm_stack prev;
171 };
172
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
173 #define ZEND_VM_STACK_ELEMETS(stack) \
174 ((void**)(((char*)(stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(struct _zend_vm_stack))))
175
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
176 #define ZEND_VM_STACK_GROW_IF_NEEDED(count) \
177 do { \
c33db5c Fixed warning
Dmitry Stogov authored Mar 12, 2008
178 if (UNEXPECTED((count) > \
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
179 EG(argument_stack)->end - EG(argument_stack)->top)) { \
c33db5c Fixed warning
Dmitry Stogov authored Mar 12, 2008
180 zend_vm_stack_extend((count) TSRMLS_CC); \
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
181 } \
182 } while (0)
183
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
184 static zend_always_inline zend_vm_stack zend_vm_stack_new_page(int count) {
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
185 zend_vm_stack page = (zend_vm_stack)emalloc(ZEND_MM_ALIGNED_SIZE(sizeof(*page)) + sizeof(void*) * count);
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
186
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
187 page->top = ZEND_VM_STACK_ELEMETS(page);
188 page->end = page->top + count;
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
189 page->prev = NULL;
190 return page;
191 }
192
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
193 static zend_always_inline void zend_vm_stack_init(TSRMLS_D)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
194 {
195 EG(argument_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE);
196 }
197
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
198 static zend_always_inline void zend_vm_stack_destroy(TSRMLS_D)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
199 {
200 zend_vm_stack stack = EG(argument_stack);
201
202 while (stack != NULL) {
203 zend_vm_stack p = stack->prev;
204 efree(stack);
205 stack = p;
206 }
207 }
208
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
209 static zend_always_inline void zend_vm_stack_extend(int count TSRMLS_DC)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
210 {
211 zend_vm_stack p = zend_vm_stack_new_page(count >= ZEND_VM_STACK_PAGE_SIZE ? count : ZEND_VM_STACK_PAGE_SIZE);
212 p->prev = EG(argument_stack);
213 EG(argument_stack) = p;
214 }
215
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
216 static zend_always_inline void **zend_vm_stack_top(TSRMLS_D)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
217 {
218 return EG(argument_stack)->top;
219 }
220
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
221 static zend_always_inline void zend_vm_stack_push(void *ptr TSRMLS_DC)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
222 {
223 ZEND_VM_STACK_GROW_IF_NEEDED(1);
224 *(EG(argument_stack)->top++) = ptr;
225 }
226
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
227 static zend_always_inline void zend_vm_stack_push_nocheck(void *ptr TSRMLS_DC)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
228 {
229 *(EG(argument_stack)->top++) = ptr;
230 }
231
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
232 static zend_always_inline void *zend_vm_stack_pop(TSRMLS_D)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
233 {
234 void *el = *(--EG(argument_stack)->top);
235
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
236 if (UNEXPECTED(EG(argument_stack)->top == ZEND_VM_STACK_ELEMETS(EG(argument_stack)))) {
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
237 zend_vm_stack p = EG(argument_stack);
238 EG(argument_stack) = p->prev;
239 efree(p);
240 }
241 return el;
242 }
243
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
244 static zend_always_inline void *zend_vm_stack_alloc(size_t size TSRMLS_DC)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
245 {
246 void *ret;
247
248 size = (size + (sizeof(void*) - 1)) / sizeof(void*);
249
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
250 /* the following comparison must be optimized out at compile time */
251 if (ZEND_MM_ALIGNMENT > sizeof(void*)) {
252 int extra = (ZEND_MM_ALIGNMENT - ((zend_uintptr_t)EG(argument_stack)->top & (ZEND_MM_ALIGNMENT - 1))) / sizeof(void*);
253
254 if (UNEXPECTED(size + extra + ZEND_MM_ALIGNED_SIZE(sizeof(void*)) / sizeof(void*) >
694a72c Fixed bug #50723 (Bug in garbage collector causes crash)
Dmitry Stogov authored Feb 2, 2010
255 (zend_uintptr_t)(EG(argument_stack)->end - EG(argument_stack)->top))) {
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
256 zend_vm_stack_extend(size TSRMLS_CC);
257 } else {
258 void **old_top = EG(argument_stack)->top;
259
260 EG(argument_stack)->top += extra;
261 /* store old top on the stack */
262 *EG(argument_stack)->top = (void*)old_top;
263 EG(argument_stack)->top += ZEND_MM_ALIGNED_SIZE(sizeof(void*)) / sizeof(void*);
264 }
265 } else {
266 ZEND_VM_STACK_GROW_IF_NEEDED((int)size);
267 }
e0ca3b2 Fixed types
Dmitry Stogov authored Jan 29, 2008
268 ret = (void*)EG(argument_stack)->top;
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
269 EG(argument_stack)->top += size;
270 return ret;
271 }
272
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
273 static zend_always_inline void zend_vm_stack_free_int(void *ptr TSRMLS_DC)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
274 {
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
275 if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (void**)ptr)) {
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
276 zend_vm_stack p = EG(argument_stack);
277
278 EG(argument_stack) = p->prev;
279 efree(p);
280 } else {
e0ca3b2 Fixed types
Dmitry Stogov authored Jan 29, 2008
281 EG(argument_stack)->top = (void**)ptr;
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
282 }
283 }
284
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
285 static zend_always_inline void zend_vm_stack_free(void *ptr TSRMLS_DC)
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
286 {
287 if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (void**)ptr)) {
288 zend_vm_stack p = EG(argument_stack);
289
290 EG(argument_stack) = p->prev;
291 efree(p);
292 } else {
293 /* the following comparison must be optimized out at compile time */
294 if (ZEND_MM_ALIGNMENT > sizeof(void*)) {
295 ptr = (void*)(((char*)ptr) - ZEND_MM_ALIGNED_SIZE(sizeof(void*)));
296 EG(argument_stack)->top = *(void***)ptr;
297 } else {
298 EG(argument_stack)->top = (void**)ptr;
299 }
300 }
301 }
302
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
303 static zend_always_inline void** zend_vm_stack_push_args(int count TSRMLS_DC)
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
304 {
305
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
306 if (UNEXPECTED(EG(argument_stack)->top - ZEND_VM_STACK_ELEMETS(EG(argument_stack)) < count) ||
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
307 UNEXPECTED(EG(argument_stack)->top == EG(argument_stack)->end)) {
308 zend_vm_stack p = EG(argument_stack);
309
310 zend_vm_stack_extend(count + 1 TSRMLS_CC);
311
312 EG(argument_stack)->top += count;
313 *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count;
314 while (count-- > 0) {
315 void *data = *(--p->top);
316
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
317 if (UNEXPECTED(p->top == ZEND_VM_STACK_ELEMETS(p))) {
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
318 zend_vm_stack r = p;
319
320 EG(argument_stack)->prev = p->prev;
321 p = p->prev;
322 efree(r);
323 }
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
324 *(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + count) = data;
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
325 }
326 return EG(argument_stack)->top++;
327 }
328 *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count;
329 return EG(argument_stack)->top++;
330 }
331
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
332 static zend_always_inline void zend_vm_stack_clear_multiple(TSRMLS_D)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
333 {
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
334 void **p = EG(argument_stack)->top - 1;
e1814f0 WIN64 support
Dmitry Stogov authored Apr 16, 2007
335 int delete_count = (int)(zend_uintptr_t) *p;
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
336
337 while (--delete_count>=0) {
8df40bd Keeping consistent arg_stack during arguments freeing (Exception from…
Dmitry Stogov authored May 31, 2006
338 zval *q = *(zval **)(--p);
339 *p = NULL;
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
340 i_zval_ptr_dtor(q ZEND_FILE_LINE_CC);
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
341 }
4016bfc Fixed bug #46074 (Bus error during running PHP CLI under IRIX 6.5.30)
Dmitry Stogov authored Sep 3, 2009
342 zend_vm_stack_free_int(p TSRMLS_CC);
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
343 }
344
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
345 static zend_always_inline zval** zend_vm_stack_get_arg(int requested_arg TSRMLS_DC)
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
346 {
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
347 void **p = EG(current_execute_data)->prev_execute_data->function_state.arguments;
e1814f0 WIN64 support
Dmitry Stogov authored Apr 16, 2007
348 int arg_count = (int)(zend_uintptr_t) *p;
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
349
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
350 if (UNEXPECTED(requested_arg > arg_count)) {
351 return NULL;
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
352 }
0b68251 Changed EG(argument_stack) implementation.
Dmitry Stogov authored Jan 24, 2008
353 return (zval**)p - arg_count + requested_arg - 1;
df74f1d Add optional support for C0x inline semantics.
Sascha Schumann authored Jun 13, 2000
354 }
39a7f4c @zsuraski This patch is a go. Not fully optimized yet, but working properly.
zsuraski authored Apr 12, 1999
355
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
356 static zend_always_inline void zend_arg_types_stack_2_pop(zend_ptr_stack *stack, zval **object, zend_function **fbc)
85b9327 @arnaud-lb MFH: better fix for #48409 , #48428 , #48228
arnaud-lb authored Jun 5, 2009
357 {
358 void *a, *b;
359
360 zend_ptr_stack_2_pop(stack, &a, &b);
361
ba79cd5 @pierrejoye - fix build (void alarm)
pierrejoye authored Jun 9, 2009
362 *object = (zval *) a;
363 *fbc = (zend_function *) b;
85b9327 @arnaud-lb MFH: better fix for #48409 , #48428 , #48228
arnaud-lb authored Jun 5, 2009
364 }
365
453b49e Added a number of small performance tweaks and optimizations
Dmitry Stogov authored Apr 20, 2010
366 static zend_always_inline void zend_arg_types_stack_3_pop(zend_ptr_stack *stack, zend_class_entry **called_scope, zval **object, zend_function **fbc)
85b9327 @arnaud-lb MFH: better fix for #48409 , #48428 , #48228
arnaud-lb authored Jun 5, 2009
367 {
368 void *a, *b, *c;
369
370 zend_ptr_stack_3_pop(stack, &a, &b, &c);
371
ba79cd5 @pierrejoye - fix build (void alarm)
pierrejoye authored Jun 9, 2009
372 *called_scope = (zend_class_entry *) a;
373 *object = (zval *) b;
374 *fbc = (zend_function *) c;
85b9327 @arnaud-lb MFH: better fix for #48409 , #48428 , #48228
arnaud-lb authored Jun 5, 2009
375 }
376
b4f3b9d @zsuraski Redesigned thread safety mechanism - nua nua
zsuraski authored Jul 28, 2001
377 void execute_new_code(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
378
379
380 /* services */
e43ff13 Fixed ZE specific compile warnings (Bug #55629)
Dmitry Stogov authored Sep 13, 2011
381 ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC);
382 ZEND_API const char *get_active_function_name(TSRMLS_D);
383 ZEND_API const char *zend_get_executed_filename(TSRMLS_D);
2c254ba @zsuraski Get rid of ELS_*(), and use TSRMLS_*() instead.
zsuraski authored Jul 27, 2001
384 ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 30, 2001
385 ZEND_API zend_bool zend_is_executing(TSRMLS_D);
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
386
6c15837 @rlerdorf exit_on_timeout patch
rlerdorf authored Mar 18, 2008
387 ZEND_API void zend_set_timeout(long seconds, int reset_signals);
4187439 @zsuraski More TSRMLS_FETCH work
zsuraski authored Jul 30, 2001
388 ZEND_API void zend_unset_timeout(TSRMLS_D);
b72a273 @andigutmans - Forgot ZEND_API
andigutmans authored Jul 2, 2000
389 ZEND_API void zend_timeout(int dummy);
6c810b0 Improved memory usage by movig constants to read only memory. (Dmitry…
Dmitry Stogov authored Sep 27, 2007
390 ZEND_API zend_class_entry *zend_fetch_class(const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC);
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored Apr 20, 2010
391 ZEND_API zend_class_entry *zend_fetch_class_by_name(const char *class_name, uint class_name_len, const zend_literal *key, int fetch_type TSRMLS_DC);
c5d8422 @zsuraski Reinstate early-binding for classes.
zsuraski authored Feb 4, 2004
392 void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored Jun 16, 2000
393
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored Jun 16, 2000
394 #ifdef ZEND_WIN32
226c56f MFH: Fixed compiler warnings
Jani Taskinen authored Jul 21, 2007
395 void zend_init_timeout_thread(void);
396 void zend_shutdown_timeout_thread(void);
84eb48f @zsuraski Ok, this time here's some real Win32 system programming :)
zsuraski authored Jun 16, 2000
397 #define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
398 #define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
ef0bd3d @zsuraski - Move timeout code to Zend
zsuraski authored Jun 16, 2000
399 #endif
400
573b460 @andigutmans Zend Library
andigutmans authored Apr 7, 1999
401 #define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p))
402 #define zendi_zval_dtor(p) zval_dtor(&(p))
403
404 #define active_opline (*EG(opline_ptr))
405
e8214a3 @andigutmans - Commit Marcus' cleanup of abstract and static inheritance and improve
andigutmans authored Nov 23, 2002
406 /* The following tries to resolve the classname of a zval of type object.
407 * Since it is slow it should be only used in error messages.
408 */
637a404 - MFH as discussed
Marcus Boerger authored May 9, 2006
409 #define Z_OBJ_CLASS_NAME_P(zval) ((zval) && Z_TYPE_P(zval) == IS_OBJECT && Z_OBJ_HT_P(zval)->get_class_entry != NULL && Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC) ? Z_OBJ_HT_P(zval)->get_class_entry(zval TSRMLS_CC)->name : "")
e8214a3 @andigutmans - Commit Marcus' cleanup of abstract and static inheritance and improve
andigutmans authored Nov 23, 2002
410
cf7384a @felipensp - MFH: Constness (Added const qualifier to several function parameters)
felipensp authored Aug 12, 2008
411 ZEND_API zval** zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, zend_uint var);
8838c0f @andigutmans - Two new API calls for Derick (retreive CV name and value) by Dmitry
andigutmans authored Jan 22, 2005
412
84b96e9 Fix so that extensions like xdebug, can overload opcodes in all execu…
Dmitry Stogov authored Jun 10, 2005
413 #define ZEND_USER_OPCODE_CONTINUE 0 /* execute next opcode */
414 #define ZEND_USER_OPCODE_RETURN 1 /* exit from executor (return from function) */
415 #define ZEND_USER_OPCODE_DISPATCH 2 /* call original opcode handler */
f1ab855 Fixed ability to call user functions from user opcodes without recursion
Dmitry Stogov authored Aug 18, 2009
416 #define ZEND_USER_OPCODE_ENTER 3 /* enter into new op_array without recursion */
417 #define ZEND_USER_OPCODE_LEAVE 4 /* return to calling op_array within the same executor */
84b96e9 Fix so that extensions like xdebug, can overload opcodes in all execu…
Dmitry Stogov authored Jun 10, 2005
418
3c1a774 USER_OPCODE API is improvet.
Dmitry Stogov authored Jun 16, 2005
419 #define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
420
76a9a42 - Removed direct executor recursion.
Dmitry Stogov authored Jun 11, 2008
421 ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler);
422 ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
84b96e9 Fix so that extensions like xdebug, can overload opcodes in all execu…
Dmitry Stogov authored Jun 10, 2005
423
87c9e68 @smalyshev export zval getters
smalyshev authored Jun 16, 2005
424 /* former zend_execute_locks.h */
425 typedef struct _zend_free_op {
426 zval* var;
427 /* int is_var; */
428 } zend_free_op;
429
94dd837 Changed the structure of op_array.opcodes. The constant values are mo…
Dmitry Stogov authored Apr 20, 2010
430 ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC);
431 ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC);
87c9e68 @smalyshev export zval getters
smalyshev authored Jun 16, 2005
432
61b9ded Export zend_do_fcall() helper from executor
Dmitry Stogov authored Jun 24, 2005
433 ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
87c9e68 @smalyshev export zval getters
smalyshev authored Jun 16, 2005
434
4aab08b @nikic Properly free resources when generator return value not used
nikic authored May 28, 2012
435 void zend_clean_and_cache_symbol_table(HashTable *symbol_table);
436 void zend_free_compiled_variables(zval ***CVs, int num);
f169b26 @nikic Fix backtraces and func_get_args()
nikic authored Jun 9, 2012
437 void **zend_copy_arguments(void **arguments_end);
4aab08b @nikic Properly free resources when generator return value not used
nikic authored May 28, 2012
438
c5237d8 Added caches to eliminate repeatable run-time bindings of functions, …
Dmitry Stogov authored May 24, 2010
439 #define CACHED_PTR(num) \
440 EG(active_op_array)->run_time_cache[(num)]
441
442 #define CACHE_PTR(num, ptr) do { \
443 EG(active_op_array)->run_time_cache[(num)] = (ptr); \
444 } while (0)
445
446 #define CACHED_POLYMORPHIC_PTR(num, ce) \
447 ((EG(active_op_array)->run_time_cache[(num)] == (ce)) ? \
448 EG(active_op_array)->run_time_cache[(num) + 1] : \
449 NULL)
450
451 #define CACHE_POLYMORPHIC_PTR(num, ce, ptr) do { \
452 EG(active_op_array)->run_time_cache[(num)] = (ce); \
453 EG(active_op_array)->run_time_cache[(num) + 1] = (ptr); \
454 } while (0)
455
0450ab9 @zsuraski MFZE1 (Expose more C++ APIs)
zsuraski authored May 20, 2002
456 END_EXTERN_C()
457
a617217 Replace macros which begin with an underscore through an appropiately
Sascha Schumann authored Jul 3, 2000
458 #endif /* ZEND_EXECUTE_H */
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored Feb 1, 2003
459
460 /*
461 * Local variables:
462 * tab-width: 4
463 * c-basic-offset: 4
464 * indent-tabs-mode: t
465 * End:
466 */
Something went wrong with that request. Please try again.