From 6d97e7f0e93377ecfe48dc5302b2990ddc429ad3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 27 Jul 2020 15:01:29 +0200 Subject: [PATCH] JIT internal functions with return type in debug mode The return type check is just a debug assertion, it's okay if it is not performed in JIT mode. We already don't perform all the argument validation in that case. Just disable the one test that checks for this. This removes an annoying discrepancy between debug&release mode. --- .../return_types/internal_functions001.phpt | 2 ++ ext/opcache/jit/zend_jit_x86.dasc | 22 ------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/Zend/tests/return_types/internal_functions001.phpt b/Zend/tests/return_types/internal_functions001.phpt index ebed8515e5..153e32ca6e 100644 --- a/Zend/tests/return_types/internal_functions001.phpt +++ b/Zend/tests/return_types/internal_functions001.phpt @@ -6,6 +6,8 @@ if (!extension_loaded('zend-test')) die('skip zend-test extension not loaded'); // Internal function return types are only checked in debug builds if (!PHP_DEBUG) die('skip requires debug build'); ?> +--INI-- +opcache.jit=0 --FILE-- type == ZEND_INTERNAL_FUNCTION) { ZEND_ASSERT(opline->opcode != ZEND_DO_UCALL); call_num_args = call_info->num_args; -#if ZEND_DEBUG - if (func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { - // TODO: Now most internal functions have type hints ??? - if (!trace) { - goto fallback; - } - } -#endif } else { ZEND_UNREACHABLE(); } @@ -9112,20 +9104,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend } return 1; -#if ZEND_DEBUG -fallback: - /* fallback to subroutine threading */ - if (trace) { - return zend_jit_trace_handler(Dst, op_array, opline, /* may_throw */ 1, trace); - } - if (opline->opcode == ZEND_DO_FCALL || - opline->opcode == ZEND_DO_UCALL || - opline->opcode == ZEND_DO_FCALL_BY_NAME ){ - return zend_jit_call(Dst, opline, next_block); - } else { - return zend_jit_handler(Dst, opline, /* may_throw */ 1); - } -#endif } static int zend_jit_send_val(dasm_State **Dst, const zend_op *opline, const zend_op_array *op_array, uint32_t op1_info, zend_jit_addr op1_addr) -- 2.40.0