From: Nikita Popov Date: Tue, 7 Jul 2020 13:22:46 +0000 (+0200) Subject: Check for undef variable exception in SEND_VAR JIT X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e6ec974fb4d74ae4514468a8e1d527297bd6ce1;p=php Check for undef variable exception in SEND_VAR JIT Add a return value to zend_jit_undefined_op_helper(), so we can check for exception based on the return value, instead of fetching EG(exception). --- diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index c0fa257ed9..c3e7673448 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -278,12 +278,13 @@ static zval* ZEND_FASTCALL zend_jit_symtable_lookup_w(HashTable *ht, zend_string return retval; } -static void ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var) +static int ZEND_FASTCALL zend_jit_undefined_op_helper(uint32_t var) { const zend_execute_data *execute_data = EG(current_execute_data); zend_string *cv = EX(func)->op_array.vars[EX_VAR_TO_NUM(var)]; zend_error(E_WARNING, "Undefined variable $%s", ZSTR_VAL(cv)); + return EG(exception) == NULL; } static void ZEND_FASTCALL zend_jit_fetch_dim_r_helper(zend_array *ht, zval *dim, zval *result) diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index b9066f465d..2829cbd7ac 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -9235,6 +9235,8 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend | mov FCARG1d, opline->op1.var | EXT_CALL zend_jit_undefined_op_helper, r0 | SET_ZVAL_TYPE_INFO arg_addr, IS_NULL + | test r0, r0 + | jz ->exception_handler if (op1_info & (MAY_BE_ANY|MAY_BE_REF)) { | jmp >7