Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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