diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-24 10:56:04 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-01-24 10:56:04 +0100 |
commit | 526344aa5ee3190b754e3678e0c71b0d7f272876 (patch) | |
tree | bc7c7c55b421a5b83ffb036643f0fea751612f04 /Zend/zend_compile.c | |
parent | 66d72377d0226521fef6601683054446565bbdc0 (diff) | |
download | php-git-526344aa5ee3190b754e3678e0c71b0d7f272876.tar.gz |
Add flag to disable jumptable optimization
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.
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index d91b656182..28336130cc 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4907,6 +4907,10 @@ static zend_uchar determine_switch_jumptable_type(zend_ast_list *cases) { } 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) { |