dmitry          Wed Mar 18 10:49:36 2009 UTC

  Added files:                 
    /ZendEngine2        zend_float.c 

  Modified files:              
    /php-src    configure.in 
    /ZendEngine2        Makefile.am Zend.dsp ZendTS.dsp zend.c 
                        zend_execute_API.c zend_float.h zend_globals.h 
                        zend_operators.c zend_strtod.c 
    /php-src/ext/standard       math.c 
    /php-src/win32/build        config.w32 
  Log:
  Fixed floating point mathematic speed degradation (Christian)
  
  
http://cvs.php.net/viewvc.cgi/php-src/configure.in?r1=1.675&r2=1.676&diff_format=u
Index: php-src/configure.in
diff -u php-src/configure.in:1.675 php-src/configure.in:1.676
--- php-src/configure.in:1.675  Mon Feb 23 03:35:18 2009
+++ php-src/configure.in        Wed Mar 18 10:49:35 2009
@@ -1,4 +1,4 @@
-## $Id: configure.in,v 1.675 2009/02/23 03:35:18 dsp Exp $ -*- autoconf -*-
+## $Id: configure.in,v 1.676 2009/03/18 10:49:35 dmitry Exp $ -*- autoconf -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
 divert(1)
@@ -1366,7 +1366,7 @@
     zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \
     zend_ini.c zend_qsort.c zend_ts_hash.c zend_stream.c \
     zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c \
-    zend_strtol.c zend_gc.c zend_closures.c)
+    zend_strtol.c zend_gc.c zend_closures.c zend_float.c)
 
 if test -r "$abs_srcdir/Zend/zend_objects.c"; then
   PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c 
zend_objects_API.c zend_default_classes.c)
http://cvs.php.net/viewvc.cgi/ZendEngine2/Makefile.am?r1=1.64&r2=1.65&diff_format=u
Index: ZendEngine2/Makefile.am
diff -u ZendEngine2/Makefile.am:1.64 ZendEngine2/Makefile.am:1.65
--- ZendEngine2/Makefile.am:1.64        Mon Feb 23 03:33:41 2009
+++ ZendEngine2/Makefile.am     Wed Mar 18 10:49:35 2009
@@ -17,7 +17,7 @@
        zend_objects_API.c zend_ts_hash.c zend_stream.c \
        zend_default_classes.c \
        zend_iterators.c zend_interfaces.c zend_exceptions.c \
-       zend_strtod.c zend_strtod.c zend_strtol.c zend_closures.c
+       zend_strtod.c zend_strtod.c zend_strtol.c zend_closures.c zend_float.c
 
 libZend_la_LDFLAGS =
 libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
http://cvs.php.net/viewvc.cgi/ZendEngine2/Zend.dsp?r1=1.28&r2=1.29&diff_format=u
Index: ZendEngine2/Zend.dsp
diff -u ZendEngine2/Zend.dsp:1.28 ZendEngine2/Zend.dsp:1.29
--- ZendEngine2/Zend.dsp:1.28   Mon Feb 23 03:33:41 2009
+++ ZendEngine2/Zend.dsp        Wed Mar 18 10:49:35 2009
@@ -151,6 +151,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\zend_float.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\zend_hash.c
 # End Source File
 # Begin Source File
http://cvs.php.net/viewvc.cgi/ZendEngine2/ZendTS.dsp?r1=1.50&r2=1.51&diff_format=u
Index: ZendEngine2/ZendTS.dsp
diff -u ZendEngine2/ZendTS.dsp:1.50 ZendEngine2/ZendTS.dsp:1.51
--- ZendEngine2/ZendTS.dsp:1.50 Mon Feb 23 03:33:41 2009
+++ ZendEngine2/ZendTS.dsp      Wed Mar 18 10:49:35 2009
@@ -180,6 +180,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\zend_float.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\zend_hash.c
 # End Source File
 # Begin Source File
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?r1=1.429&r2=1.430&diff_format=u
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.429 ZendEngine2/zend.c:1.430
--- ZendEngine2/zend.c:1.429    Wed Feb 18 10:55:23 2009
+++ ZendEngine2/zend.c  Wed Mar 18 10:49:35 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend.c,v 1.429 2009/02/18 10:55:23 dmitry Exp $ */
+/* $Id: zend.c,v 1.430 2009/03/18 10:49:35 dmitry Exp $ */
 
 #include "zend.h"
 #include "zend_extensions.h"
@@ -976,6 +976,7 @@
        EG(current_execute_data) = NULL;
        EG(current_module) = NULL;
        EG(exit_status) = 0;
+       EG(saved_fpu_cw) = NULL;
        EG(active) = 0;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.473&r2=1.474&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.473 
ZendEngine2/zend_execute_API.c:1.474
--- ZendEngine2/zend_execute_API.c:1.473        Thu Mar  5 16:24:41 2009
+++ ZendEngine2/zend_execute_API.c      Wed Mar 18 10:49:35 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.473 2009/03/05 16:24:41 felipe Exp $ */
+/* $Id: zend_execute_API.c,v 1.474 2009/03/18 10:49:35 dmitry Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -32,6 +32,7 @@
 #include "zend_closures.h"
 #include "zend_exceptions.h"
 #include "zend_vm.h"
+#include "zend_float.h"
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -136,6 +137,8 @@
 
 void init_executor(TSRMLS_D) /* {{{ */
 {
+       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));
@@ -353,6 +356,9 @@
                        FREE_HASHTABLE(EG(in_autoload));
                }
        } zend_end_try();
+
+       zend_shutdown_fpu(TSRMLS_C);
+
        EG(active) = 0;
 }
 /* }}} */
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_float.h?r1=1.4&r2=1.5&diff_format=u
Index: ZendEngine2/zend_float.h
diff -u ZendEngine2/zend_float.h:1.4 ZendEngine2/zend_float.h:1.5
--- ZendEngine2/zend_float.h:1.4        Tue Mar 17 13:33:51 2009
+++ ZendEngine2/zend_float.h    Wed Mar 18 10:49:35 2009
@@ -16,15 +16,17 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_float.h,v 1.4 2009/03/17 13:33:51 pajoye Exp $ */
+/* $Id: zend_float.h,v 1.5 2009/03/18 10:49:35 dmitry Exp $ */
 
 #ifndef ZEND_FLOAT_H
 #define ZEND_FLOAT_H
 
-#define ZEND_FLOAT_DECLARE                             XPFPA_DECLARE
-#define ZEND_FLOAT_ENSURE()                            XPFPA_SWITCH_DOUBLE()
-#define ZEND_FLOAT_RESTORE()                   XPFPA_RESTORE()
-#define ZEND_FLOAT_RETURN(val)                 XPFPA_RETURN_DOUBLE(val)
+/*
+  Define functions for FP initialization and de-initialization.
+*/
+extern ZEND_API void zend_init_fpu(TSRMLS_D);
+extern ZEND_API void zend_shutdown_fpu(TSRMLS_D);
+extern ZEND_API void zend_ensure_fpu_mode(TSRMLS_D);
 
 /* Copy of the contents of xpfpa.h (which is under public domain)
    See http://wiki.php.net/rfc/rounding for details.
@@ -45,7 +47,7 @@
    For further details, please visit:
    http://www.christian-seiler.de/projekte/fpmath/
 
-   Version: 20081026 */
+   Version: 20090317 */
 
 /*
  Implementation notes:
@@ -69,11 +71,8 @@
 /* MSVC detection (MSVC people usually don't use autoconf) */
 #ifdef _MSC_VER
 # if _MSC_VER >= 1500
-   /* Disable it, it slowdowns the floating operation more than
-      anything else, by a factor 3 (using Bench.php (mandel and 
-      mandel2 for example)*/
    /* Visual C++ 2008 or higher, supports _controlfp_s */
-   /*#  define HAVE__CONTROLFP_S */
+#  define HAVE__CONTROLFP_S
 # else
    /* Visual C++ (up to 2005), supports _controlfp */
 #  define HAVE__CONTROLFP
@@ -87,6 +86,19 @@
 /* float.h defines _controlfp_s */
 # include <float.h>
 
+# define XPFPA_HAVE_CW 1
+# define XPFPA_CW_DATATYPE \
+            unsigned int
+
+# define XPFPA_STORE_CW(vptr) do { \
+            _controlfp_s((unsigned int *)(vptr), 0, 0); \
+        } while (0)
+
+# define XPFPA_RESTORE_CW(vptr) do { \
+            unsigned int _xpfpa_fpu_cw; \
+            _controlfp_s(&_xpfpa_fpu_cw, *((unsigned int *)(vptr)), _MCW_PC); \
+        } while (0)
+
 # define XPFPA_DECLARE \
             unsigned int _xpfpa_fpu_oldcw, _xpfpa_fpu_cw;
 
@@ -141,6 +153,18 @@
 # define XPFPA_DECLARE \
             unsigned int _xpfpa_fpu_oldcw;
 
+# define XPFPA_HAVE_CW 1
+# define XPFPA_CW_DATATYPE \
+            unsigned int
+
+# define XPFPA_STORE_CW(vptr) do { \
+            *((unsigned int *)(vptr)) = _controlfp(0, 0); \
+        } while (0)
+
+# define XPFPA_RESTORE_CW(vptr) do { \
+            _controlfp(*((unsigned int *)(vptr)), _MCW_PC); \
+        } while (0)
+
 # define XPFPA_SWITCH_DOUBLE() do { \
             _xpfpa_fpu_oldcw = _controlfp(0, 0); \
             _controlfp(_PC_53, _MCW_PC); \
@@ -188,6 +212,18 @@
 # define XPFPA_DECLARE \
             fpu_control_t _xpfpa_fpu_oldcw, _xpfpa_fpu_cw;
 
+# define XPFPA_HAVE_CW 1
+# define XPFPA_CW_DATATYPE \
+            fpu_control_t
+
+# define XPFPA_STORE_CW(vptr) do { \
+            _FPU_GETCW((*((fpu_control_t *)(vptr)))); \
+        } while (0)
+
+# define XPFPA_RESTORE_CW(vptr) do { \
+            _FPU_SETCW((*((fpu_control_t *)(vptr)))); \
+        } while (0)
+
 # define XPFPA_SWITCH_DOUBLE() do { \
             _FPU_GETCW(_xpfpa_fpu_oldcw); \
             _xpfpa_fpu_cw = (_xpfpa_fpu_oldcw & ~_FPU_EXTENDED & ~_FPU_SINGLE) 
| _FPU_DOUBLE; \
@@ -235,6 +271,18 @@
 # define XPFPA_DECLARE \
             fp_prec_t _xpfpa_fpu_oldprec;
 
+# define XPFPA_HAVE_CW 1
+# define XPFPA_CW_DATATYPE \
+            fp_prec_t
+
+# define XPFPA_STORE_CW(vptr) do { \
+            *((fp_prec_t *)(vptr)) = fpgetprec(); \
+        } while (0)
+
+# define XPFPA_RESTORE_CW(vptr) do { \
+            fpsetprec(*((fp_prec_t *)(vptr))); \
+        } while (0)
+
 # define XPFPA_SWITCH_DOUBLE() do { \
             _xpfpa_fpu_oldprec = fpgetprec(); \
             fpsetprec(FP_PD); \
@@ -298,6 +346,18 @@
 # define XPFPA_DECLARE \
             unsigned int _xpfpa_fpu_oldcw, _xpfpa_fpu_cw;
 
+# define XPFPA_HAVE_CW 1
+# define XPFPA_CW_DATATYPE \
+            unsigned int
+
+# define XPFPA_STORE_CW(vptr) do { \
+            __asm__ __volatile__ ("fnstcw %0" : "=m" (*((unsigned int 
*)(vptr)))); \
+        } while (0)
+
+# define XPFPA_RESTORE_CW(vptr) do { \
+            __asm__ __volatile__ ("fldcw %0" : : "m" (*((unsigned int 
*)(vptr)))); \
+        } while (0)
+
 # define XPFPA_SWITCH_DOUBLE() do { \
             __asm__ __volatile__ ("fnstcw %0" : "=m" (*&_xpfpa_fpu_oldcw)); \
             _xpfpa_fpu_cw = (_xpfpa_fpu_oldcw & ~0x100) | 0x200; \
@@ -345,6 +405,10 @@
   generated code will behave as planned.
 */
 # define XPFPA_DECLARE                      /* NOP */
+# define XPFPA_HAVE_CW                      0
+# define XPFPA_CW_DATATYPE                  unsigned int
+# define XPFPA_STORE_CW(variable)           /* NOP */
+# define XPFPA_RESTORE_CW(variable)         /* NOP */
 # define XPFPA_SWITCH_DOUBLE()              /* NOP */
 # define XPFPA_SWITCH_SINGLE()              /* NOP */
 # define XPFPA_SWITCH_DOUBLE_EXTENDED()     /* NOP */
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_globals.h?r1=1.184&r2=1.185&diff_format=u
Index: ZendEngine2/zend_globals.h
diff -u ZendEngine2/zend_globals.h:1.184 ZendEngine2/zend_globals.h:1.185
--- ZendEngine2/zend_globals.h:1.184    Fri Jan 16 10:03:21 2009
+++ ZendEngine2/zend_globals.h  Wed Mar 18 10:49:35 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_globals.h,v 1.184 2009/01/16 10:03:21 pajoye Exp $ */
+/* $Id: zend_globals.h,v 1.185 2009/03/18 10:49:35 dmitry Exp $ */
 
 #ifndef ZEND_GLOBALS_H
 #define ZEND_GLOBALS_H
@@ -242,6 +242,8 @@
 
        zend_bool active; 
 
+       void *saved_fpu_cw;
+
        void *reserved[ZEND_MAX_RESERVED_RESOURCES];
 };
 
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_operators.c?r1=1.300&r2=1.301&diff_format=u
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.300 ZendEngine2/zend_operators.c:1.301
--- ZendEngine2/zend_operators.c:1.300  Tue Feb 17 15:14:48 2009
+++ ZendEngine2/zend_operators.c        Wed Mar 18 10:49:35 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_operators.c,v 1.300 2009/02/17 15:14:48 mattwil Exp $ */
+/* $Id: zend_operators.c,v 1.301 2009/03/18 10:49:35 dmitry Exp $ */
 
 #include <ctype.h>
 
@@ -30,7 +30,6 @@
 #include "zend_multiply.h"
 #include "zend_strtod.h"
 #include "zend_exceptions.h"
-#include "zend_float.h"
 
 #include "unicode/uchar.h"
 #include "unicode/ucol.h"
@@ -1259,7 +1258,6 @@
 
 ZEND_API int add_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ 
*/
 {
-       ZEND_FLOAT_DECLARE
        zval op1_copy, op2_copy;
        int converted = 0;
 
@@ -1272,9 +1270,7 @@
                                if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) == 
(Z_LVAL_P(op2) & LONG_SIGN_MASK)
                                        && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != 
(lval & LONG_SIGN_MASK)) {
 
-                                       ZEND_FLOAT_ENSURE();
                                        ZVAL_DOUBLE(result, (double) 
Z_LVAL_P(op1) + (double) Z_LVAL_P(op2));
-                                       ZEND_FLOAT_RESTORE();
                                } else {
                                        ZVAL_LONG(result, lval);
                                }
@@ -1282,21 +1278,15 @@
                        }
 
                        case TYPE_PAIR(IS_LONG, IS_DOUBLE):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + 
Z_DVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_DOUBLE, IS_LONG):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, Z_DVAL_P(op1) + 
((double)Z_LVAL_P(op2)));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, Z_DVAL_P(op1) + 
Z_DVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_ARRAY, IS_ARRAY): {
@@ -1330,7 +1320,6 @@
 
 ZEND_API int sub_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ 
*/
 {
-       ZEND_FLOAT_DECLARE
        zval op1_copy, op2_copy;
        int converted = 0;
 
@@ -1343,9 +1332,7 @@
                                if ((Z_LVAL_P(op1) & LONG_SIGN_MASK) != 
(Z_LVAL_P(op2) & LONG_SIGN_MASK)
                                        && (Z_LVAL_P(op1) & LONG_SIGN_MASK) != 
(lval & LONG_SIGN_MASK)) {
 
-                                       ZEND_FLOAT_ENSURE();
                                        ZVAL_DOUBLE(result, (double) 
Z_LVAL_P(op1) - (double) Z_LVAL_P(op2));
-                                       ZEND_FLOAT_RESTORE();
                                } else {
                                        ZVAL_LONG(result, lval);
                                }
@@ -1353,21 +1340,15 @@
 
                        }
                        case TYPE_PAIR(IS_LONG, IS_DOUBLE):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - 
Z_DVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_DOUBLE, IS_LONG):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, Z_DVAL_P(op1) - 
((double)Z_LVAL_P(op2)));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, Z_DVAL_P(op1) - 
Z_DVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        default:
@@ -1386,7 +1367,6 @@
 
 ZEND_API int mul_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ 
*/
 {
-       ZEND_FLOAT_DECLARE
        zval op1_copy, op2_copy;
        int converted = 0;
 
@@ -1395,29 +1375,21 @@
                        case TYPE_PAIR(IS_LONG, IS_LONG): {
                                long overflow;
 
-                               ZEND_FLOAT_ENSURE();
                                
ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1),Z_LVAL_P(op2), 
Z_LVAL_P(result),Z_DVAL_P(result),overflow);
-                               ZEND_FLOAT_RESTORE();
                                Z_TYPE_P(result) = overflow ? IS_DOUBLE : 
IS_LONG;
                                return SUCCESS;
 
                        }
                        case TYPE_PAIR(IS_LONG, IS_DOUBLE):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * 
Z_DVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_DOUBLE, IS_LONG):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, Z_DVAL_P(op1) * 
((double)Z_LVAL_P(op2)));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, Z_DVAL_P(op1) * 
Z_DVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        default:
@@ -1436,7 +1408,6 @@
 
 ZEND_API int div_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ 
*/
 {
-       ZEND_FLOAT_DECLARE
        zval op1_copy, op2_copy;
        int converted = 0;
 
@@ -1449,17 +1420,13 @@
                                        return FAILURE;                 /* 
division by zero */
                                } else if (Z_LVAL_P(op2) == -1 && Z_LVAL_P(op1) 
== LONG_MIN) {
                                        /* Prevent overflow error/crash */
-                                       ZEND_FLOAT_ENSURE();
                                        ZVAL_DOUBLE(result, (double) LONG_MIN / 
-1);
-                                       ZEND_FLOAT_RESTORE();
                                        return SUCCESS;
                                }
                                if (Z_LVAL_P(op1) % Z_LVAL_P(op2) == 0) { /* 
integer */
                                        ZVAL_LONG(result, Z_LVAL_P(op1) / 
Z_LVAL_P(op2));
                                } else {
-                                       ZEND_FLOAT_ENSURE();
                                        ZVAL_DOUBLE(result, ((double) 
Z_LVAL_P(op1)) / Z_LVAL_P(op2));
-                                       ZEND_FLOAT_RESTORE();
                                }
                                return SUCCESS;
 
@@ -1469,9 +1436,7 @@
                                        ZVAL_BOOL(result, 0);
                                        return FAILURE;                 /* 
division by zero */
                                }
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, Z_DVAL_P(op1) / 
(double)Z_LVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_LONG, IS_DOUBLE):
@@ -1480,9 +1445,7 @@
                                        ZVAL_BOOL(result, 0);
                                        return FAILURE;                 /* 
division by zero */
                                }
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, (double)Z_LVAL_P(op1) / 
Z_DVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        case TYPE_PAIR(IS_DOUBLE, IS_DOUBLE):
@@ -1491,9 +1454,7 @@
                                        ZVAL_BOOL(result, 0);
                                        return FAILURE;                 /* 
division by zero */
                                }
-                               ZEND_FLOAT_ENSURE();
                                ZVAL_DOUBLE(result, Z_DVAL_P(op1) / 
Z_DVAL_P(op2));
-                               ZEND_FLOAT_RESTORE();
                                return SUCCESS;
 
                        default:
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_strtod.c?r1=1.41&r2=1.42&diff_format=u
Index: ZendEngine2/zend_strtod.c
diff -u ZendEngine2/zend_strtod.c:1.41 ZendEngine2/zend_strtod.c:1.42
--- ZendEngine2/zend_strtod.c:1.41      Thu Feb 12 20:04:59 2009
+++ ZendEngine2/zend_strtod.c   Wed Mar 18 10:49:35 2009
@@ -89,12 +89,11 @@
  *     directly -- and assumed always to succeed.
  */
 
-/* $Id: zend_strtod.c,v 1.41 2009/02/12 20:04:59 moriyoshi Exp $ */
+/* $Id: zend_strtod.c,v 1.42 2009/03/18 10:49:35 dmitry Exp $ */
 
 #include <zend.h>
 #include <unicode/utypes.h>
 #include <zend_strtod.h>
-#include <zend_float.h>
 
 #ifdef ZTS
 #include <TSRM.h>
@@ -2045,7 +2044,6 @@
 
 ZEND_API double zend_strtod (CONST char *s00, char **se) /* {{{ */
 {
-       ZEND_FLOAT_DECLARE
        int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
                e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
        CONST char *s, *s0, *s1;
@@ -2058,8 +2056,6 @@
 
        CONST char decimal_point = '.';
 
-       ZEND_FLOAT_ENSURE();
-
        sign = nz0 = nz = 0;
        value(rv) = 0.;
 
@@ -2590,7 +2586,7 @@
        }
        _THREAD_PRIVATE_MUTEX_UNLOCK(pow5mult_mutex);
 
-       ZEND_FLOAT_RETURN(result);
+       return result;
 }
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/math.c?r1=1.152&r2=1.153&diff_format=u
Index: php-src/ext/standard/math.c
diff -u php-src/ext/standard/math.c:1.152 php-src/ext/standard/math.c:1.153
--- php-src/ext/standard/math.c:1.152   Tue Mar 10 23:39:40 2009
+++ php-src/ext/standard/math.c Wed Mar 18 10:49:35 2009
@@ -19,12 +19,11 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: math.c,v 1.152 2009/03/10 23:39:40 helly Exp $ */
+/* $Id: math.c,v 1.153 2009/03/18 10:49:35 dmitry Exp $ */
 
 #include "php.h"
 #include "php_math.h"
 #include "zend_multiply.h"
-#include "zend_float.h"
 
 #include <math.h>
 #include <float.h>
@@ -94,10 +93,8 @@
 /* {{{ php_round_helper
        Actually performs the rounding of a value to integer in a certain mode 
*/
 static inline double php_round_helper(double value, int mode) {
-       ZEND_FLOAT_DECLARE
        double tmp_value;
 
-       ZEND_FLOAT_ENSURE();
        if (value >= 0.0) {
                tmp_value = floor(value + 0.5);
                if ((mode == PHP_ROUND_HALF_DOWN && value == (-0.5 + 
tmp_value)) ||
@@ -116,7 +113,7 @@
                }
        }
 
-       ZEND_FLOAT_RETURN(tmp_value);
+       return tmp_value;
 }
 /* }}} */
 
@@ -126,13 +123,10 @@
  * mode. For the specifics of the algorithm, see 
http://wiki.php.net/rfc/rounding
  */
 PHPAPI double _php_math_round(double value, int places, int mode) {
-       ZEND_FLOAT_DECLARE
        double f1, f2;
        double tmp_value;
        int precision_places;
 
-       ZEND_FLOAT_ENSURE();
-
        precision_places = 14 - php_intlog10abs(value);
 
        f1 = php_intpow10(abs(places));
@@ -163,7 +157,7 @@
                }
                /* This value is beyond our precision, so rounding it is 
pointless */
                if (fabs(tmp_value) >= 1e15) {
-                       ZEND_FLOAT_RETURN(value);
+                       return value;
                }
        }
 
@@ -196,7 +190,7 @@
                }
        }
 
-       ZEND_FLOAT_RETURN(tmp_value);
+       return tmp_value;
 }
 /* }}} */
 
http://cvs.php.net/viewvc.cgi/php-src/win32/build/config.w32?r1=1.99&r2=1.100&diff_format=u
Index: php-src/win32/build/config.w32
diff -u php-src/win32/build/config.w32:1.99 php-src/win32/build/config.w32:1.100
--- php-src/win32/build/config.w32:1.99 Mon Feb 23 03:35:18 2009
+++ php-src/win32/build/config.w32      Wed Mar 18 10:49:36 2009
@@ -1,5 +1,5 @@
 // vim:ft=javascript
-// $Id: config.w32,v 1.99 2009/02/23 03:35:18 dsp Exp $
+// $Id: config.w32,v 1.100 2009/03/18 10:49:36 dmitry Exp $
 // "Master" config file; think of it as a configure.in
 // equivalent.
 
@@ -343,7 +343,8 @@
        zend_sprintf.c zend_ini.c zend_qsort.c zend_ts_hash.c \
        zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
        zend_object_handlers.c zend_objects_API.c  zend_unicode.c zend_strtol.c 
 \
-       zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c 
zend_closures.c");
+       zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c 
zend_closures.c \
+       zend_float.c");
 
 ADD_SOURCES("main", "main.c snprintf.c spprintf.c fopen_wrappers.c \
        php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \

http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_float.c?view=markup&rev=1.1
Index: ZendEngine2/zend_float.c
+++ ZendEngine2/zend_float.c
/*
   +----------------------------------------------------------------------+
   | Zend Engine                                                          |
   +----------------------------------------------------------------------+
   | Copyright (c) 1998-2009 Zend Technologies Ltd. (http://www.zend.com) |
   +----------------------------------------------------------------------+
   | This source file is subject to version 2.00 of the Zend license,     |
   | that is bundled with this package in the file LICENSE, and is        | 
   | available through the world-wide-web at the following url:           |
   | http://www.zend.com/license/2_00.txt.                                |
   | If you did not receive a copy of the Zend license and are unable to  |
   | obtain it through the world-wide-web, please send a note to          |
   | lice...@zend.com so we can mail you a copy immediately.              |
   +----------------------------------------------------------------------+
   | Authors: Christian Seiler <chris...@gmx.net>                         |
   +----------------------------------------------------------------------+
*/

/* $Id: zend_float.c,v 1.1 2009/03/18 10:49:35 dmitry Exp $ */

#include "zend.h"
#include "zend_compile.h"
#include "zend_float.h"

ZEND_API void zend_init_fpu(TSRMLS_D) /* {{{ */
{
#if XPFPA_HAVE_CW
        XPFPA_DECLARE
        
        if (!EG(saved_fpu_cw)) {
                EG(saved_fpu_cw) = emalloc(sizeof(XPFPA_CW_DATATYPE));
        }
        XPFPA_STORE_CW(EG(saved_fpu_cw));
        XPFPA_SWITCH_DOUBLE();
#else
        if (EG(saved_fpu_cw)) {
                efree(EG(saved_fpu_cw));
        }
        EG(saved_fpu_cw) = NULL;
#endif
}
/* }}} */

ZEND_API void zend_shutdown_fpu(TSRMLS_D) /* {{{ */
{
#if XPFPA_HAVE_CW
        if (EG(saved_fpu_cw)) {
                XPFPA_RESTORE_CW(EG(saved_fpu_cw));
        }
#endif
        if (EG(saved_fpu_cw)) {
                efree(EG(saved_fpu_cw));
                EG(saved_fpu_cw) = NULL;
        }
}
/* }}} */

ZEND_API void zend_ensure_fpu_mode(TSRMLS_D) /* {{{ */
{
        XPFPA_DECLARE
        
        XPFPA_SWITCH_DOUBLE();
}
/* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to