]> granicus.if.org Git - php/commitdiff
Optimize "backup" functions of inlined opcode handlers for size
authorDmitry Stogov <dmitry@zend.com>
Thu, 15 Feb 2018 14:04:41 +0000 (17:04 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 15 Feb 2018 14:04:41 +0000 (17:04 +0300)
Zend/zend_portability.h
Zend/zend_vm_execute.h
Zend/zend_vm_gen.php

index abf7dcc5a4c74691d26a1d388a50c2d225419337..ed8f07389b216cfc1fda365842a61dfd6cda8499 100644 (file)
@@ -221,10 +221,19 @@ char *alloca();
 # define ZEND_ATTRIBUTE_UNUSED __attribute__((unused))
 # define ZEND_COLD __attribute__((cold))
 # define ZEND_HOT __attribute__((hot))
+# ifdef __OPTIMIZE__
+#  define ZEND_OPT_SIZE  __attribute__((optimize("Os")))
+#  define ZEND_OPT_SPEED __attribute__((optimize("Ofast")))
+# else
+#  define ZEND_OPT_SIZE
+#  define ZEND_OPT_SPEED
+# endif
 #else
 # define ZEND_ATTRIBUTE_UNUSED
 # define ZEND_COLD
 # define ZEND_HOT
+# define ZEND_OPT_SIZE
+# define ZEND_OPT_SPEED
 #endif
 
 #if defined(__GNUC__) && ZEND_GCC_VERSION >= 5000
index 4b8466f73e693586b1e7f82f79dc6dcd1e9c2b58..44ca3f4ef8d5d50d839587b513655743beb50496 100644 (file)
@@ -366,7 +366,7 @@ static const void *zend_vm_get_opcode_handler_func(zend_uchar opcode, const zend
 # endif
 # if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)
 #  define ZEND_VM_RETURN()        opline = &hybrid_halt_op; return
-#  define ZEND_VM_HOT             zend_always_inline
+#  define ZEND_VM_HOT             zend_always_inline ZEND_OPT_SIZE
 # else
 #  define ZEND_VM_RETURN()        opline = NULL; return
 #  define ZEND_VM_HOT
index d06cd89628af8b4841f25dc7d225e8f02e02a872..37a660127f22f1ca20e3f8afbc5a78d00366ceb4 100644 (file)
@@ -1745,7 +1745,7 @@ function gen_executor($f, $skl, $spec, $kind, $executor_name, $initializer_name)
                                                        if ($kind == ZEND_VM_KIND_HYBRID) {
                                                                out($f,"# if (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID)\n");
                                                                out($f,"#  define ZEND_VM_RETURN()        opline = &hybrid_halt_op; return\n");
-                                                               out($f,"#  define ZEND_VM_HOT             zend_always_inline\n");
+                                                               out($f,"#  define ZEND_VM_HOT             zend_always_inline ZEND_OPT_SIZE\n");
                                                                out($f,"# else\n");
                                                                out($f,"#  define ZEND_VM_RETURN()        opline = NULL; return\n");
                                                                out($f,"#  define ZEND_VM_HOT\n");