Skip to content

Commit e0f97ae

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 19a9a6b + 526344a commit e0f97ae

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
@@ -4956,6 +4956,10 @@ static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) {
49564956
}
49574957

49584958
static zend_bool should_use_jumptable(zend_ast_list *cases, zend_uchar jumptable_type) {
4959+
if (CG(compiler_options) & ZEND_COMPILE_NO_JUMPTABLES) {
4960+
return 0;
4961+
}
4962+
49594963
/* Thresholds are chosen based on when the average switch time for equidistributed
49604964
* input becomes smaller when using the jumptable optimization. */
49614965
if (jumptable_type == IS_LONG) {

Zend/zend_compile.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,9 @@ END_EXTERN_C()
10481048
/* result of compilation may be stored in file cache */
10491049
#define ZEND_COMPILE_WITH_FILE_CACHE (1<<11)
10501050

1051+
/* disable jumptable optimization for switch statements */
1052+
#define ZEND_COMPILE_NO_JUMPTABLES (1<<12)
1053+
10511054
/* The default value for CG(compiler_options) */
10521055
#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY
10531056

0 commit comments

Comments
 (0)