diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index feff36f0e38..c5243ffb391 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -5167,7 +5167,11 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o | GET_ZVAL_LVAL ZREG_FCARG2, op2_addr, TMP1 } | SET_EX_OPLINE opline, REG0 - | EXT_CALL zend_jit_hash_index_lookup_rw, REG0 + if (packed_loaded) { + | EXT_CALL zend_jit_hash_index_lookup_rw_no_packed, REG0 + } else { + | EXT_CALL zend_jit_hash_index_lookup_rw, REG0 + } | mov REG0, RETVALx if (not_found_exit_addr) { if (packed_loaded) { diff --git a/ext/opcache/jit/zend_jit_disasm.c b/ext/opcache/jit/zend_jit_disasm.c index c10df623e23..621bf1991b8 100644 --- a/ext/opcache/jit/zend_jit_disasm.c +++ b/ext/opcache/jit/zend_jit_disasm.c @@ -615,6 +615,7 @@ static int zend_jit_disasm_init(void) REGISTER_HELPER(zend_jit_leave_top_func_helper); REGISTER_HELPER(zend_jit_leave_func_helper); REGISTER_HELPER(zend_jit_symtable_find); + REGISTER_HELPER(zend_jit_hash_index_lookup_rw_no_packed); REGISTER_HELPER(zend_jit_hash_index_lookup_rw); REGISTER_HELPER(zend_jit_hash_lookup_rw); REGISTER_HELPER(zend_jit_symtable_lookup_rw); diff --git a/ext/opcache/jit/zend_jit_helpers.c b/ext/opcache/jit/zend_jit_helpers.c index 585364a5739..33c7b6c70a1 100644 --- a/ext/opcache/jit/zend_jit_helpers.c +++ b/ext/opcache/jit/zend_jit_helpers.c @@ -252,7 +252,7 @@ static zval* ZEND_FASTCALL zend_jit_symtable_find(HashTable *ht, zend_string *st return zend_hash_find(ht, str); } -static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_rw(HashTable *ht, zend_long idx) +static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_rw_no_packed(HashTable *ht, zend_long idx) { zval *retval = _zend_hash_index_find(ht, idx); @@ -262,6 +262,16 @@ static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_rw(HashTable *ht, zend_lon return retval; } +static zval* ZEND_FASTCALL zend_jit_hash_index_lookup_rw(HashTable *ht, zend_long idx) +{ + zval *retval = zend_hash_index_find(ht, idx); + + if (!retval) { + retval = zend_undefined_offset_write(ht, idx); + } + return retval; +} + static zval* ZEND_FASTCALL zend_jit_hash_lookup_rw(HashTable *ht, zend_string *str) { zval *retval = zend_hash_find_known_hash(ht, str); diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index d7108781eb9..b414b7b907e 100644 --- a/ext/opcache/jit/zend_jit_x86.dasc +++ b/ext/opcache/jit/zend_jit_x86.dasc @@ -5646,7 +5646,11 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o | GET_ZVAL_LVAL ZREG_FCARG2, op2_addr } | SET_EX_OPLINE opline, r0 - | EXT_CALL zend_jit_hash_index_lookup_rw, r0 + if (packed_loaded) { + | EXT_CALL zend_jit_hash_index_lookup_rw_no_packed, r0 + } else { + | EXT_CALL zend_jit_hash_index_lookup_rw, r0 + } | test r0, r0 if (not_found_exit_addr) { if (packed_loaded) {