]> granicus.if.org Git - php/commitdiff
MFH: better fix for #48409 , #48428 , #48228
authorArnaud Le Blanc <lbarnaud@php.net>
Mon, 1 Jun 2009 15:08:00 +0000 (15:08 +0000)
committerArnaud Le Blanc <lbarnaud@php.net>
Mon, 1 Jun 2009 15:08:00 +0000 (15:08 +0000)
Zend/zend.h
Zend/zend_ptr_stack.h
Zend/zend_types.h
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 8db545afe48032c7ed2be80fd19eca4ec90a8542..b169f265fd86154353f80b15b012f2817086473f 100644 (file)
@@ -178,6 +178,12 @@ char *alloca ();
 #endif
 
 
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 3400
+#else
+# define __restrict__
+#endif
+#define restrict __restrict__
+
 #if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN)
 # define do_alloca(p) alloca(p)
 # define free_alloca(p)
index 10a9fd2b808fcb400025ff2c2c85b422f8194121..a689c39c5a02d8110a07a61591f42e49df6005e3 100644 (file)
@@ -79,7 +79,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, void **a, void **b, void **c)
+static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, zend_alias *restrict a, zend_alias *restrict b, zend_alias *restrict c)
 {
        *a = *(--stack->top_element);
        *b = *(--stack->top_element);
@@ -87,7 +87,7 @@ static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void **
        stack->top -= 3;
 }
 
-static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, void **a, void **b)
+static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, zend_alias *restrict a, zend_alias *restrict b)
 {
        *a = *(--stack->top_element);
        *b = *(--stack->top_element);
index 69fa16dc984c833e9b8adbe34afaaa8f6ae12507..09c840a54c55b119f8c9894c3383d82adf0c050f 100644 (file)
@@ -36,6 +36,12 @@ 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;
 
index b14914bbff36f88ce54a460839d1a6fcacf3c273..51878d275abdaac7802674c2fd789dfef5749ba5 100644 (file)
@@ -2084,8 +2084,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
                EG(This) = current_this;
                EG(scope) = current_scope;
        }
-       EX(object) = zend_ptr_stack_pop(&EG(arg_types_stack));
-       EX(fbc) = zend_ptr_stack_pop(&EG(arg_types_stack));
+       zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc));
 
        zend_ptr_stack_clear_multiple(TSRMLS_C);
 
@@ -3857,8 +3856,7 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
                        }
                        zval_ptr_dtor(&EX(object));
                }
-               EX(object) = zend_ptr_stack_pop(&EG(arg_types_stack));
-               EX(fbc) = zend_ptr_stack_pop(&EG(arg_types_stack));
+               zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc));
        }
 
        for (i=0; i<EX(op_array)->last_brk_cont; i++) {
index febacef61550d7bbb25dc2f732bf70343cb8e8d5..801e5854867ed23e81ea441df0e09c94b4c01097 100644 (file)
@@ -302,8 +302,7 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
                EG(This) = current_this;
                EG(scope) = current_scope;
        }
-       EX(object) = zend_ptr_stack_pop(&EG(arg_types_stack));
-       EX(fbc) = zend_ptr_stack_pop(&EG(arg_types_stack));
+       zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc));
 
        zend_ptr_stack_clear_multiple(TSRMLS_C);
 
@@ -563,8 +562,7 @@ static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
                        }
                        zval_ptr_dtor(&EX(object));
                }
-               EX(object) = zend_ptr_stack_pop(&EG(arg_types_stack));
-               EX(fbc) = zend_ptr_stack_pop(&EG(arg_types_stack));
+               zend_ptr_stack_2_pop(&EG(arg_types_stack), (zend_alias*)&EX(object), (zend_alias*)&EX(fbc));
        }
 
        for (i=0; i<EX(op_array)->last_brk_cont; i++) {