]> granicus.if.org Git - php/commitdiff
Check for undef variable exception in SEND_VAR JIT
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 7 Jul 2020 13:22:46 +0000 (15:22 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 7 Jul 2020 13:22:46 +0000 (15:22 +0200)
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).

ext/opcache/jit/zend_jit_helpers.c
ext/opcache/jit/zend_jit_x86.dasc

index c0fa257ed9c28f218f5df35e942821a7bf44e0fb..c3e767344835ab3abad84d2b0b42304e9a997d61 100644 (file)
@@ -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)
index b9066f465dfc93b254847ad30e1404e2aee90e51..2829cbd7acc6e2f0d9fb9985a8e99c2ca6e11bfa 100644 (file)
@@ -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