]> granicus.if.org Git - php/commitdiff
Fixed tracing JIT exception handling
authorDmitry Stogov <dmitry@zend.com>
Mon, 20 Jul 2020 22:49:01 +0000 (01:49 +0300)
committerDmitry Stogov <dmitry@zend.com>
Mon, 20 Jul 2020 22:49:01 +0000 (01:49 +0300)
ext/opcache/jit/zend_jit_x86.dasc

index b5c58ce6b7754d3d8535bbfc055935a516f9f01a..4a8d5ba3b0f402410d9f47cb10e7e28af115c8e4 100644 (file)
@@ -1691,13 +1691,25 @@ static int zend_jit_exception_handler_stub(dasm_State **Dst)
 
                if (GCC_GLOBAL_REGS) {
                        |       add r4, SPAD // stack alignment
+                       |       EXT_JMP handler, r0
+               } else if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
+                       |       mov FCARG1a, FP
+                       |       EXT_CALL handler, r0
+                       |       mov FP, aword T2 // restore FP
+                       |       mov RX, aword T3 // restore IP
+                       |       add r4, NR_SPAD // stack alignment
+                       |       test eax, eax
+                       |       jl >1
+                       |       mov r0, 1 // ZEND_VM_ENTER
+                       |1:
+                       |       ret
                } else {
                        |       mov FCARG1a, FP
                        |       mov FP, aword T2 // restore FP
                        |       mov RX, aword T3 // restore IP
                        |       add r4, NR_SPAD // stack alignment
+                       |       EXT_JMP handler, r0
                }
-               |       EXT_JMP handler, r0
        }
 
        return 1;
@@ -2487,6 +2499,8 @@ static int zend_jit_trace_exit_stub(dasm_State **Dst)
                |       mov r0, aword [r0 + offsetof(zend_op_array, reserved[zend_func_info_rid])]
                |       mov r0, aword [r0 + offsetof(zend_jit_op_array_trace_extension, offset)]
                |       call aword [IP + r0]
+               |       test eax, eax
+               |       jl ->trace_halt
                |       mov FP, aword T2 // restore FP
                |       mov RX, aword T3 // restore IP
                |       add r4, NR_SPAD // stack alignment