From d4a206b27679779b698c4cbc9f6b17e082203073 Mon Sep 17 00:00:00 2001 From: twosee Date: Fri, 16 Apr 2021 18:24:58 +0800 Subject: [PATCH] Backport "ignore some opcodes in the JIT check" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a backport of fc64a7bef4c53f1948ced1043debd2024fd20f6f to the PHP-8.0 branch so that extensions don’t have to bypass the JIT check in a hacky way. --- ext/opcache/jit/zend_jit.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 7513abbf9bc..e6eed0f83b7 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -4228,11 +4228,19 @@ ZEND_EXT_API int zend_jit_check_support(void) } for (i = 0; i <= 256; i++) { - if (zend_get_user_opcode_handler(i) != NULL) { - zend_error(E_WARNING, "JIT is incompatible with third party extensions that setup user opcode handlers. JIT disabled."); - JIT_G(enabled) = 0; - JIT_G(on) = 0; - return FAILURE; + switch (i) { + /* JIT has no effect on these opcodes */ + case ZEND_BEGIN_SILENCE: + case ZEND_END_SILENCE: + case ZEND_EXIT: + break; + default: + if (zend_get_user_opcode_handler(i) != NULL) { + zend_error(E_WARNING, "JIT is incompatible with third party extensions that setup user opcode handlers. JIT disabled."); + JIT_G(enabled) = 0; + JIT_G(on) = 0; + return FAILURE; + } } }