1999-04-08 02:10:10 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Zend Engine |
|
|
|
|
+----------------------------------------------------------------------+
|
2014-01-03 11:08:10 +08:00
|
|
|
| Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2001-12-11 23:16:21 +08:00
|
|
|
| This source file is subject to version 2.00 of the Zend license, |
|
2012-10-05 14:14:20 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-11 04:04:29 +08:00
|
|
|
| available through the world-wide-web at the following url: |
|
2001-12-11 23:16:21 +08:00
|
|
|
| http://www.zend.com/license/2_00.txt. |
|
1999-07-16 22:58:16 +08:00
|
|
|
| If you did not receive a copy of the Zend license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@zend.com so we can mail you a copy immediately. |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Andi Gutmans <andi@zend.com> |
|
|
|
|
| Zeev Suraski <zeev@zend.com> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
2003-02-01 09:49:15 +08:00
|
|
|
/* $Id$ */
|
1999-07-16 22:58:16 +08:00
|
|
|
|
2000-07-03 08:55:36 +08:00
|
|
|
#ifndef ZEND_EXECUTE_H
|
|
|
|
#define ZEND_EXECUTE_H
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
#include "zend_compile.h"
|
|
|
|
#include "zend_hash.h"
|
2001-07-29 16:24:38 +08:00
|
|
|
#include "zend_operators.h"
|
2006-05-10 07:53:23 +08:00
|
|
|
#include "zend_variables.h"
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2002-05-20 15:17:30 +08:00
|
|
|
BEGIN_EXTERN_C()
|
2012-10-05 14:14:20 +08:00
|
|
|
struct _zend_fcall_info;
|
2012-11-30 17:39:23 +08:00
|
|
|
ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data TSRMLS_DC);
|
2014-07-07 19:50:44 +08:00
|
|
|
ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data, zval *return_value TSRMLS_DC);
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2001-07-28 18:51:54 +08:00
|
|
|
void init_executor(TSRMLS_D);
|
2001-07-27 18:10:39 +08:00
|
|
|
void shutdown_executor(TSRMLS_D);
|
2004-07-25 15:14:49 +08:00
|
|
|
void shutdown_destructors(TSRMLS_D);
|
2014-07-07 19:50:44 +08:00
|
|
|
ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, vm_frame_kind frame_kind TSRMLS_DC);
|
|
|
|
ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data *call, zend_op_array *op_array, zval *return_value TSRMLS_DC);
|
2014-02-12 18:29:51 +08:00
|
|
|
ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC);
|
2012-05-26 23:53:13 +08:00
|
|
|
ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC);
|
2014-07-07 19:50:44 +08:00
|
|
|
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value TSRMLS_DC);
|
2013-12-18 14:25:05 +08:00
|
|
|
ZEND_API int zend_is_true(zval *op TSRMLS_DC);
|
2014-02-10 14:04:30 +08:00
|
|
|
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name TSRMLS_DC);
|
2014-04-17 19:40:45 +08:00
|
|
|
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *key, int use_autoload TSRMLS_DC);
|
2001-07-28 18:51:54 +08:00
|
|
|
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
|
2009-06-06 02:50:32 +08:00
|
|
|
ZEND_API int zend_eval_stringl(char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC);
|
2003-08-24 21:10:03 +08:00
|
|
|
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
|
2009-06-06 02:50:32 +08:00
|
|
|
ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
|
2002-02-07 22:08:43 +08:00
|
|
|
|
2014-08-26 01:24:55 +08:00
|
|
|
ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, zend_ulong fetch_type, char **class_name, zend_class_entry **pce TSRMLS_DC);
|
2014-08-26 01:28:33 +08:00
|
|
|
ZEND_API void zend_verify_arg_error(int error_type, const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg TSRMLS_DC);
|
2010-10-19 18:42:38 +08:00
|
|
|
|
2013-09-14 20:40:48 +08:00
|
|
|
static zend_always_inline void i_zval_ptr_dtor(zval *zval_ptr ZEND_FILE_LINE_DC TSRMLS_DC)
|
2010-04-20 19:16:39 +08:00
|
|
|
{
|
2014-04-03 19:26:23 +08:00
|
|
|
if (Z_REFCOUNTED_P(zval_ptr)) {
|
2014-02-17 15:50:32 +08:00
|
|
|
if (!Z_DELREF_P(zval_ptr)) {
|
|
|
|
ZEND_ASSERT(zval_ptr != &EG(uninitialized_zval));
|
2014-09-18 08:02:43 +08:00
|
|
|
_zval_dtor_func_for_ptr(Z_COUNTED_P(zval_ptr) ZEND_FILE_LINE_RELAY_CC);
|
2014-02-17 15:50:32 +08:00
|
|
|
} else {
|
|
|
|
GC_ZVAL_CHECK_POSSIBLE_ROOT(zval_ptr);
|
2010-04-20 19:16:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-18 14:25:05 +08:00
|
|
|
static zend_always_inline int i_zend_is_true(zval *op TSRMLS_DC)
|
2000-06-14 01:58:33 +08:00
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
2014-03-05 22:31:02 +08:00
|
|
|
again:
|
2006-05-10 07:53:23 +08:00
|
|
|
switch (Z_TYPE_P(op)) {
|
2014-04-07 18:56:34 +08:00
|
|
|
case IS_UNDEF:
|
2000-06-14 01:58:33 +08:00
|
|
|
case IS_NULL:
|
2014-04-30 22:32:42 +08:00
|
|
|
case IS_FALSE:
|
2000-06-14 01:58:33 +08:00
|
|
|
result = 0;
|
|
|
|
break;
|
2014-04-30 22:32:42 +08:00
|
|
|
case IS_TRUE:
|
|
|
|
result = 1;
|
|
|
|
break;
|
2014-08-26 01:24:55 +08:00
|
|
|
case IS_LONG:
|
|
|
|
result = (Z_LVAL_P(op)?1:0);
|
2000-06-14 01:58:33 +08:00
|
|
|
break;
|
2014-04-30 22:32:42 +08:00
|
|
|
case IS_RESOURCE:
|
|
|
|
result = (Z_RES_HANDLE_P(op)?1:0);
|
|
|
|
break;
|
2000-06-14 01:58:33 +08:00
|
|
|
case IS_DOUBLE:
|
2006-05-10 07:53:23 +08:00
|
|
|
result = (Z_DVAL_P(op) ? 1 : 0);
|
2000-06-14 01:58:33 +08:00
|
|
|
break;
|
|
|
|
case IS_STRING:
|
2014-08-26 01:24:55 +08:00
|
|
|
if (Z_STRLEN_P(op) == 0
|
|
|
|
|| (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
|
2000-06-14 01:58:33 +08:00
|
|
|
result = 0;
|
|
|
|
} else {
|
|
|
|
result = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case IS_ARRAY:
|
2006-05-10 07:53:23 +08:00
|
|
|
result = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
|
2000-06-14 01:58:33 +08:00
|
|
|
break;
|
|
|
|
case IS_OBJECT:
|
2014-03-05 22:31:02 +08:00
|
|
|
if (IS_ZEND_STD_OBJECT(*op)) {
|
2005-09-12 19:48:57 +08:00
|
|
|
if (Z_OBJ_HT_P(op)->cast_object) {
|
|
|
|
zval tmp;
|
2014-04-30 22:32:42 +08:00
|
|
|
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL TSRMLS_CC) == SUCCESS) {
|
|
|
|
result = Z_TYPE(tmp) == IS_TRUE;
|
2005-09-12 19:48:57 +08:00
|
|
|
break;
|
|
|
|
}
|
2014-05-07 01:03:02 +08:00
|
|
|
zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", Z_OBJ_P(op)->ce->name->val);
|
2005-09-12 19:48:57 +08:00
|
|
|
} else if (Z_OBJ_HT_P(op)->get) {
|
2014-04-15 11:05:03 +08:00
|
|
|
zval rv;
|
|
|
|
zval *tmp = Z_OBJ_HT_P(op)->get(op, &rv TSRMLS_CC);
|
|
|
|
if (Z_TYPE_P(tmp) != IS_OBJECT) {
|
2005-09-12 19:48:57 +08:00
|
|
|
/* for safety - avoid loop */
|
|
|
|
convert_to_boolean(tmp);
|
2014-04-30 22:32:42 +08:00
|
|
|
result = Z_TYPE_P(tmp) == IS_TRUE;
|
2014-02-10 14:04:30 +08:00
|
|
|
zval_ptr_dtor(tmp);
|
2005-09-12 19:48:57 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-03-04 21:06:02 +08:00
|
|
|
}
|
2008-03-18 22:10:45 +08:00
|
|
|
result = 1;
|
2000-06-14 01:58:33 +08:00
|
|
|
break;
|
2014-03-05 22:31:02 +08:00
|
|
|
case IS_REFERENCE:
|
|
|
|
op = Z_REFVAL_P(op);
|
|
|
|
goto again;
|
|
|
|
break;
|
2000-06-14 01:58:33 +08:00
|
|
|
default:
|
|
|
|
result = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2014-04-26 04:32:51 +08:00
|
|
|
ZEND_API int zval_update_constant(zval *pp, zend_bool inline_change TSRMLS_DC);
|
|
|
|
ZEND_API int zval_update_constant_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
|
|
|
|
ZEND_API int zval_update_constant_no_inline_change(zval *pp, zend_class_entry *scope TSRMLS_DC);
|
|
|
|
ZEND_API int zval_update_constant_ex(zval *pp, zend_bool inline_change, zend_class_entry *scope TSRMLS_DC);
|
1999-04-08 02:10:10 +08:00
|
|
|
|
1999-04-13 02:29:09 +08:00
|
|
|
/* dedicated Zend executor functions - do not use! */
|
2014-06-27 03:51:14 +08:00
|
|
|
#define ZEND_VM_STACK_PAGE_SIZE (16 * 1024) /* should be a power of 2 */
|
2008-01-24 17:41:39 +08:00
|
|
|
|
|
|
|
struct _zend_vm_stack {
|
2014-02-10 14:04:30 +08:00
|
|
|
zval *top;
|
|
|
|
zval *end;
|
2008-01-24 17:41:39 +08:00
|
|
|
zend_vm_stack prev;
|
|
|
|
};
|
|
|
|
|
2014-06-27 03:51:14 +08:00
|
|
|
#define ZEND_VM_STACK_HEADER_SLOT \
|
|
|
|
((ZEND_MM_ALIGNED_SIZE(sizeof(struct _zend_vm_stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval)) - 1) / ZEND_MM_ALIGNED_SIZE(sizeof(zval)))
|
|
|
|
|
2009-09-03 22:33:11 +08:00
|
|
|
#define ZEND_VM_STACK_ELEMETS(stack) \
|
2014-06-27 03:51:14 +08:00
|
|
|
(((zval*)(stack)) + ZEND_VM_STACK_HEADER_SLOT)
|
2009-09-03 22:33:11 +08:00
|
|
|
|
2014-06-27 19:48:25 +08:00
|
|
|
#define ZEND_VM_STACK_GROW_IF_NEEDED(count) \
|
|
|
|
do { \
|
|
|
|
if (UNEXPECTED(((count) * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) > \
|
2014-07-15 19:51:40 +08:00
|
|
|
(size_t)(((char*)EG(argument_stack)->end) - \
|
|
|
|
((char*)EG(argument_stack)->top)))) { \
|
2014-06-27 19:48:25 +08:00
|
|
|
zend_vm_stack_extend((count) TSRMLS_CC); \
|
|
|
|
} \
|
2008-01-24 17:41:39 +08:00
|
|
|
} while (0)
|
|
|
|
|
2010-04-20 19:16:39 +08:00
|
|
|
static zend_always_inline zend_vm_stack zend_vm_stack_new_page(int count) {
|
2014-06-27 03:51:14 +08:00
|
|
|
zend_vm_stack page = (zend_vm_stack)emalloc(count * ZEND_MM_ALIGNED_SIZE(sizeof(zval)));
|
2008-01-24 17:41:39 +08:00
|
|
|
|
2009-09-03 22:33:11 +08:00
|
|
|
page->top = ZEND_VM_STACK_ELEMETS(page);
|
2014-06-27 03:51:14 +08:00
|
|
|
page->end = (zval*)page + count;
|
2008-01-24 17:41:39 +08:00
|
|
|
page->prev = NULL;
|
|
|
|
return page;
|
|
|
|
}
|
|
|
|
|
2010-04-20 19:16:39 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_init(TSRMLS_D)
|
2008-01-24 17:41:39 +08:00
|
|
|
{
|
|
|
|
EG(argument_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE);
|
2014-06-27 03:51:14 +08:00
|
|
|
EG(argument_stack)->top++;
|
2008-01-24 17:41:39 +08:00
|
|
|
}
|
|
|
|
|
2010-04-20 19:16:39 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_destroy(TSRMLS_D)
|
2008-01-24 17:41:39 +08:00
|
|
|
{
|
|
|
|
zend_vm_stack stack = EG(argument_stack);
|
|
|
|
|
|
|
|
while (stack != NULL) {
|
|
|
|
zend_vm_stack p = stack->prev;
|
|
|
|
efree(stack);
|
|
|
|
stack = p;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 18:06:22 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_extend(uint32_t count TSRMLS_DC)
|
2008-01-24 17:41:39 +08:00
|
|
|
{
|
2014-09-04 18:06:22 +08:00
|
|
|
uint32_t size = count * ZEND_MM_ALIGNED_SIZE(sizeof(zval));
|
2014-06-27 03:51:14 +08:00
|
|
|
zend_vm_stack p = zend_vm_stack_new_page(
|
2014-06-27 19:48:25 +08:00
|
|
|
(size >= (ZEND_VM_STACK_PAGE_SIZE - ZEND_VM_STACK_HEADER_SLOT) * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) ?
|
|
|
|
(size + ((ZEND_VM_STACK_HEADER_SLOT + ZEND_VM_STACK_PAGE_SIZE) * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) - 1) &
|
|
|
|
~((ZEND_VM_STACK_PAGE_SIZE * ZEND_MM_ALIGNED_SIZE(sizeof(zval))) - 1) :
|
|
|
|
ZEND_VM_STACK_PAGE_SIZE);
|
2008-01-24 17:41:39 +08:00
|
|
|
p->prev = EG(argument_stack);
|
|
|
|
EG(argument_stack) = p;
|
|
|
|
}
|
|
|
|
|
2014-08-26 01:28:33 +08:00
|
|
|
static zend_always_inline zend_execute_data *zend_vm_stack_push_call_frame(zend_function *func, uint32_t num_args, zend_uchar flags, zend_class_entry *called_scope, zend_object *object, zend_execute_data *prev TSRMLS_DC)
|
2014-06-24 06:17:16 +08:00
|
|
|
{
|
2014-09-04 18:06:22 +08:00
|
|
|
uint32_t used_stack = ZEND_CALL_FRAME_SLOT + num_args;
|
2014-06-27 03:51:14 +08:00
|
|
|
zend_execute_data *call;
|
|
|
|
|
2014-06-27 17:02:49 +08:00
|
|
|
if (ZEND_USER_CODE(func->type)) {
|
2014-06-27 16:25:36 +08:00
|
|
|
used_stack += func->op_array.last_var + func->op_array.T - MIN(func->op_array.num_args, num_args);
|
2014-06-27 03:51:14 +08:00
|
|
|
}
|
|
|
|
ZEND_VM_STACK_GROW_IF_NEEDED(used_stack);
|
|
|
|
call = (zend_execute_data*)EG(argument_stack)->top;
|
2014-06-27 19:48:25 +08:00
|
|
|
EG(argument_stack)->top += used_stack;
|
2014-06-24 06:17:16 +08:00
|
|
|
call->func = func;
|
2014-06-30 18:17:17 +08:00
|
|
|
call->num_args = 0;
|
2014-06-24 06:17:16 +08:00
|
|
|
call->flags = flags;
|
|
|
|
call->called_scope = called_scope;
|
|
|
|
call->object = object;
|
2014-06-27 03:51:14 +08:00
|
|
|
call->prev_nested_call = prev;
|
2014-06-24 06:17:16 +08:00
|
|
|
return call;
|
|
|
|
}
|
|
|
|
|
2014-06-27 03:51:14 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_free_extra_args(zend_execute_data *call TSRMLS_DC)
|
2012-10-05 14:14:20 +08:00
|
|
|
{
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t first_extra_arg = call->func->op_array.num_args - ((call->func->common.fn_flags & ZEND_ACC_VARIADIC) != 0);
|
2014-06-30 18:17:17 +08:00
|
|
|
|
|
|
|
if (UNEXPECTED(call->num_args > first_extra_arg)) {
|
2014-06-27 16:25:36 +08:00
|
|
|
zval *end = EX_VAR_NUM_2(call, call->func->op_array.last_var + call->func->op_array.T);
|
2014-06-30 18:17:17 +08:00
|
|
|
zval *p = end + (call->num_args - first_extra_arg);
|
2014-06-27 03:51:14 +08:00
|
|
|
do {
|
|
|
|
p--;
|
2014-09-03 21:16:32 +08:00
|
|
|
zval_ptr_dtor_nogc(p);
|
2014-06-27 03:51:14 +08:00
|
|
|
} while (p != end);
|
|
|
|
}
|
2009-09-03 22:33:11 +08:00
|
|
|
}
|
|
|
|
|
2014-06-27 03:51:14 +08:00
|
|
|
static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call TSRMLS_DC)
|
2000-06-14 01:58:33 +08:00
|
|
|
{
|
2014-08-26 01:28:33 +08:00
|
|
|
uint32_t num_args = call->num_args;
|
2000-06-14 01:58:33 +08:00
|
|
|
|
2014-06-24 06:17:16 +08:00
|
|
|
if (num_args > 0) {
|
2014-07-07 19:50:44 +08:00
|
|
|
zval *end = ZEND_CALL_ARG(call, 1);
|
|
|
|
zval *p = end + num_args;
|
2014-06-27 16:25:36 +08:00
|
|
|
|
2014-06-16 17:25:23 +08:00
|
|
|
do {
|
|
|
|
p--;
|
2014-09-03 21:16:32 +08:00
|
|
|
zval_ptr_dtor_nogc(p);
|
2014-06-16 17:25:23 +08:00
|
|
|
} while (p != end);
|
2000-06-14 01:58:33 +08:00
|
|
|
}
|
2014-06-27 03:51:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static zend_always_inline void zend_vm_stack_free_call_frame(zend_execute_data *call TSRMLS_DC)
|
|
|
|
{
|
|
|
|
if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (zval*)call)) {
|
|
|
|
zend_vm_stack p = EG(argument_stack);
|
|
|
|
|
|
|
|
EG(argument_stack) = p->prev;
|
|
|
|
efree(p);
|
2012-12-13 21:29:30 +08:00
|
|
|
} else {
|
2014-06-27 03:51:14 +08:00
|
|
|
EG(argument_stack)->top = (zval*)call;
|
2012-12-13 21:29:30 +08:00
|
|
|
}
|
2000-06-14 01:58:33 +08:00
|
|
|
}
|
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
/* services */
|
2011-09-13 21:29:35 +08:00
|
|
|
ZEND_API const char *get_active_class_name(const char **space TSRMLS_DC);
|
|
|
|
ZEND_API const char *get_active_function_name(TSRMLS_D);
|
|
|
|
ZEND_API const char *zend_get_executed_filename(TSRMLS_D);
|
2001-07-27 18:10:39 +08:00
|
|
|
ZEND_API uint zend_get_executed_lineno(TSRMLS_D);
|
2001-07-30 15:43:02 +08:00
|
|
|
ZEND_API zend_bool zend_is_executing(TSRMLS_D);
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2014-08-26 01:24:55 +08:00
|
|
|
ZEND_API void zend_set_timeout(zend_long seconds, int reset_signals);
|
2001-07-30 15:43:02 +08:00
|
|
|
ZEND_API void zend_unset_timeout(TSRMLS_D);
|
2000-07-02 23:39:54 +08:00
|
|
|
ZEND_API void zend_timeout(int dummy);
|
2014-02-10 14:04:30 +08:00
|
|
|
ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type TSRMLS_DC);
|
2014-04-17 19:40:45 +08:00
|
|
|
ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval *key, int fetch_type TSRMLS_DC);
|
2004-02-05 00:30:15 +08:00
|
|
|
void zend_verify_abstract_class(zend_class_entry *ce TSRMLS_DC);
|
2000-06-16 22:27:28 +08:00
|
|
|
|
2014-08-04 17:56:27 +08:00
|
|
|
ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim TSRMLS_DC);
|
2014-04-12 00:21:46 +08:00
|
|
|
|
2000-06-16 09:54:56 +08:00
|
|
|
#ifdef ZEND_WIN32
|
2007-07-21 08:35:15 +08:00
|
|
|
void zend_init_timeout_thread(void);
|
|
|
|
void zend_shutdown_timeout_thread(void);
|
2000-06-16 22:27:28 +08:00
|
|
|
#define WM_REGISTER_ZEND_TIMEOUT (WM_USER+1)
|
|
|
|
#define WM_UNREGISTER_ZEND_TIMEOUT (WM_USER+2)
|
2000-06-16 09:54:56 +08:00
|
|
|
#endif
|
|
|
|
|
2002-11-24 04:44:12 +08:00
|
|
|
/* The following tries to resolve the classname of a zval of type object.
|
|
|
|
* Since it is slow it should be only used in error messages.
|
|
|
|
*/
|
2014-03-28 06:11:22 +08:00
|
|
|
#define Z_OBJ_CLASS_NAME_P(obj) (((obj) && (obj)->handlers->get_class_entry != NULL && (obj)->handlers->get_class_entry) ? (obj)->handlers->get_class_entry(obj TSRMLS_CC)->name->val : "")
|
2002-11-24 04:44:12 +08:00
|
|
|
|
2014-08-26 01:28:33 +08:00
|
|
|
ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data_ptr, uint32_t var);
|
2005-01-22 10:29:18 +08:00
|
|
|
|
2005-06-10 17:54:38 +08:00
|
|
|
#define ZEND_USER_OPCODE_CONTINUE 0 /* execute next opcode */
|
|
|
|
#define ZEND_USER_OPCODE_RETURN 1 /* exit from executor (return from function) */
|
|
|
|
#define ZEND_USER_OPCODE_DISPATCH 2 /* call original opcode handler */
|
2009-08-18 18:12:32 +08:00
|
|
|
#define ZEND_USER_OPCODE_ENTER 3 /* enter into new op_array without recursion */
|
|
|
|
#define ZEND_USER_OPCODE_LEAVE 4 /* return to calling op_array within the same executor */
|
2005-06-10 17:54:38 +08:00
|
|
|
|
2005-06-16 14:00:48 +08:00
|
|
|
#define ZEND_USER_OPCODE_DISPATCH_TO 0x100 /* call original handler of returned opcode */
|
|
|
|
|
2008-06-11 21:18:41 +08:00
|
|
|
ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler);
|
|
|
|
ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode);
|
2005-06-10 17:54:38 +08:00
|
|
|
|
2005-06-16 19:50:08 +08:00
|
|
|
/* former zend_execute_locks.h */
|
|
|
|
typedef struct _zend_free_op {
|
2014-03-04 16:27:50 +08:00
|
|
|
zval *var;
|
2005-06-16 19:50:08 +08:00
|
|
|
/* int is_var; */
|
|
|
|
} zend_free_op;
|
|
|
|
|
2012-12-04 14:14:39 +08:00
|
|
|
ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC);
|
2005-06-16 19:50:08 +08:00
|
|
|
|
2005-06-24 20:33:53 +08:00
|
|
|
ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS);
|
2005-06-16 19:50:08 +08:00
|
|
|
|
2014-03-18 03:15:22 +08:00
|
|
|
void zend_clean_and_cache_symbol_table(zend_array *symbol_table TSRMLS_DC);
|
2013-09-14 20:40:48 +08:00
|
|
|
void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC);
|
2012-05-28 12:43:18 +08:00
|
|
|
|
2010-05-24 22:11:39 +08:00
|
|
|
#define CACHED_PTR(num) \
|
2014-04-17 20:36:04 +08:00
|
|
|
EX(run_time_cache)[(num)]
|
2010-05-24 22:11:39 +08:00
|
|
|
|
|
|
|
#define CACHE_PTR(num, ptr) do { \
|
2014-04-17 20:36:04 +08:00
|
|
|
EX(run_time_cache)[(num)] = (ptr); \
|
2010-05-24 22:11:39 +08:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
#define CACHED_POLYMORPHIC_PTR(num, ce) \
|
2014-04-17 20:36:04 +08:00
|
|
|
((EX(run_time_cache)[(num)] == (ce)) ? \
|
|
|
|
EX(run_time_cache)[(num) + 1] : \
|
2010-05-24 22:11:39 +08:00
|
|
|
NULL)
|
|
|
|
|
|
|
|
#define CACHE_POLYMORPHIC_PTR(num, ce, ptr) do { \
|
2014-04-17 20:36:04 +08:00
|
|
|
EX(run_time_cache)[(num)] = (ce); \
|
|
|
|
EX(run_time_cache)[(num) + 1] = (ptr); \
|
|
|
|
} while (0)
|
|
|
|
|
2014-07-08 00:54:31 +08:00
|
|
|
#define CACHED_PTR_EX(slot) \
|
|
|
|
(slot)[0]
|
2014-04-17 20:36:04 +08:00
|
|
|
|
2014-07-08 00:54:31 +08:00
|
|
|
#define CACHE_PTR_EX(slot, ptr) do { \
|
|
|
|
(slot)[0] = (ptr); \
|
2014-04-17 20:36:04 +08:00
|
|
|
} while (0)
|
|
|
|
|
2014-07-08 00:54:31 +08:00
|
|
|
#define CACHED_POLYMORPHIC_PTR_EX(slot, ce) \
|
|
|
|
(((slot)[0] == (ce)) ? (slot)[1] : NULL)
|
2014-04-17 20:36:04 +08:00
|
|
|
|
2014-07-08 00:54:31 +08:00
|
|
|
#define CACHE_POLYMORPHIC_PTR_EX(slot, ce, ptr) do { \
|
|
|
|
(slot)[0] = (ce); \
|
|
|
|
(slot)[1] = (ptr); \
|
2010-05-24 22:11:39 +08:00
|
|
|
} while (0)
|
|
|
|
|
2002-05-20 15:17:30 +08:00
|
|
|
END_EXTERN_C()
|
|
|
|
|
2000-07-03 08:55:36 +08:00
|
|
|
#endif /* ZEND_EXECUTE_H */
|
2003-02-01 09:49:15 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*/
|