summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-01-24 10:57:45 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-01-24 10:57:45 +0100
commite0f97ae7ec89bdfef163e4b76b895ffab84dedba (patch)
tree4527fa13374a8f2eda7929fbd9c20907f075f2c5
parent19a9a6ba242776901a1b9cf6b41ff52a9917665e (diff)
parent526344aa5ee3190b754e3678e0c71b0d7f272876 (diff)
downloadphp-git-e0f97ae7ec89bdfef163e4b76b895ffab84dedba.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
-rw-r--r--Zend/zend_compile.c4
-rw-r--r--Zend/zend_compile.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index e0ccd56a5c..01049f4175 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -4956,6 +4956,10 @@ static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) {
}
static zend_bool should_use_jumptable(zend_ast_list *cases, zend_uchar jumptable_type) {
+ if (CG(compiler_options) & ZEND_COMPILE_NO_JUMPTABLES) {
+ return 0;
+ }
+
/* Thresholds are chosen based on when the average switch time for equidistributed
* input becomes smaller when using the jumptable optimization. */
if (jumptable_type == IS_LONG) {
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
index a8244d6b5b..f63b3a755d 100644
--- a/Zend/zend_compile.h
+++ b/Zend/zend_compile.h
@@ -1048,6 +1048,9 @@ END_EXTERN_C()
/* result of compilation may be stored in file cache */
#define ZEND_COMPILE_WITH_FILE_CACHE (1<<11)
+/* disable jumptable optimization for switch statements */
+#define ZEND_COMPILE_NO_JUMPTABLES (1<<12)
+
/* The default value for CG(compiler_options) */
#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY