From 85b9327836d901adc1f66cca2a383f8c9a8f0eae Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Fri, 5 Jun 2009 11:21:31 +0000 Subject: [PATCH] MFH: better fix for #48409 , #48428 , #48228 --- Zend/zend_execute.h | 21 +++++++++++++++++++++ Zend/zend_ptr_stack.h | 4 ++-- Zend/zend_types.h | 6 ------ Zend/zend_vm_def.h | 4 ++-- Zend/zend_vm_execute.h | 4 ++-- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 326c9ccab3..49837a94a4 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -290,6 +290,27 @@ static inline zval** zend_vm_stack_get_arg(int requested_arg TSRMLS_DC) return (zval**)p - arg_count + requested_arg - 1; } +static inline void zend_arg_types_stack_2_pop(zend_ptr_stack *stack, zval **object, zend_function **fbc) +{ + void *a, *b; + + zend_ptr_stack_2_pop(stack, &a, &b); + + *object = a; + *fbc = b; +} + +static inline void zend_arg_types_stack_3_pop(zend_ptr_stack *stack, zend_class_entry **called_scope, zval **object, zend_function **fbc) +{ + void *a, *b, *c; + + zend_ptr_stack_3_pop(stack, &a, &b, &c); + + *called_scope = a; + *object = b; + *fbc = c; +} + void execute_new_code(TSRMLS_D); diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h index fb613b88c7..f20e3d91e8 100644 --- a/Zend/zend_ptr_stack.h +++ b/Zend/zend_ptr_stack.h @@ -81,7 +81,7 @@ static inline void zend_ptr_stack_2_push(zend_ptr_stack *stack, void *a, void *b #undef ZEND_PTR_STACK_NUM_ARGS } -static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, zend_alias *restrict a, zend_alias *restrict b, zend_alias *restrict c) +static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void **b, void **c) { *a = *(--stack->top_element); *b = *(--stack->top_element); @@ -89,7 +89,7 @@ static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, zend_alias *restr stack->top -= 3; } -static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, zend_alias *restrict a, zend_alias *restrict b) +static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, void **a, void **b) { *a = *(--stack->top_element); *b = *(--stack->top_element); diff --git a/Zend/zend_types.h b/Zend/zend_types.h index e3d765529c..124adf4adf 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -50,12 +50,6 @@ typedef long zend_intptr_t; typedef unsigned long zend_uintptr_t; #endif -#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400 -typedef void* __attribute__((__may_alias__)) zend_alias; -#else -typedef void* zend_alias; -#endif - typedef unsigned int zend_object_handle; typedef struct _zend_object_handlers zend_object_handlers; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index bdd15c8da5..af3205f03e 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2288,7 +2288,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) EG(called_scope) = EX(called_scope); } - zend_ptr_stack_3_pop(&EG(arg_types_stack), (zend_alias*)&EX(called_scope), (zend_alias*)&EX(current_object), (zend_alias*)&EX(fbc)); + zend_arg_types_stack_3_pop(&EG(arg_types_stack), &EX(called_scope), &EX(current_object), &EX(fbc)); EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { @@ -4288,7 +4288,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY) zval_ptr_dtor(&EX(object)); } EX(called_scope) = DECODE_CTOR(EX(called_scope)); - zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc)); + zend_arg_types_stack_2_pop(&EG(arg_types_stack), &EX(object), &EX(fbc)); } for (i=0; ilast_brk_cont; i++) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 54954dbcaa..24794f7db0 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -290,7 +290,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR EG(called_scope) = EX(called_scope); } - zend_ptr_stack_3_pop(&EG(arg_types_stack), (zend_alias*)&EX(called_scope), (zend_alias*)&EX(current_object), (zend_alias*)&EX(fbc)); + zend_arg_types_stack_3_pop(&EG(arg_types_stack), &EX(called_scope), &EX(current_object), &EX(fbc)); EX(function_state).arguments = zend_vm_stack_push_args(opline->extended_value TSRMLS_CC); if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) { @@ -636,7 +636,7 @@ static int ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER zval_ptr_dtor(&EX(object)); } EX(called_scope) = DECODE_CTOR(EX(called_scope)); - zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc)); + zend_arg_types_stack_2_pop(&EG(arg_types_stack), &EX(object), &EX(fbc)); } for (i=0; ilast_brk_cont; i++) { -- 2.40.0