From 3e6919cfb3e62c819edc24e52221e560aae6e35f Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 23 Sep 2021 23:38:03 +0300 Subject: [PATCH] Tracing JIT: Fixed possible incorrect megamorphic call from a trait --- ext/opcache/jit/zend_jit_x86.dasc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 98670b26c0c..9ad7b62758a 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -9854,6 +9854,12 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend if (call_info && call_info->callee_func) { func = call_info->callee_func; } + if ((op_array->fn_flags & ZEND_ACC_TRAIT_CLONE) + && JIT_G(current_frame) + && JIT_G(current_frame)->call + && !JIT_G(current_frame)->call->func) { + call_info = NULL; func = NULL; /* megamorphic call from trait */ + } } if (!func) { /* resolve function at run time */