File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -4956,6 +4956,10 @@ static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) {
4956
4956
}
4957
4957
4958
4958
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
+
4959
4963
/* Thresholds are chosen based on when the average switch time for equidistributed
4960
4964
* input becomes smaller when using the jumptable optimization. */
4961
4965
if (jumptable_type == IS_LONG ) {
Original file line number Diff line number Diff line change @@ -1048,6 +1048,9 @@ END_EXTERN_C()
1048
1048
/* result of compilation may be stored in file cache */
1049
1049
#define ZEND_COMPILE_WITH_FILE_CACHE (1<<11)
1050
1050
1051
+ /* disable jumptable optimization for switch statements */
1052
+ #define ZEND_COMPILE_NO_JUMPTABLES (1<<12)
1053
+
1051
1054
/* The default value for CG(compiler_options) */
1052
1055
#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY
1053
1056
You can’t perform that action at this time.
0 commit comments