diff options
Diffstat (limited to 'Zend/zend_execute.h')
-rw-r--r-- | Zend/zend_execute.h | 84 |
1 files changed, 24 insertions, 60 deletions
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 4594eba9ef..fdd9f5697d 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -50,14 +50,14 @@ typedef union _temp_variable { BEGIN_EXTERN_C() struct _zend_fcall_info; -ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC); +ZEND_API extern void (*zend_execute_ex)(zend_execute_data *execute_data TSRMLS_DC); ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC); void init_executor(TSRMLS_D); void shutdown_executor(TSRMLS_D); void shutdown_destructors(TSRMLS_D); zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC); -ZEND_API void execute(zend_op_array *op_array TSRMLS_DC); +ZEND_API void zend_execute(zend_op_array *op_array TSRMLS_DC); ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC); ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC); ZEND_API int zend_is_true(zval *op); @@ -222,12 +222,6 @@ static zend_always_inline void **zend_vm_stack_top(TSRMLS_D) static zend_always_inline void zend_vm_stack_push(void *ptr TSRMLS_DC) { - ZEND_VM_STACK_GROW_IF_NEEDED(1); - *(EG(argument_stack)->top++) = ptr; -} - -static zend_always_inline void zend_vm_stack_push_nocheck(void *ptr TSRMLS_DC) -{ *(EG(argument_stack)->top++) = ptr; } @@ -235,11 +229,6 @@ static zend_always_inline void *zend_vm_stack_pop(TSRMLS_D) { 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; } @@ -272,6 +261,12 @@ static zend_always_inline void *zend_vm_stack_alloc(size_t size TSRMLS_DC) return ret; } +static zend_always_inline void** zend_vm_stack_frame_base(zend_execute_data *ex) +{ + return (void**)((char*)ex->call_slots + + ZEND_MM_ALIGNED_SIZE(sizeof(call_slot)) * ex->op_array->nested_calls); +} + static zend_always_inline void zend_vm_stack_free_int(void *ptr TSRMLS_DC) { if (UNEXPECTED(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) == (void**)ptr)) { @@ -302,35 +297,6 @@ static zend_always_inline void zend_vm_stack_free(void *ptr TSRMLS_DC) } } -static zend_always_inline void** zend_vm_stack_push_args(int count TSRMLS_DC) -{ - - 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++; -} - static zend_always_inline void zend_vm_stack_clear_multiple(TSRMLS_D) { void **p = EG(argument_stack)->top - 1; @@ -344,9 +310,19 @@ static zend_always_inline void zend_vm_stack_clear_multiple(TSRMLS_D) zend_vm_stack_free_int(p TSRMLS_CC); } -static zend_always_inline zval** zend_vm_stack_get_arg(int requested_arg TSRMLS_DC) +static zend_always_inline int zend_vm_stack_get_args_count_ex(zend_execute_data *ex) +{ + if (ex) { + void **p = ex->function_state.arguments; + return (int)(zend_uintptr_t) *p; + } else { + return 0; + } +} + +static zend_always_inline zval** zend_vm_stack_get_arg_ex(zend_execute_data *ex, int requested_arg) { - void **p = EG(current_execute_data)->prev_execute_data->function_state.arguments; + void **p = ex->function_state.arguments; int arg_count = (int)(zend_uintptr_t) *p; if (UNEXPECTED(requested_arg > arg_count)) { @@ -355,25 +331,14 @@ static zend_always_inline zval** zend_vm_stack_get_arg(int requested_arg TSRMLS_ return (zval**)p - arg_count + requested_arg - 1; } -static zend_always_inline void zend_arg_types_stack_2_pop(zend_ptr_stack *stack, zval **object, zend_function **fbc) +static zend_always_inline int zend_vm_stack_get_args_count(TSRMLS_D) { - void *a, *b; - - zend_ptr_stack_2_pop(stack, &a, &b); - - *object = (zval *) a; - *fbc = (zend_function *) b; + return zend_vm_stack_get_args_count_ex(EG(current_execute_data)->prev_execute_data); } -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) +static zend_always_inline zval** zend_vm_stack_get_arg(int requested_arg TSRMLS_DC) { - 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; + return zend_vm_stack_get_arg_ex(EG(current_execute_data)->prev_execute_data, requested_arg); } void execute_new_code(TSRMLS_D); @@ -436,7 +401,6 @@ ZEND_API int zend_do_fcall(ZEND_OPCODE_HANDLER_ARGS); void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC); void zend_free_compiled_variables(zval ***CVs, int num); -void **zend_copy_arguments(void **arguments_end); #define CACHED_PTR(num) \ EG(active_op_array)->run_time_cache[(num)] |