Skip to content

Instantly share code, notes, and snippets.

@dstogov
Created September 8, 2021 14:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dstogov/6c2f6719151dd63b7f692544bafb737f 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 7941b396f5..8e81627007 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -4831,7 +4831,11 @@ static int zend_jit_math_helper(dasm_State **Dst,
| FREE_OP op1_type, op1, op1_info, 0, opline
| FREE_OP op2_type, op2, op2_info, 0, opline
if (may_throw) {
- zend_jit_check_exception(Dst);
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL && Z_REG(res_addr) == ZREG_RX) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ } else {
+ zend_jit_check_exception(Dst);
+ }
}
if (Z_MODE(res_addr) == IS_REG) {
zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
@@ -5167,7 +5171,11 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
| FREE_OP op1_type, op1, op1_info, 0, opline
| FREE_OP op2_type, op2, op2_info, 0, opline
if (may_throw) {
- zend_jit_check_exception(Dst);
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL && Z_REG(res_addr) == ZREG_RX) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ } else {
+ zend_jit_check_exception(Dst);
+ }
}
if (Z_MODE(res_addr) == IS_REG) {
zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var);
@@ -5281,7 +5289,11 @@ static int zend_jit_concat_helper(dasm_State **Dst,
| FREE_OP op1_type, op1, op1_info, 0, opline
| FREE_OP op2_type, op2, op2_info, 0, opline
if (may_throw) {
- zend_jit_check_exception(Dst);
+ if (Z_MODE(res_addr) == IS_MEM_ZVAL && Z_REG(res_addr) == ZREG_RX) {
+ zend_jit_check_exception_undef_result(Dst, opline);
+ } else {
+ zend_jit_check_exception(Dst);
+ }
}
#if 1
if ((op1_info & MAY_BE_STRING) && (op2_info & MAY_BE_STRING)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment