This is useful for coverage. While it is currently safe to just
skip over the SWITCH_* opcodes, this may not be true in the future
due to opcache optimizations, so it's safer to disable emission of
SWITCH_* opcodes entirely.
}
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) {
/* disable builtin special case function calls */
#define ZEND_COMPILE_NO_BUILTINS (1<<10)
+/* disable jumptable optimization for switch statements */
+#define ZEND_COMPILE_NO_JUMPTABLES (1<<11)
+
/* The default value for CG(compiler_options) */
#define ZEND_COMPILE_DEFAULT ZEND_COMPILE_HANDLE_OP_ARRAY