Skip to content

Commit 1d984cc

Browse files
committed
Merge branch 'PHP-7.3'
2 parents 04723f2 + e0f97ae commit 1d984cc

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Zend/zend_compile.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4732,6 +4732,10 @@ static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) {
47324732
}
47334733

47344734
static zend_bool should_use_jumptable(zend_ast_list *cases, zend_uchar jumptable_type) {
4735+
if (CG(compiler_options) & ZEND_COMPILE_NO_JUMPTABLES) {
4736+
return 0;
4737+
}
4738+
47354739
/* Thresholds are chosen based on when the average switch time for equidistributed
47364740
* input becomes smaller when using the jumptable optimization. */
47374741
if (jumptable_type == IS_LONG) {

Zend/zend_compile.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,9 @@ END_EXTERN_C()
10621062
/* this flag is set when compiler invoked during preloading */
10631063
#define ZEND_COMPILE_PRELOAD (1<<14)
10641064

1065+
/* disable jumptable optimization for switch statements */
1066+
#define ZEND_COMPILE_NO_JUMPTABLES (1<<15)
1067+
10651068
/* The default value for CG(compiler_options) */
10661069
#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY
10671070

0 commit comments

Comments
 (0)