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 @@ -4732,6 +4732,10 @@ static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) {
4732
4732
}
4733
4733
4734
4734
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
+
4735
4739
/* Thresholds are chosen based on when the average switch time for equidistributed
4736
4740
* input becomes smaller when using the jumptable optimization. */
4737
4741
if (jumptable_type == IS_LONG ) {
Original file line number Diff line number Diff line change @@ -1062,6 +1062,9 @@ END_EXTERN_C()
1062
1062
/* this flag is set when compiler invoked during preloading */
1063
1063
#define ZEND_COMPILE_PRELOAD (1<<14)
1064
1064
1065
+ /* disable jumptable optimization for switch statements */
1066
+ #define ZEND_COMPILE_NO_JUMPTABLES (1<<15)
1067
+
1065
1068
/* The default value for CG(compiler_options) */
1066
1069
#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY
1067
1070
You can’t perform that action at this time.
0 commit comments