dmitry Fri, 09 Jul 2010 09:02:14 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=301109
Log:
Eliminated useless allocation of FPU control word on each request startup
Changed paths:
U php/php-src/trunk/Zend/zend_float.c
U php/php-src/trunk/Zend/zend_globals.h
Modified: php/php-src/trunk/Zend/zend_float.c
===================================================================
--- php/php-src/trunk/Zend/zend_float.c 2010-07-09 08:21:30 UTC (rev 301108)
+++ php/php-src/trunk/Zend/zend_float.c 2010-07-09 09:02:14 UTC (rev 301109)
@@ -27,16 +27,13 @@
#if XPFPA_HAVE_CW
XPFPA_DECLARE
- if (!EG(saved_fpu_cw)) {
- EG(saved_fpu_cw) = emalloc(sizeof(XPFPA_CW_DATATYPE));
+ if (!EG(saved_fpu_cw_ptr)) {
+ EG(saved_fpu_cw_ptr) = (void*)&EG(saved_fpu_cw);
}
- XPFPA_STORE_CW(EG(saved_fpu_cw));
+ XPFPA_STORE_CW(EG(saved_fpu_cw_ptr));
XPFPA_SWITCH_DOUBLE();
#else
- if (EG(saved_fpu_cw)) {
- efree(EG(saved_fpu_cw));
- }
- EG(saved_fpu_cw) = NULL;
+ EG(saved_fpu_cw_ptr) = NULL;
#endif
}
/* }}} */
@@ -44,14 +41,11 @@
ZEND_API void zend_shutdown_fpu(TSRMLS_D) /* {{{ */
{
#if XPFPA_HAVE_CW
- if (EG(saved_fpu_cw)) {
- XPFPA_RESTORE_CW(EG(saved_fpu_cw));
+ if (EG(saved_fpu_cw_ptr)) {
+ XPFPA_RESTORE_CW(EG(saved_fpu_cw_ptr));
}
#endif
- if (EG(saved_fpu_cw)) {
- efree(EG(saved_fpu_cw));
- EG(saved_fpu_cw) = NULL;
- }
+ EG(saved_fpu_cw_ptr) = NULL;
}
/* }}} */
Modified: php/php-src/trunk/Zend/zend_globals.h
===================================================================
--- php/php-src/trunk/Zend/zend_globals.h 2010-07-09 08:21:30 UTC (rev
301108)
+++ php/php-src/trunk/Zend/zend_globals.h 2010-07-09 09:02:14 UTC (rev
301109)
@@ -34,6 +34,7 @@
#include "zend_objects.h"
#include "zend_objects_API.h"
#include "zend_modules.h"
+#include "zend_float.h"
#ifdef ZEND_MULTIBYTE
#include "zend_multibyte.h"
@@ -261,7 +262,10 @@
zend_bool active;
- void *saved_fpu_cw;
+ void *saved_fpu_cw_ptr;
+#if XPFPA_HAVE_CW
+ XPFPA_CW_DATATYPE saved_fpu_cw;
+#endif
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
};
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php