Back to index

php5  5.3.10
Classes | Defines | Typedefs | Functions | Variables
zend_execute.h File Reference
#include "zend_compile.h"
#include "zend_hash.h"
#include "zend_operators.h"
#include "zend_variables.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  _temp_variable
struct  _zend_vm_stack
struct  _zend_free_op
struct  _temp_variable.var
struct  _temp_variable.str_offset
struct  _temp_variable.fe

Defines

#define safe_free_zval_ptr(p)   safe_free_zval_ptr_rel(p ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
#define ZEND_VM_STACK_PAGE_SIZE   ((64 * 1024) - 64)
#define ZEND_VM_STACK_ELEMETS(stack)   ((void**)(((char*)(stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(struct _zend_vm_stack))))
#define ZEND_VM_STACK_GROW_IF_NEEDED(count)
#define zendi_zval_copy_ctor(p)   zval_copy_ctor(&(p))
#define zendi_zval_dtor(p)   zval_dtor(&(p))
#define active_opline   (*EG(opline_ptr))
#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 : "")
#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 */
#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 */
#define ZEND_USER_OPCODE_DISPATCH_TO   0x100 /* call original handler of returned opcode */

Typedefs

typedef union _temp_variable temp_variable
typedef struct _zend_free_op zend_free_op

Functions

void init_executor (TSRMLS_D)
void shutdown_executor (TSRMLS_D)
void shutdown_destructors (TSRMLS_D)
ZEND_API void execute (zend_op_array *op_array TSRMLS_DC)
ZEND_API void execute_internal (zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)
ZEND_API int zend_is_true (zval *op)
static void safe_free_zval_ptr_rel (zval *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
ZEND_API int zend_lookup_class (const char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
ZEND_API int zend_lookup_class_ex (const char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC)
ZEND_API int zend_eval_string (char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
ZEND_API int zend_eval_stringl (char *str, int str_len, zval *retval_ptr, char *string_name TSRMLS_DC)
ZEND_API int zend_eval_string_ex (char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC)
ZEND_API int zend_eval_stringl_ex (char *str, int str_len, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC)
static int i_zend_is_true (zval *op)
ZEND_API int zval_update_constant (zval **pp, void *arg TSRMLS_DC)
ZEND_API int zval_update_constant_inline_change (zval **pp, void *arg TSRMLS_DC)
ZEND_API int zval_update_constant_no_inline_change (zval **pp, void *arg TSRMLS_DC)
ZEND_API int zval_update_constant_ex (zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC)
static zend_vm_stack zend_vm_stack_new_page (int count)
static void zend_vm_stack_init (TSRMLS_D)
static void zend_vm_stack_destroy (TSRMLS_D)
static void zend_vm_stack_extend (int count TSRMLS_DC)
static void ** zend_vm_stack_top (TSRMLS_D)
static void zend_vm_stack_push (void *ptr TSRMLS_DC)
static void zend_vm_stack_push_nocheck (void *ptr TSRMLS_DC)
static void * zend_vm_stack_pop (TSRMLS_D)
static void * zend_vm_stack_alloc (size_t size TSRMLS_DC)
static void zend_vm_stack_free_int (void *ptr TSRMLS_DC)
static void zend_vm_stack_free (void *ptr TSRMLS_DC)
static void ** zend_vm_stack_push_args (int count TSRMLS_DC)
static void zend_vm_stack_clear_multiple (TSRMLS_D)
static zval ** zend_vm_stack_get_arg (int requested_arg TSRMLS_DC)
static void zend_arg_types_stack_2_pop (zend_ptr_stack *stack, zval **object, zend_function **fbc)
static void zend_arg_types_stack_3_pop (zend_ptr_stack *stack, zend_class_entry **called_scope, zval **object, zend_function **fbc)
void execute_new_code (TSRMLS_D)
ZEND_API char * get_active_class_name (char **space TSRMLS_DC)
ZEND_API char * get_active_function_name (TSRMLS_D)
ZEND_API char * zend_get_executed_filename (TSRMLS_D)
ZEND_API uint zend_get_executed_lineno (TSRMLS_D)
ZEND_API zend_bool zend_is_executing (TSRMLS_D)
ZEND_API void zend_set_timeout (long seconds, int reset_signals)
ZEND_API void zend_unset_timeout (TSRMLS_D)
ZEND_API void zend_timeout (int dummy)
ZEND_API zend_class_entry * zend_fetch_class (const char *class_name, uint class_name_len, int fetch_type TSRMLS_DC)
void zend_verify_abstract_class (zend_class_entry *ce TSRMLS_DC)
ZEND_API zval ** zend_get_compiled_variable_value (const zend_execute_data *execute_data_ptr, zend_uint var)
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)
ZEND_API zval * zend_get_zval_ptr (znode *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC)
ZEND_API zval ** zend_get_zval_ptr_ptr (const znode *node, const temp_variable *Ts, zend_free_op *should_free, int type TSRMLS_DC)
ZEND_API int zend_do_fcall (ZEND_OPCODE_HANDLER_ARGS)

Variables

ZEND_API void(* zend_execute )(zend_op_array *op_array TSRMLS_DC)
ZEND_API void(* zend_execute_internal )(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)

Class Documentation

union _temp_variable

Definition at line 30 of file zend_execute.h.

Class Members
zend_class_entry * class_entry
struct _temp_variable fe
struct _temp_variable str_offset
zval tmp_var
struct _temp_variable var
struct _zend_vm_stack

Definition at line 145 of file zend_execute.h.

Collaboration diagram for _zend_vm_stack:
Class Members
void ** end
zend_vm_stack prev
void ** top
struct _zend_free_op

Definition at line 402 of file zend_execute.h.

Class Members
zval * var
struct _temp_variable.var

Definition at line 32 of file zend_execute.h.

Class Members
zend_bool fcall_returned_reference
zval * ptr
zval ** ptr_ptr
struct _temp_variable.str_offset

Definition at line 37 of file zend_execute.h.

Class Members
zend_bool fcall_returned_reference
zend_uint offset
zval * ptr
zval ** ptr_ptr
zval * str
struct _temp_variable.fe

Definition at line 44 of file zend_execute.h.

Class Members
zend_bool fcall_returned_reference
HashPointer fe_pos
zval * ptr
zval ** ptr_ptr

Define Documentation

#define active_opline   (*EG(opline_ptr))

Definition at line 381 of file zend_execute.h.

Definition at line 64 of file zend_execute.h.

#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 : "")

Definition at line 386 of file zend_execute.h.

#define ZEND_USER_OPCODE_CONTINUE   0 /* execute next opcode */

Definition at line 390 of file zend_execute.h.

#define ZEND_USER_OPCODE_DISPATCH   2 /* call original opcode handler */

Definition at line 392 of file zend_execute.h.

#define ZEND_USER_OPCODE_DISPATCH_TO   0x100 /* call original handler of returned opcode */

Definition at line 396 of file zend_execute.h.

#define ZEND_USER_OPCODE_ENTER   3 /* enter into new op_array without recursion */

Definition at line 393 of file zend_execute.h.

#define ZEND_USER_OPCODE_LEAVE   4 /* return to calling op_array within the same executor */

Definition at line 394 of file zend_execute.h.

#define ZEND_USER_OPCODE_RETURN   1 /* exit from executor (return from function) */

Definition at line 391 of file zend_execute.h.

#define ZEND_VM_STACK_ELEMETS (   stack)    ((void**)(((char*)(stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(struct _zend_vm_stack))))

Definition at line 151 of file zend_execute.h.

#define ZEND_VM_STACK_GROW_IF_NEEDED (   count)
Value:
do {                                                                                                     \
              if (UNEXPECTED((count) >                                                            \
                  EG(argument_stack)->end - EG(argument_stack)->top)) {      \
                     zend_vm_stack_extend((count) TSRMLS_CC);                       \
              }                                                                                                        \
       } while (0)

Definition at line 154 of file zend_execute.h.

#define ZEND_VM_STACK_PAGE_SIZE   ((64 * 1024) - 64)

Definition at line 143 of file zend_execute.h.

#define zendi_zval_copy_ctor (   p)    zval_copy_ctor(&(p))

Definition at line 378 of file zend_execute.h.

#define zendi_zval_dtor (   p)    zval_dtor(&(p))

Definition at line 379 of file zend_execute.h.


Typedef Documentation

typedef struct _zend_free_op zend_free_op

Function Documentation

ZEND_API void execute ( zend_op_array *op_array  TSRMLS_DC)

Definition at line 42 of file zend_vm_execute.h.

{
       zend_execute_data *execute_data;
       zend_bool nested = 0;
       zend_bool original_in_execution = EG(in_execution);


       if (EG(exception)) {
              return;
       }

       EG(in_execution) = 1;

zend_vm_enter:
       /* Initialize execute_data */
       execute_data = (zend_execute_data *)zend_vm_stack_alloc(
              ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)) +
              ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)) +
              ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T TSRMLS_CC);

       EX(CVs) = (zval***)((char*)execute_data + ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data)));
       memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var);
       EX(Ts) = (temp_variable *)(((char*)EX(CVs)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval**) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2)));
       EX(fbc) = NULL;
       EX(called_scope) = NULL;
       EX(object) = NULL;
       EX(old_error_reporting) = NULL;
       EX(op_array) = op_array;
       EX(symbol_table) = EG(active_symbol_table);
       EX(prev_execute_data) = EG(current_execute_data);
       EG(current_execute_data) = execute_data;
       EX(nested) = nested;
       nested = 1;

       if (op_array->start_op) {
              ZEND_VM_SET_OPCODE(op_array->start_op);
       } else {
              ZEND_VM_SET_OPCODE(op_array->opcodes);
       }

       if (op_array->this_var != -1 && EG(This)) {
              Z_ADDREF_P(EG(This)); /* For $this pointer */
              if (!EG(active_symbol_table)) {
                     EX(CVs)[op_array->this_var] = (zval**)EX(CVs) + (op_array->last_var + op_array->this_var);
                     *EX(CVs)[op_array->this_var] = EG(This);
              } else {
                     if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void**)&EX(CVs)[op_array->this_var])==FAILURE) {
                            Z_DELREF_P(EG(This));
                     }
              }
       }

       EG(opline_ptr) = &EX(opline);

       EX(function_state).function = (zend_function *) op_array;
       EX(function_state).arguments = NULL;
       
       while (1) {
       int ret;
#ifdef ZEND_WIN32
              if (EG(timed_out)) {
                     zend_timeout(0);
              }
#endif

              if ((ret = EX(opline)->handler(execute_data TSRMLS_CC)) > 0) {
                     switch (ret) {
                            case 1:
                                   EG(in_execution) = original_in_execution;
                                   return;
                            case 2:
                                   op_array = EG(active_op_array);
                                   goto zend_vm_enter;
                            case 3:
                                   execute_data = EG(current_execute_data);
                            default:
                                   break;
                     }
              }

       }
       zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen");
}

Here is the call graph for this function:

ZEND_API void execute_internal ( zend_execute_data *  execute_data_ptr,
int return_value_used  TSRMLS_DC 
)

Definition at line 1270 of file zend_execute.c.

{
       zval **return_value_ptr = &(*(temp_variable *)((char *) execute_data_ptr->Ts + execute_data_ptr->opline->result.u.var)).var.ptr;
       ((zend_internal_function *) execute_data_ptr->function_state.function)->handler(execute_data_ptr->opline->extended_value, *return_value_ptr, execute_data_ptr->function_state.function->common.return_reference?return_value_ptr:NULL, execute_data_ptr->object, return_value_used TSRMLS_CC);
}

Definition at line 1255 of file zend_execute_API.c.

{
       zend_op *opline, *end;
       zend_op *ret_opline;
       int orig_interactive;

       if (!(CG(active_op_array)->fn_flags & ZEND_ACC_INTERACTIVE)
              || CG(active_op_array)->backpatch_count>0
              || CG(active_op_array)->function_name
              || CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
              return;
       }

       ret_opline = get_next_op(CG(active_op_array) TSRMLS_CC);
       ret_opline->opcode = ZEND_RETURN;
       ret_opline->op1.op_type = IS_CONST;
       INIT_ZVAL(ret_opline->op1.u.constant);
       SET_UNUSED(ret_opline->op2);

       if (!CG(active_op_array)->start_op) {
              CG(active_op_array)->start_op = CG(active_op_array)->opcodes;
       }

       opline=CG(active_op_array)->start_op;
       end=CG(active_op_array)->opcodes+CG(active_op_array)->last;

       while (opline<end) {
              if (opline->op1.op_type == IS_CONST) {
                     Z_SET_ISREF(opline->op1.u.constant);
                     Z_SET_REFCOUNT(opline->op1.u.constant, 2); /* Make sure is_ref won't be reset */
              }
              if (opline->op2.op_type == IS_CONST) {
                     Z_SET_ISREF(opline->op2.u.constant);
                     Z_SET_REFCOUNT(opline->op2.u.constant, 2);
              }
              switch (opline->opcode) {
                     case ZEND_GOTO:
                            if (Z_TYPE(opline->op2.u.constant) != IS_LONG) {
                                   zend_resolve_goto_label(CG(active_op_array), opline, 1 TSRMLS_CC);
                            }
                            /* break omitted intentionally */
                     case ZEND_JMP:
                            opline->op1.u.jmp_addr = &CG(active_op_array)->opcodes[opline->op1.u.opline_num];
                            break;
                     case ZEND_JMPZ:
                     case ZEND_JMPNZ:
                     case ZEND_JMPZ_EX:
                     case ZEND_JMPNZ_EX:
                     case ZEND_JMP_SET:
                            opline->op2.u.jmp_addr = &CG(active_op_array)->opcodes[opline->op2.u.opline_num];
                            break;
              }
              ZEND_VM_SET_OPCODE_HANDLER(opline);
              opline++;
       }
       
       zend_release_labels(TSRMLS_C);
       
       EG(return_value_ptr_ptr) = NULL;
       EG(active_op_array) = CG(active_op_array);
       orig_interactive = CG(interactive);
       CG(interactive) = 0;
       zend_execute(CG(active_op_array) TSRMLS_CC);
       CG(interactive) = orig_interactive;

       if (EG(exception)) {
              zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
       }

       CG(active_op_array)->last -= 1;    /* get rid of that ZEND_RETURN */
       CG(active_op_array)->start_op = CG(active_op_array)->opcodes+CG(active_op_array)->last;
}

Here is the call graph for this function:

ZEND_API char* get_active_class_name ( char **space  TSRMLS_DC)

Definition at line 351 of file zend_execute_API.c.

{
       if (!zend_is_executing(TSRMLS_C)) {
              if (space) {
                     *space = "";
              }
              return "";
       }
       switch (EG(current_execute_data)->function_state.function->type) {
              case ZEND_USER_FUNCTION:
              case ZEND_INTERNAL_FUNCTION:
              {
                     zend_class_entry *ce = EG(current_execute_data)->function_state.function->common.scope;

                     if (space) {
                            *space = ce ? "::" : "";
                     }
                     return ce ? ce->name : "";
              }
              default:
                     if (space) {
                            *space = "";
                     }
                     return "";
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 379 of file zend_execute_API.c.

{
       if (!zend_is_executing(TSRMLS_C)) {
              return NULL;
       }
       switch (EG(current_execute_data)->function_state.function->type) {
              case ZEND_USER_FUNCTION: {
                            char *function_name = ((zend_op_array *) EG(current_execute_data)->function_state.function)->function_name;

                            if (function_name) {
                                   return function_name;
                            } else {
                                   return "main";
                            }
                     }
                     break;
              case ZEND_INTERNAL_FUNCTION:
                     return ((zend_internal_function *) EG(current_execute_data)->function_state.function)->function_name;
                     break;
              default:
                     return NULL;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static int i_zend_is_true ( zval *  op) [inline, static]

Definition at line 80 of file zend_execute.h.

{
       int result;

       switch (Z_TYPE_P(op)) {
              case IS_NULL:
                     result = 0;
                     break;
              case IS_LONG:
              case IS_BOOL:
              case IS_RESOURCE:
                     result = (Z_LVAL_P(op)?1:0);
                     break;
              case IS_DOUBLE:
                     result = (Z_DVAL_P(op) ? 1 : 0);
                     break;
              case IS_STRING:
                     if (Z_STRLEN_P(op) == 0
                            || (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
                            result = 0;
                     } else {
                            result = 1;
                     }
                     break;
              case IS_ARRAY:
                     result = (zend_hash_num_elements(Z_ARRVAL_P(op))?1:0);
                     break;
              case IS_OBJECT:
                     if(IS_ZEND_STD_OBJECT(*op)) {
                            TSRMLS_FETCH();

                            if (Z_OBJ_HT_P(op)->cast_object) {
                                   zval tmp;
                                   if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL TSRMLS_CC) == SUCCESS) {
                                          result = Z_LVAL(tmp);
                                          break;
                                   }
                            } else if (Z_OBJ_HT_P(op)->get) {
                                   zval *tmp = Z_OBJ_HT_P(op)->get(op TSRMLS_CC);
                                   if(Z_TYPE_P(tmp) != IS_OBJECT) {
                                          /* for safety - avoid loop */
                                          convert_to_boolean(tmp);
                                          result = Z_LVAL_P(tmp);
                                          zval_ptr_dtor(&tmp);
                                          break;
                                   }
                            }
                     }
                     result = 1;
                     break;
              default:
                     result = 0;
                     break;
       }
       return result;
}

Here is the call graph for this function:

void init_executor ( TSRMLS_D  )

Definition at line 129 of file zend_execute_API.c.

{
       zend_init_fpu(TSRMLS_C);

       INIT_ZVAL(EG(uninitialized_zval));
       /* trick to make uninitialized_zval never be modified, passed by ref, etc. */
       Z_ADDREF(EG(uninitialized_zval));
       INIT_ZVAL(EG(error_zval));
       EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
       EG(error_zval_ptr)=&EG(error_zval);
       zend_ptr_stack_init(&EG(arg_types_stack));
/* destroys stack frame, therefore makes core dumps worthless */
#if 0&&ZEND_DEBUG
       original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
#endif
       EG(return_value_ptr_ptr) = NULL;

       EG(symtable_cache_ptr) = EG(symtable_cache) - 1;
       EG(symtable_cache_limit) = EG(symtable_cache) + SYMTABLE_CACHE_SIZE - 1;
       EG(no_extensions) = 0;

       EG(function_table) = CG(function_table);
       EG(class_table) = CG(class_table);

       EG(in_execution) = 0;
       EG(in_autoload) = NULL;
       EG(autoload_func) = NULL;
       EG(error_handling) = EH_NORMAL;

       zend_vm_stack_init(TSRMLS_C);
       zend_vm_stack_push((void *) NULL TSRMLS_CC);

       zend_hash_init(&EG(symbol_table), 50, NULL, ZVAL_PTR_DTOR, 0);
       {
              zval *globals;

              ALLOC_ZVAL(globals);
              Z_SET_REFCOUNT_P(globals, 1);
              Z_SET_ISREF_P(globals);
              Z_TYPE_P(globals) = IS_ARRAY;
              Z_ARRVAL_P(globals) = &EG(symbol_table);
              zend_hash_update(&EG(symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL);
       }
       EG(active_symbol_table) = &EG(symbol_table);

       zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_activator TSRMLS_CC);
       EG(opline_ptr) = NULL;

       zend_hash_init(&EG(included_files), 5, NULL, NULL, 0);

       EG(ticks_count) = 0;

       EG(user_error_handler) = NULL;

       EG(current_execute_data) = NULL;

       zend_stack_init(&EG(user_error_handlers_error_reporting));
       zend_ptr_stack_init(&EG(user_error_handlers));
       zend_ptr_stack_init(&EG(user_exception_handlers));

       zend_objects_store_init(&EG(objects_store), 1024);

       EG(full_tables_cleanup) = 0;
#ifdef ZEND_WIN32
       EG(timed_out) = 0;
#endif

       EG(exception) = NULL;
       EG(prev_exception) = NULL;

       EG(scope) = NULL;
       EG(called_scope) = NULL;

       EG(This) = NULL;

       EG(active_op_array) = NULL;

       EG(active) = 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void safe_free_zval_ptr_rel ( zval *p ZEND_FILE_LINE_DC  ZEND_FILE_LINE_ORIG_DC) [inline, static]

Definition at line 65 of file zend_execute.h.

{
       TSRMLS_FETCH();

       if (p!=EG(uninitialized_zval_ptr)) {
              FREE_ZVAL_REL(p);
       }
}

Definition at line 220 of file zend_execute_API.c.

{
       zend_try {
              int symbols;
              do {
                     symbols = zend_hash_num_elements(&EG(symbol_table));
                     zend_hash_reverse_apply(&EG(symbol_table), (apply_func_t) zval_call_destructor TSRMLS_CC);
              } while (symbols != zend_hash_num_elements(&EG(symbol_table)));
              zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC);
       } zend_catch {
              /* if we couldn't destruct cleanly, mark all objects as destructed anyway */
              zend_objects_store_mark_destructed(&EG(objects_store) TSRMLS_CC);
       } zend_end_try();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 236 of file zend_execute_API.c.

{
       zend_try {

/* Removed because this can not be safely done, e.g. in this situation:
   Object 1 creates object 2
   Object 3 holds reference to object 2.
   Now when 1 and 2 are destroyed, 3 can still access 2 in its destructor, with
   very problematic results */
/*            zend_objects_store_call_destructors(&EG(objects_store) TSRMLS_CC); */

/* Moved after symbol table cleaners, because  some of the cleaners can call
   destructors, which would use EG(symtable_cache_ptr) and thus leave leaks */
/*            while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
                     zend_hash_destroy(*EG(symtable_cache_ptr));
                     efree(*EG(symtable_cache_ptr));
                     EG(symtable_cache_ptr)--;
              }
*/
              zend_llist_apply(&zend_extensions, (llist_apply_func_t) zend_extension_deactivator TSRMLS_CC);
              zend_hash_graceful_reverse_destroy(&EG(symbol_table));
       } zend_end_try();

       zend_try {
              zval *zeh;
              /* remove error handlers before destroying classes and functions,
               * so that if handler used some class, crash would not happen */
              if (EG(user_error_handler)) {
                     zeh = EG(user_error_handler);
                     EG(user_error_handler) = NULL;
                     zval_dtor(zeh);
                     FREE_ZVAL(zeh);
              }

              if (EG(user_exception_handler)) {
                     zeh = EG(user_exception_handler);
                     EG(user_exception_handler) = NULL;
                     zval_dtor(zeh);
                     FREE_ZVAL(zeh);
              }

              zend_stack_destroy(&EG(user_error_handlers_error_reporting));
              zend_stack_init(&EG(user_error_handlers_error_reporting));
              zend_ptr_stack_clean(&EG(user_error_handlers), ZVAL_DESTRUCTOR, 1);
              zend_ptr_stack_clean(&EG(user_exception_handlers), ZVAL_DESTRUCTOR, 1);
       } zend_end_try();

       zend_try {
              /* Cleanup static data for functions and arrays.
               * We need a separate cleanup stage because of the following problem:
               * Suppose we destroy class X, which destroys the class's function table,
               * and in the function table we have function foo() that has static $bar.
               * Now if an object of class X is assigned to $bar, its destructor will be
               * called and will fail since X's function table is in mid-destruction.
               * So we want first of all to clean up all data and then move to tables destruction.
               * Note that only run-time accessed data need to be cleaned up, pre-defined data can
               * not contain objects and thus are not probelmatic */
              if (EG(full_tables_cleanup)) {
                     zend_hash_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data_full TSRMLS_CC);
              } else {
                     zend_hash_reverse_apply(EG(function_table), (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
              }
              zend_hash_apply(EG(class_table), (apply_func_t) zend_cleanup_class_data TSRMLS_CC);
       } zend_end_try();

       zend_try {
              zend_vm_stack_destroy(TSRMLS_C);

              zend_objects_store_free_object_storage(&EG(objects_store) TSRMLS_CC);

              /* Destroy all op arrays */
              if (EG(full_tables_cleanup)) {
                     zend_hash_apply(EG(function_table), (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
                     zend_hash_apply(EG(class_table), (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
              } else {
                     zend_hash_reverse_apply(EG(function_table), (apply_func_t) clean_non_persistent_function TSRMLS_CC);
                     zend_hash_reverse_apply(EG(class_table), (apply_func_t) clean_non_persistent_class TSRMLS_CC);
              }

              while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
                     zend_hash_destroy(*EG(symtable_cache_ptr));
                     FREE_HASHTABLE(*EG(symtable_cache_ptr));
                     EG(symtable_cache_ptr)--;
              }
       } zend_end_try();

       zend_try {
              clean_non_persistent_constants(TSRMLS_C);
       } zend_end_try();

       zend_try {
#if 0&&ZEND_DEBUG
       signal(SIGSEGV, original_sigsegv_handler);
#endif

              zend_hash_destroy(&EG(included_files));

              zend_ptr_stack_destroy(&EG(arg_types_stack));
              zend_stack_destroy(&EG(user_error_handlers_error_reporting));
              zend_ptr_stack_destroy(&EG(user_error_handlers));
              zend_ptr_stack_destroy(&EG(user_exception_handlers));
              zend_objects_store_destroy(&EG(objects_store));
              if (EG(in_autoload)) {
                     zend_hash_destroy(EG(in_autoload));
                     FREE_HASHTABLE(EG(in_autoload));
              }
       } zend_end_try();

       zend_shutdown_fpu(TSRMLS_C);

       EG(active) = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void zend_arg_types_stack_2_pop ( zend_ptr_stack stack,
zval **  object,
zend_function **  fbc 
) [inline, static]

Definition at line 334 of file zend_execute.h.

{
       void *a, *b;

       zend_ptr_stack_2_pop(stack, &a, &b);

       *object = (zval *) a;
       *fbc = (zend_function *) b;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void zend_arg_types_stack_3_pop ( zend_ptr_stack stack,
zend_class_entry **  called_scope,
zval **  object,
zend_function **  fbc 
) [inline, static]

Definition at line 344 of file zend_execute.h.

{
       void *a, *b, *c;

       zend_ptr_stack_3_pop(stack, &a, &b, &c);

       *called_scope = (zend_class_entry *) a;
       *object = (zval *) b;
       *fbc = (zend_function *) c;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 34023 of file zend_vm_execute.h.

Here is the call graph for this function:

ZEND_API int zend_eval_string ( char *  str,
zval *  retval_ptr,
char *string_name  TSRMLS_DC 
)

Definition at line 1230 of file zend_execute_API.c.

{
       return zend_eval_stringl(str, strlen(str), retval_ptr, string_name TSRMLS_CC);
}

Here is the call graph for this function:

ZEND_API int zend_eval_string_ex ( char *  str,
zval *  retval_ptr,
char *  string_name,
int handle_exceptions  TSRMLS_DC 
)

Definition at line 1249 of file zend_execute_API.c.

{
       return zend_eval_stringl_ex(str, strlen(str), retval_ptr, string_name, handle_exceptions TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API int zend_eval_stringl ( char *  str,
int  str_len,
zval *  retval_ptr,
char *string_name  TSRMLS_DC 
)

Definition at line 1156 of file zend_execute_API.c.

{
       zval pv;
       zend_op_array *new_op_array;
       zend_op_array *original_active_op_array = EG(active_op_array);
       zend_uint original_compiler_options;
       int retval;

       if (retval_ptr) {
              Z_STRLEN(pv) = str_len + sizeof("return ;") - 1;
              Z_STRVAL(pv) = emalloc(Z_STRLEN(pv) + 1);
              memcpy(Z_STRVAL(pv), "return ", sizeof("return ") - 1);
              memcpy(Z_STRVAL(pv) + sizeof("return ") - 1, str, str_len);
              Z_STRVAL(pv)[Z_STRLEN(pv) - 1] = ';';
              Z_STRVAL(pv)[Z_STRLEN(pv)] = '\0';
       } else {
              Z_STRLEN(pv) = str_len;
              Z_STRVAL(pv) = str;
       }
       Z_TYPE(pv) = IS_STRING;

       /*printf("Evaluating '%s'\n", pv.value.str.val);*/

       original_compiler_options = CG(compiler_options);
       CG(compiler_options) = ZEND_COMPILE_DEFAULT_FOR_EVAL;
       new_op_array = zend_compile_string(&pv, string_name TSRMLS_CC);
       CG(compiler_options) = original_compiler_options;

       if (new_op_array) {
              zval *local_retval_ptr=NULL;
              zval **original_return_value_ptr_ptr = EG(return_value_ptr_ptr);
              zend_op **original_opline_ptr = EG(opline_ptr);
              int orig_interactive = CG(interactive);

              EG(return_value_ptr_ptr) = &local_retval_ptr;
              EG(active_op_array) = new_op_array;
              EG(no_extensions)=1;
              if (!EG(active_symbol_table)) {
                     zend_rebuild_symbol_table(TSRMLS_C);
              }
              CG(interactive) = 0;

              zend_execute(new_op_array TSRMLS_CC);

              CG(interactive) = orig_interactive;
              if (local_retval_ptr) {
                     if (retval_ptr) {
                            COPY_PZVAL_TO_ZVAL(*retval_ptr, local_retval_ptr);
                     } else {
                            zval_ptr_dtor(&local_retval_ptr);
                     }
              } else {
                     if (retval_ptr) {
                            INIT_ZVAL(*retval_ptr);
                     }
              }

              EG(no_extensions)=0;
              EG(opline_ptr) = original_opline_ptr;
              EG(active_op_array) = original_active_op_array;
              destroy_op_array(new_op_array TSRMLS_CC);
              efree(new_op_array);
              EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
              retval = SUCCESS;
       } else {
              retval = FAILURE;
       }
       if (retval_ptr) {
              zval_dtor(&pv);
       }
       return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API int zend_eval_stringl_ex ( char *  str,
int  str_len,
zval *  retval_ptr,
char *  string_name,
int handle_exceptions  TSRMLS_DC 
)

Definition at line 1236 of file zend_execute_API.c.

{
       int result;

       result = zend_eval_stringl(str, str_len, retval_ptr, string_name TSRMLS_CC);
       if (handle_exceptions && EG(exception)) {
              zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
              result = FAILURE;
       }
       return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API zend_class_entry* zend_fetch_class ( const char *  class_name,
uint  class_name_len,
int fetch_type  TSRMLS_DC 
)

Definition at line 1531 of file zend_execute_API.c.

{
       zend_class_entry **pce;
       int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
       int silent       = (fetch_type & ZEND_FETCH_CLASS_SILENT) != 0;

       fetch_type &= ZEND_FETCH_CLASS_MASK;

check_fetch_type:
       switch (fetch_type) {
              case ZEND_FETCH_CLASS_SELF:
                     if (!EG(scope)) {
                            zend_error(E_ERROR, "Cannot access self:: when no class scope is active");
                     }
                     return EG(scope);
              case ZEND_FETCH_CLASS_PARENT:
                     if (!EG(scope)) {
                            zend_error(E_ERROR, "Cannot access parent:: when no class scope is active");
                     }
                     if (!EG(scope)->parent) {
                            zend_error(E_ERROR, "Cannot access parent:: when current class scope has no parent");
                     }
                     return EG(scope)->parent;
              case ZEND_FETCH_CLASS_STATIC:
                     if (!EG(called_scope)) {
                            zend_error(E_ERROR, "Cannot access static:: when no class scope is active");
                     }
                     return EG(called_scope);
              case ZEND_FETCH_CLASS_AUTO: {
                            fetch_type = zend_get_class_fetch_type(class_name, class_name_len);
                            if (fetch_type!=ZEND_FETCH_CLASS_DEFAULT) {
                                   goto check_fetch_type;
                            }
                     }
                     break;
       }

       if (zend_lookup_class_ex(class_name, class_name_len, use_autoload, &pce TSRMLS_CC) == FAILURE) {
              if (use_autoload) {
                     if (!silent && !EG(exception)) {
                            if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
                                   zend_error(E_ERROR, "Interface '%s' not found", class_name);
                            } else {
                                   zend_error(E_ERROR, "Class '%s' not found", class_name);
                            }      
                     }
              }
              return NULL;
       }
       return *pce;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API zval** zend_get_compiled_variable_value ( const zend_execute_data *  execute_data_ptr,
zend_uint  var 
)

Definition at line 170 of file zend_execute.c.

{
       return execute_data_ptr->CVs[var];
}

Definition at line 404 of file zend_execute_API.c.

{
       if (EG(active_op_array)) {
              return EG(active_op_array)->filename;
       } else {
              return "[no active file]";
       }
}

Here is the caller graph for this function:

Definition at line 414 of file zend_execute_API.c.

{
       if(EG(exception) && EG(opline_ptr) && active_opline->opcode == ZEND_HANDLE_EXCEPTION && 
              active_opline->lineno == 0 && EG(opline_before_exception)) {
              return EG(opline_before_exception)->lineno;
       }
       if (EG(opline_ptr)) {
              return active_opline->lineno;
       } else {
              return 0;
       }
}

Here is the caller graph for this function:

Definition at line 1307 of file zend_execute.c.

{
       return zend_user_opcode_handlers[opcode];
}
ZEND_API zval* zend_get_zval_ptr ( znode node,
const temp_variable Ts,
zend_free_op should_free,
int type  TSRMLS_DC 
)

Definition at line 1312 of file zend_execute.c.

                                                                                                                      {
       return get_zval_ptr(node, Ts, should_free, type);
}
ZEND_API zval** zend_get_zval_ptr_ptr ( const znode node,
const temp_variable Ts,
zend_free_op should_free,
int type  TSRMLS_DC 
)

Definition at line 1316 of file zend_execute.c.

                                                                                                                                 {
       return get_zval_ptr_ptr(node, Ts, should_free, type);
}

Definition at line 428 of file zend_execute_API.c.

{
       return EG(in_execution);
}

Here is the caller graph for this function:

ZEND_API int zend_is_true ( zval *  op)

Definition at line 477 of file zend_execute_API.c.

{
       return i_zend_is_true(op);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API int zend_lookup_class ( const char *  name,
int  name_length,
zend_class_entry ***ce  TSRMLS_DC 
)

Definition at line 1150 of file zend_execute_API.c.

{
       return zend_lookup_class_ex(name, name_length, 1, ce TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API int zend_lookup_class_ex ( const char *  name,
int  name_length,
int  use_autoload,
zend_class_entry ***ce  TSRMLS_DC 
)

Definition at line 1044 of file zend_execute_API.c.

{
       zval **args[1];
       zval autoload_function;
       zval *class_name_ptr;
       zval *retval_ptr = NULL;
       int retval, lc_length;
       char *lc_name;
       char *lc_free;
       zend_fcall_info fcall_info;
       zend_fcall_info_cache fcall_cache;
       char dummy = 1;
       ulong hash;
       ALLOCA_FLAG(use_heap)

       if (name == NULL || !name_length) {
              return FAILURE;
       }

       lc_free = lc_name = do_alloca(name_length + 1, use_heap);
       zend_str_tolower_copy(lc_name, name, name_length);
       lc_length = name_length + 1;

       if (lc_name[0] == '\\') {
              lc_name += 1;
              lc_length -= 1;
       }

       hash = zend_inline_hash_func(lc_name, lc_length);

       if (zend_hash_quick_find(EG(class_table), lc_name, lc_length, hash, (void **) ce) == SUCCESS) {
              free_alloca(lc_free, use_heap);
              return SUCCESS;
       }

       /* The compiler is not-reentrant. Make sure we __autoload() only during run-time
        * (doesn't impact fuctionality of __autoload()
       */
       if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
              free_alloca(lc_free, use_heap);
              return FAILURE;
       }

       if (EG(in_autoload) == NULL) {
              ALLOC_HASHTABLE(EG(in_autoload));
              zend_hash_init(EG(in_autoload), 0, NULL, NULL, 0);
       }

       if (zend_hash_quick_add(EG(in_autoload), lc_name, lc_length, hash, (void**)&dummy, sizeof(char), NULL) == FAILURE) {
              free_alloca(lc_free, use_heap);
              return FAILURE;
       }

       ZVAL_STRINGL(&autoload_function, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1, 0);

       ALLOC_ZVAL(class_name_ptr);
       INIT_PZVAL(class_name_ptr);
       if (name[0] == '\\') {
              ZVAL_STRINGL(class_name_ptr, name+1, name_length-1, 1);
       } else {
              ZVAL_STRINGL(class_name_ptr, name, name_length, 1);
       }

       args[0] = &class_name_ptr;

       fcall_info.size = sizeof(fcall_info);
       fcall_info.function_table = EG(function_table);
       fcall_info.function_name = &autoload_function;
       fcall_info.symbol_table = NULL;
       fcall_info.retval_ptr_ptr = &retval_ptr;
       fcall_info.param_count = 1;
       fcall_info.params = args;
       fcall_info.object_ptr = NULL;
       fcall_info.no_separation = 1;

       fcall_cache.initialized = EG(autoload_func) ? 1 : 0;
       fcall_cache.function_handler = EG(autoload_func);
       fcall_cache.calling_scope = NULL;
       fcall_cache.called_scope = NULL;
       fcall_cache.object_ptr = NULL;

       zend_exception_save(TSRMLS_C);
       retval = zend_call_function(&fcall_info, &fcall_cache TSRMLS_CC);
       zend_exception_restore(TSRMLS_C);

       EG(autoload_func) = fcall_cache.function_handler;

       zval_ptr_dtor(&class_name_ptr);

       zend_hash_quick_del(EG(in_autoload), lc_name, lc_length, hash);

       if (retval_ptr) {
              zval_ptr_dtor(&retval_ptr);
       }

       if (retval == FAILURE) {
              free_alloca(lc_free, use_heap);
              return FAILURE;
       }

       retval = zend_hash_quick_find(EG(class_table), lc_name, lc_length, hash, (void **) ce);
       free_alloca(lc_free, use_heap);
       return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API void zend_set_timeout ( long  seconds,
int  reset_signals 
)

Definition at line 1454 of file zend_execute_API.c.

{
       TSRMLS_FETCH();

       EG(timeout_seconds) = seconds;

#ifdef ZEND_WIN32
       if(!seconds) {
              return;
       }
       if (timeout_thread_initialized == 0 && InterlockedIncrement(&timeout_thread_initialized) == 1) {
              /* We start up this process-wide thread here and not in zend_startup(), because if Zend
               * is initialized inside a DllMain(), you're not supposed to start threads from it.
               */
              zend_init_timeout_thread();
       }
       PostThreadMessage(timeout_thread_id, WM_REGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) seconds);
#else
#      ifdef HAVE_SETITIMER
       {
              struct itimerval t_r;              /* timeout requested */
              sigset_t sigset;

              if(seconds) {
                     t_r.it_value.tv_sec = seconds;
                     t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;

#      ifdef __CYGWIN__
                     setitimer(ITIMER_REAL, &t_r, NULL);
              }
              if(reset_signals) {
                     signal(SIGALRM, zend_timeout);
                     sigemptyset(&sigset);
                     sigaddset(&sigset, SIGALRM);
              }
#      else
                     setitimer(ITIMER_PROF, &t_r, NULL);
              }
              if(reset_signals) {
                     signal(SIGPROF, zend_timeout);
                     sigemptyset(&sigset);
                     sigaddset(&sigset, SIGPROF);
              }
#      endif
              if(reset_signals) {
                     sigprocmask(SIG_UNBLOCK, &sigset, NULL);
              }
       }
#      endif
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1297 of file zend_execute.c.

{
       if (opcode != ZEND_USER_OPCODE) {
              zend_user_opcodes[opcode] = ZEND_USER_OPCODE;
              zend_user_opcode_handlers[opcode] = handler;
              return SUCCESS;
       }
       return FAILURE;
}
ZEND_API void zend_timeout ( int  dummy)

Definition at line 1329 of file zend_execute_API.c.

{
       TSRMLS_FETCH();

       if (zend_on_timeout) {
              zend_on_timeout(EG(timeout_seconds) TSRMLS_CC);
       }

       zend_error(E_ERROR, "Maximum execution time of %d second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1507 of file zend_execute_API.c.

{
#ifdef ZEND_WIN32
       if(timeout_thread_initialized) {
              PostThreadMessage(timeout_thread_id, WM_UNREGISTER_ZEND_TIMEOUT, (WPARAM) GetCurrentThreadId(), (LPARAM) 0);
       }
#else
#      ifdef HAVE_SETITIMER
       if (EG(timeout_seconds)) {
              struct itimerval no_timeout;

              no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;

#ifdef __CYGWIN__
              setitimer(ITIMER_REAL, &no_timeout, NULL);
#else
              setitimer(ITIMER_PROF, &no_timeout, NULL);
#endif
       }
#      endif
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void zend_verify_abstract_class ( zend_class_entry *ce  TSRMLS_DC)

Definition at line 1619 of file zend_execute_API.c.

{
       zend_abstract_info ai;

       if ((ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) && !(ce->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
              memset(&ai, 0, sizeof(ai));

              zend_hash_apply_with_argument(&ce->function_table, (apply_func_arg_t) zend_verify_abstract_class_function, &ai TSRMLS_CC);

              if (ai.cnt) {
                     zend_error(E_ERROR, "Class %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")",
                            ce->name, ai.cnt,
                            ai.cnt > 1 ? "s" : "",
                            DISPLAY_ABSTRACT_FN(0),
                            DISPLAY_ABSTRACT_FN(1),
                            DISPLAY_ABSTRACT_FN(2)
                            );
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void* zend_vm_stack_alloc ( size_t size  TSRMLS_DC) [inline, static]

Definition at line 222 of file zend_execute.h.

{
       void *ret;

       size = (size + (sizeof(void*) - 1)) / sizeof(void*);

       /* the following comparison must be optimized out at compile time */
       if (ZEND_MM_ALIGNMENT > sizeof(void*)) {
              int extra = (ZEND_MM_ALIGNMENT - ((zend_uintptr_t)EG(argument_stack)->top & (ZEND_MM_ALIGNMENT - 1))) / sizeof(void*);

              if (UNEXPECTED(size + extra + ZEND_MM_ALIGNED_SIZE(sizeof(void*)) / sizeof(void*) >
                  (zend_uintptr_t)(EG(argument_stack)->end - EG(argument_stack)->top))) {
                     zend_vm_stack_extend(size TSRMLS_CC);
              } else {
                     void **old_top = EG(argument_stack)->top;

                     EG(argument_stack)->top += extra;
                     /* store old top on the stack */
                     *EG(argument_stack)->top = (void*)old_top;
                     EG(argument_stack)->top += ZEND_MM_ALIGNED_SIZE(sizeof(void*)) / sizeof(void*);
              }
       } else {
              ZEND_VM_STACK_GROW_IF_NEEDED((int)size);
       }
       ret = (void*)EG(argument_stack)->top;
       EG(argument_stack)->top += size;
       return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void zend_vm_stack_clear_multiple ( TSRMLS_D  ) [inline, static]

Definition at line 310 of file zend_execute.h.

{
       void **p = EG(argument_stack)->top - 1;
       int delete_count = (int)(zend_uintptr_t) *p;

       while (--delete_count>=0) {
              zval *q = *(zval **)(--p);
              *p = NULL;
              zval_ptr_dtor(&q);
       }
       zend_vm_stack_free_int(p TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void zend_vm_stack_destroy ( TSRMLS_D  ) [inline, static]

Definition at line 176 of file zend_execute.h.

{
       zend_vm_stack stack = EG(argument_stack);

       while (stack != NULL) {
              zend_vm_stack p = stack->prev;
              efree(stack);
              stack = p;
       }
}

Here is the caller graph for this function:

static void zend_vm_stack_extend ( int count  TSRMLS_DC) [inline, static]

Definition at line 187 of file zend_execute.h.

{
       zend_vm_stack p = zend_vm_stack_new_page(count >= ZEND_VM_STACK_PAGE_SIZE ? count : ZEND_VM_STACK_PAGE_SIZE);
       p->prev = EG(argument_stack);
       EG(argument_stack) = p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void zend_vm_stack_free ( void *ptr  TSRMLS_DC) [inline, static]

Definition at line 263 of file zend_execute.h.

{      
       if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (void**)ptr)) {
              zend_vm_stack p = EG(argument_stack);

              EG(argument_stack) = p->prev;
              efree(p);
       } else {
              /* the following comparison must be optimized out at compile time */
              if (ZEND_MM_ALIGNMENT > sizeof(void*)) {
                     ptr = (void*)(((char*)ptr) - ZEND_MM_ALIGNED_SIZE(sizeof(void*)));
                     EG(argument_stack)->top = *(void***)ptr;
              } else {
                     EG(argument_stack)->top = (void**)ptr;
              }
       }
}

Here is the caller graph for this function:

static void zend_vm_stack_free_int ( void *ptr  TSRMLS_DC) [inline, static]

Definition at line 251 of file zend_execute.h.

{      
       if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (void**)ptr)) {
              zend_vm_stack p = EG(argument_stack);

              EG(argument_stack) = p->prev;
              efree(p);
       } else {
              EG(argument_stack)->top = (void**)ptr;
       }
}

Here is the caller graph for this function:

static zval** zend_vm_stack_get_arg ( int requested_arg  TSRMLS_DC) [inline, static]

Definition at line 323 of file zend_execute.h.

{
       void **p = EG(current_execute_data)->prev_execute_data->function_state.arguments;
       int arg_count = (int)(zend_uintptr_t) *p;

       if (UNEXPECTED(requested_arg > arg_count)) {
              return NULL;
       }
       return (zval**)p - arg_count + requested_arg - 1;
}

Here is the caller graph for this function:

static void zend_vm_stack_init ( TSRMLS_D  ) [inline, static]

Definition at line 171 of file zend_execute.h.

Here is the call graph for this function:

Here is the caller graph for this function:

static zend_vm_stack zend_vm_stack_new_page ( int  count) [inline, static]

Definition at line 162 of file zend_execute.h.

                                                              {
       zend_vm_stack page = (zend_vm_stack)emalloc(ZEND_MM_ALIGNED_SIZE(sizeof(*page)) + sizeof(void*) * count);

       page->top = ZEND_VM_STACK_ELEMETS(page);
       page->end = page->top + count;
       page->prev = NULL;
       return page;
}

Here is the caller graph for this function:

static void* zend_vm_stack_pop ( TSRMLS_D  ) [inline, static]

Definition at line 210 of file zend_execute.h.

{
       void *el = *(--EG(argument_stack)->top);

       if (UNEXPECTED(EG(argument_stack)->top == ZEND_VM_STACK_ELEMETS(EG(argument_stack)))) {
              zend_vm_stack p = EG(argument_stack);
              EG(argument_stack) = p->prev;
              efree(p);
       }
       return el;
}

Here is the caller graph for this function:

static void zend_vm_stack_push ( void *ptr  TSRMLS_DC) [inline, static]

Definition at line 199 of file zend_execute.h.

{
       ZEND_VM_STACK_GROW_IF_NEEDED(1);
       *(EG(argument_stack)->top++) = ptr;
}

Here is the caller graph for this function:

static void** zend_vm_stack_push_args ( int count  TSRMLS_DC) [inline, static]

Definition at line 281 of file zend_execute.h.

{

       if (UNEXPECTED(EG(argument_stack)->top - ZEND_VM_STACK_ELEMETS(EG(argument_stack)) < count)  || 
              UNEXPECTED(EG(argument_stack)->top == EG(argument_stack)->end)) {
              zend_vm_stack p = EG(argument_stack);

              zend_vm_stack_extend(count + 1 TSRMLS_CC);

              EG(argument_stack)->top += count;
              *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count;
              while (count-- > 0) {
                     void *data = *(--p->top);

                     if (UNEXPECTED(p->top == ZEND_VM_STACK_ELEMETS(p))) {
                            zend_vm_stack r = p;

                            EG(argument_stack)->prev = p->prev;
                            p = p->prev;
                            efree(r);
                     }
                     *(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + count) = data;
              }
              return EG(argument_stack)->top++;
       }
       *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count;
       return EG(argument_stack)->top++;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void zend_vm_stack_push_nocheck ( void *ptr  TSRMLS_DC) [inline, static]

Definition at line 205 of file zend_execute.h.

{
       *(EG(argument_stack)->top++) = ptr;
}

Here is the caller graph for this function:

static void** zend_vm_stack_top ( TSRMLS_D  ) [inline, static]

Definition at line 194 of file zend_execute.h.

{
       return EG(argument_stack)->top;
}

Here is the caller graph for this function:

ZEND_API int zval_update_constant ( zval **  pp,
void *arg  TSRMLS_DC 
)

Definition at line 710 of file zend_execute_API.c.

{
       return zval_update_constant_ex(pp, arg, NULL TSRMLS_CC);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API int zval_update_constant_ex ( zval **  pp,
void *  arg,
zend_class_entry *scope  TSRMLS_DC 
)

Definition at line 503 of file zend_execute_API.c.

{
       zval *p = *pp;
       zend_bool inline_change = (zend_bool) (zend_uintptr_t) arg;
       zval const_value;
       char *colon;

       if (IS_CONSTANT_VISITED(p)) {
              zend_error(E_ERROR, "Cannot declare self-referencing constant '%s'", Z_STRVAL_P(p));
       } else if ((Z_TYPE_P(p) & IS_CONSTANT_TYPE_MASK) == IS_CONSTANT) {
              int refcount;
              zend_uchar is_ref;

              SEPARATE_ZVAL_IF_NOT_REF(pp);
              p = *pp;

              MARK_CONSTANT_VISITED(p);

              refcount = Z_REFCOUNT_P(p);
              is_ref = Z_ISREF_P(p);

              if (!zend_get_constant_ex(p->value.str.val, p->value.str.len, &const_value, scope, Z_REAL_TYPE_P(p) TSRMLS_CC)) {
                     char *actual = Z_STRVAL_P(p);

                     if ((colon = zend_memrchr(Z_STRVAL_P(p), ':', Z_STRLEN_P(p)))) {
                            zend_error(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(p));
                            Z_STRLEN_P(p) -= ((colon - Z_STRVAL_P(p)) + 1);
                            if (inline_change) {
                                   colon = estrndup(colon, Z_STRLEN_P(p));
                                   efree(Z_STRVAL_P(p));
                                   Z_STRVAL_P(p) = colon;
                            } else {
                                   Z_STRVAL_P(p) = colon + 1;
                            }
                     } else {
                            char *save = actual, *slash;
                            int actual_len = Z_STRLEN_P(p);
                            if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) {
                                   actual = slash + 1;
                                   actual_len -= (actual - Z_STRVAL_P(p));
                                   if (inline_change) {
                                          actual = estrndup(actual, actual_len);
                                          Z_STRVAL_P(p) = actual;
                                          Z_STRLEN_P(p) = actual_len;
                                   }
                            }
                            if (actual[0] == '\\') {
                                   if (inline_change) {
                                          memmove(Z_STRVAL_P(p), Z_STRVAL_P(p)+1, Z_STRLEN_P(p));
                                          --Z_STRLEN_P(p);
                                   } else {
                                          ++actual;
                                   }
                                   --actual_len;
                            }
                            if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) {
                                   int fix_save = 0;
                                   if (save[0] == '\\') {
                                          save++;
                                          fix_save = 1;
                                   }
                                   zend_error(E_ERROR, "Undefined constant '%s'", save);
                                   if (fix_save) {
                                          save--;
                                   }
                                   if (inline_change) {
                                          efree(save);
                                   }
                                   save = NULL;
                            }
                            if (inline_change && save && save != actual) {
                                   efree(save);
                            }
                            zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",  actual,  actual);
                            p->type = IS_STRING;
                            if (!inline_change) {
                                   Z_STRVAL_P(p) = actual;
                                   Z_STRLEN_P(p) = actual_len;
                                   zval_copy_ctor(p);
                            }
                     }
              } else {
                     if (inline_change) {
                            STR_FREE(Z_STRVAL_P(p));
                     }
                     *p = const_value;
              }

              Z_SET_REFCOUNT_P(p, refcount);
              Z_SET_ISREF_TO_P(p, is_ref);
       } else if (Z_TYPE_P(p) == IS_CONSTANT_ARRAY) {
              zval **element, *new_val;
              char *str_index;
              uint str_index_len;
              ulong num_index;
              int ret;

              SEPARATE_ZVAL_IF_NOT_REF(pp);
              p = *pp;
              Z_TYPE_P(p) = IS_ARRAY;

              if (!inline_change) {
                     zval *tmp;
                     HashTable *tmp_ht = NULL;

                     ALLOC_HASHTABLE(tmp_ht);
                     zend_hash_init(tmp_ht, zend_hash_num_elements(Z_ARRVAL_P(p)), NULL, ZVAL_PTR_DTOR, 0);
                     zend_hash_copy(tmp_ht, Z_ARRVAL_P(p), (copy_ctor_func_t) zval_deep_copy, (void *) &tmp, sizeof(zval *));
                     Z_ARRVAL_P(p) = tmp_ht;
              } 

              /* First go over the array and see if there are any constant indices */
              zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
              while (zend_hash_get_current_data(Z_ARRVAL_P(p), (void **) &element) == SUCCESS) {
                     if (!(Z_TYPE_PP(element) & IS_CONSTANT_INDEX)) {
                            zend_hash_move_forward(Z_ARRVAL_P(p));
                            continue;
                     }
                     Z_TYPE_PP(element) &= ~IS_CONSTANT_INDEX;
                     if (zend_hash_get_current_key_ex(Z_ARRVAL_P(p), &str_index, &str_index_len, &num_index, 0, NULL) != HASH_KEY_IS_STRING) {
                            zend_hash_move_forward(Z_ARRVAL_P(p));
                            continue;
                     }
                     if (!zend_get_constant_ex(str_index, str_index_len - 3, &const_value, scope, str_index[str_index_len - 2] TSRMLS_CC)) {
                            char *actual, *save = str_index;
                            if ((colon = zend_memrchr(str_index, ':', str_index_len - 3))) {
                                   zend_error(E_ERROR, "Undefined class constant '%s'", str_index);
                                   str_index_len -= ((colon - str_index) + 1);
                                   str_index = colon;
                            } else {
                                   if (str_index[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) {
                                          if ((actual = (char *)zend_memrchr(str_index, '\\', str_index_len - 3))) {
                                                 actual++;
                                                 str_index_len -= (actual - str_index);
                                                 str_index = actual;
                                          }
                                   }
                                   if (str_index[0] == '\\') {
                                          ++str_index;
                                          --str_index_len;
                                   }
                                   if (save[0] == '\\') {
                                          ++save;
                                   }
                                   if ((str_index[str_index_len - 2] & IS_CONSTANT_UNQUALIFIED) == 0) {
                                          zend_error(E_ERROR, "Undefined constant '%s'", save);
                                   }
                                   zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",   str_index, str_index);
                            }
                            ZVAL_STRINGL(&const_value, str_index, str_index_len-3, 1);
                     }

                     if (Z_REFCOUNT_PP(element) > 1) {
                            ALLOC_ZVAL(new_val);
                            *new_val = **element;
                            zval_copy_ctor(new_val);
                            Z_SET_REFCOUNT_P(new_val, 1);
                            Z_UNSET_ISREF_P(new_val);

                            /* preserve this bit for inheritance */
                            Z_TYPE_PP(element) |= IS_CONSTANT_INDEX;
                            zval_ptr_dtor(element);
                            *element = new_val;
                     }

                     switch (Z_TYPE(const_value)) {
                            case IS_STRING:
                                   ret = zend_symtable_update_current_key(Z_ARRVAL_P(p), Z_STRVAL(const_value), Z_STRLEN(const_value) + 1, HASH_UPDATE_KEY_IF_BEFORE);
                                   break;
                            case IS_BOOL:
                            case IS_LONG:
                                   ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, Z_LVAL(const_value), HASH_UPDATE_KEY_IF_BEFORE, NULL);
                                   break;
                            case IS_DOUBLE:
                                   ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_LONG, NULL, 0, zend_dval_to_lval(Z_DVAL(const_value)), HASH_UPDATE_KEY_IF_BEFORE, NULL);
                                   break;
                            case IS_NULL:
                                   ret = zend_hash_update_current_key_ex(Z_ARRVAL_P(p), HASH_KEY_IS_STRING, "", 1, 0, HASH_UPDATE_KEY_IF_BEFORE, NULL);
                                   break;
                            default:
                                   ret = SUCCESS;
                                   break;
                     }
                     if (ret == SUCCESS) {
                            zend_hash_move_forward(Z_ARRVAL_P(p));
                     }
                     zval_dtor(&const_value);
              }
              zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant_inline_change, (void *) scope TSRMLS_CC);
              zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ZEND_API int zval_update_constant_inline_change ( zval **  pp,
void *arg  TSRMLS_DC 
)

Here is the caller graph for this function:

ZEND_API int zval_update_constant_no_inline_change ( zval **  pp,
void *arg  TSRMLS_DC 
)

Variable Documentation

ZEND_API void(* zend_execute)(zend_op_array *op_array TSRMLS_DC)

Definition at line 40 of file zend_execute_API.c.

ZEND_API void(* zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC)

Definition at line 41 of file zend_execute_API.c.