Skip to content

Instantly share code, notes, and snippets.

@dstogov
Created September 17, 2021 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dstogov/85287ebfa418754d03c5c0ed7d62ae30 to your computer and use it in GitHub Desktop.
Save dstogov/85287ebfa418754d03c5c0ed7d62ae30 to your computer and use it in GitHub Desktop.
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 175e063639..0447858e48 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -6018,6 +6018,27 @@ static int zend_jit_assign_to_variable_call(dasm_State **Dst,
zend_jit_addr __res_addr,
bool __check_exception)
{
+ if (val_info & MAY_BE_UNDEF) {
+ if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
+ int32_t exit_point = zend_jit_trace_get_exit_point(opline, ZEND_JIT_EXIT_TO_VM);
+ const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);
+
+ if (!exit_addr) {
+ return 0;
+ }
+
+ | IF_ZVAL_TYPE val_addr, IS_UNDEF, &exit_addr
+ } else {
+ | IF_ZVAL_TYPE val_addr, IS_UNDEF, >1
+ |.cold_code
+ |1:
+ | mov FCARG1d, Z_OFFSET(val_addr)
+ | EXT_CALL zend_jit_undefined_op_helper, r0
+ | jmp >1
+ |.code
+ |1:
+ }
+ }
if (Z_MODE(var_addr) != IS_MEM_ZVAL || Z_REG(var_addr) != ZREG_FCARG1 || Z_OFFSET(var_addr) != 0) {
| LOAD_ZVAL_ADDR FCARG1a, var_addr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment