RE: [PHP-CVS] com php-src: Enable GCC global register variables if available: Zend/Zend.m4 Zend/zend_execute.c

From: Date: Tue, 17 Mar 2015 12:39:39 +0000
Subject: RE: [PHP-CVS] com php-src: Enable GCC global register variables if available: Zend/Zend.m4 Zend/zend_execute.c
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-85121@lists.php.net to get a copy of this message
Hi, Dmitry. Thank you for contacting us. Leonardo and Caio (in CC), they will verify. Thank you very much. Temple. From: Dmitry Stogov [mailto:dmitry@zend.com] Sent: terça-feira, 17 de março de 2015 08:01 To: Ard Biesheuvel; Gustavo Frederico Temple Pedrosa Cc: PHP Internals Subject: Fwd: [PHP-CVS] com php-src: Enable GCC global register variables if available: Zend/Zend.m4 Zend/zend_execute.c Hi, Please consider possibility of using the same optimization for ARM, PPC and may be other platforms. On x86(_84) it makes 2-7% speedup. Only the similar changes in zend_execute.c and Zend.m4 are required to enable it. Thanks. Dmitry. ---------- Forwarded message ---------- From: Dmitry Stogov <dmitry@php.net> Date: Tue, Mar 17, 2015 at 1:51 PM Subject: [PHP-CVS] com php-src: Enable GCC global register variables if available: Zend/Zend.m4 Zend/zend_execute.c To: php-cvs@lists.php.net Commit:    fb4b7069842491eb66272587422a1f61d41eb869 Author:    Dmitry Stogov <dmitry@zend.com>         Tue, 17 Mar 2015 13:51:02 +0300 Parents:   92bf4566ea65042b8f84cae7840298ed151a4f7a Branches:  master Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=fb4b7069842491eb66272587422a1f61d41eb869 Log: Enable GCC global register variables if available Changed paths:   M  Zend/Zend.m4   M  Zend/zend_execute.c Diff: diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 16f2d5f..e12b00d 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -409,3 +409,48 @@ else      AC_MSG_RESULT(no)    fi  fi + +AC_ARG_ENABLE(gcc-global-regs, +[  --disable-gcc-global-regs +                          whether to enable GCC global register variables],[ +  ZEND_GCC_GLOBAL_REGS=$enableval +],[ +  ZEND_GCC_GLOBAL_REGS=yes +]) +AC_MSG_CHECKING(for global register variables support) +if test "$ZEND_GCC_GLOBAL_REGS" != "no"; then +  AC_TRY_COMPILE([ +  ],[ +#if defined(__GNUC__) && defined(i386) +# define ZEND_VM_FP_GLOBAL_REG "%esi" +# define ZEND_VM_IP_GLOBAL_REG "%edi" +#elif defined(__GNUC__) && defined(__x86_64__) +# define ZEND_VM_FP_GLOBAL_REG "%r14" +# define ZEND_VM_IP_GLOBAL_REG "%r15" +#else +# error "global register variables are not supported" +#endif +typedef int (*opcode_handler_t)(void); +register void *FP  __asm__(ZEND_VM_FP_GLOBAL_REG); +register const opcode_handler_t *IP __asm__(ZEND_VM_IP_GLOBAL_REG); +int emu(const opcode_handler_t *ip, void *fp) { +       const opcode_handler_t *orig_ip = IP; +       void *orig_fp = FP; +       IP = ip; +       FP = fp; +       while ((*ip)()); +       FP = orig_fp; +       IP = orig_ip; +} +  ], [ +    ZEND_GCC_GLOBAL_REGS=yes +  ], [ +    ZEND_GCC_GLOBAL_REGS=no +  ]) +fi +if test "$ZEND_GCC_GLOBAL_REGS" = "yes"; then +  AC_DEFINE([HAVE_GCC_GLOBAL_REGS], 1, [Define if the target system has support for global register variables]) +else +  HAVE_GCC_GLOBAL_REGS=no +fi +AC_MSG_RESULT(ZEND_GCC_GLOBAL_REGS) diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index b24218a..17e68dc 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -2049,7 +2049,7 @@ static zend_always_inline void zend_vm_stack_extend_call_frame(zend_execute_data  }  /* }}} */ -#if HAVE_GCC_GLOBAL_REGS +#ifdef HAVE_GCC_GLOBAL_REGS  # if defined(__GNUC__) && defined(i386)  #  define ZEND_VM_FP_GLOBAL_REG "%esi"  #  define ZEND_VM_IP_GLOBAL_REG "%edi" -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.internals (#85121) next »