Permalink
Browse files

Arithmetic speedup. Inlined most probable code-paths for arithmetic o…

…perations directly into executor.
  • Loading branch information...
1 parent 9b8acf8 commit b7eb3c1c5a858e98985adc2335df9b4a021ade51 Dmitry Stogov committed May 23, 2011
Showing with 675 additions and 316 deletions.
  1. +2 −0 NEWS
  2. +12 −0 Zend/zend_multiply.h
  3. +0 −3 Zend/zend_operators.c
  4. +416 −0 Zend/zend_operators.h
  5. +21 −25 Zend/zend_vm_def.h
  6. +224 −288 Zend/zend_vm_execute.h
View
2 NEWS
@@ -80,6 +80,8 @@ PHP NEWS
opcode operands into a separate literal table. (Dmitry)
- Improved Zend Engine, performance tweaks and optimizations: (Dmitry)
+ . Inlined most probable code-paths for arithmetic operations directly into
+ executor
. Eliminated unnecessary iterations during request startup/shutdown.
. Changed $GLOBALS into a JIT autoglobal, so it's initialized only if used.
(this may affect opcode caches!)
View
@@ -31,6 +31,18 @@
else (lval) = __tmpvar; \
} while (0)
+#elif defined(__x86_64__) && defined(__GNUC__)
+
+#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
+ long __tmpvar; \
+ __asm__ ("imulq %3,%0\n" \
+ "adcq $0,%1" \
+ : "=r"(__tmpvar),"=r"(usedval) \
+ : "0"(a), "r"(b), "1"(0)); \
+ if (usedval) (dval) = (double) (a) * (double) (b); \
+ else (lval) = __tmpvar; \
+} while (0)
+
#elif SIZEOF_LONG == 4 && defined(HAVE_ZEND_LONG64)
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
View
@@ -27,13 +27,10 @@
#include "zend_globals.h"
#include "zend_list.h"
#include "zend_API.h"
-#include "zend_multiply.h"
#include "zend_strtod.h"
#include "zend_exceptions.h"
#include "zend_closures.h"
-#define LONG_SIGN_MASK (1L << (8*sizeof(long)-1))
-
#if ZEND_USE_TOLOWER_L
#include <locale.h>
static _locale_t current_locale = NULL;
Oops, something went wrong.

0 comments on commit b7eb3c1

Please sign in to comment.