From 48d050ef7223ea59da377b1b8e8eb75c434bc255 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 21 Sep 2021 14:30:56 +0300 Subject: [PATCH] JIT: Disable recursive call optimization for VM without global register variables A tail-call to VM handler from recursively called function may lead to pass control to incorrect stack frame. --- ext/opcache/jit/zend_jit_x86.dasc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 9c3e77a56a8..98670b26c0c 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -10082,7 +10082,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend } } - if (!trace && op_array == &func->op_array + if (GCC_GLOBAL_REGS && !trace && op_array == &func->op_array && num_args >= op_array->required_num_args) { /* recursive call */ if (ZEND_OBSERVER_ENABLED) {