Skip to content

Commit 72d1c50

Browse files
committed
Use cheaper zend_rethrow_exception() instead of zend_throw_exception_internal()
1 parent 3f6a212 commit 72d1c50

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,7 +1732,7 @@ static int zend_jit_leave_throw_stub(dasm_State **Dst)
17321732
{
17331733
|->leave_throw_handler:
17341734
| // if (opline->opcode != ZEND_HANDLE_EXCEPTION) {
1735-
if (GCC_GLOBAL_REGS) {
1735+
if (GCC_GLOBAL_REGS) {
17361736
| cmp byte OP:IP->opcode, ZEND_HANDLE_EXCEPTION
17371737
| je >5
17381738
| // EG(opline_before_exception) = opline;
@@ -1764,16 +1764,19 @@ static int zend_jit_leave_throw_stub(dasm_State **Dst)
17641764
static int zend_jit_icall_throw_stub(dasm_State **Dst)
17651765
{
17661766
|->icall_throw_handler:
1767-
| // zend_throw_exception_internal(NULL);
1768-
|.if X64
1769-
| xor CARG1, CARG1
1770-
| EXT_CALL zend_throw_exception_internal, r0
1771-
|.else
1772-
| sub r4, 12
1773-
| push 0
1774-
| EXT_CALL zend_throw_exception_internal, r0
1775-
| add r4, 16
1776-
|.endif
1767+
| // zend_rethrow_exception(zend_execute_data *execute_data)
1768+
| mov IP, aword EX->opline
1769+
| // if (EX(opline)->opcode != ZEND_HANDLE_EXCEPTION) {
1770+
| cmp byte OP:IP->opcode, ZEND_HANDLE_EXCEPTION
1771+
| je >1
1772+
| // EG(opline_before_exception) = opline;
1773+
| MEM_OP2_1_ZTS mov, aword, executor_globals, opline_before_exception, IP, r0
1774+
|1:
1775+
| // opline = EG(exception_op);
1776+
| LOAD_IP_ADDR_ZTS executor_globals, exception_op
1777+
|| if (GCC_GLOBAL_REGS) {
1778+
| mov aword EX->opline, IP
1779+
|| }
17771780
| // HANDLE_EXCEPTION()
17781781
| jmp ->exception_handler
17791782

0 commit comments

Comments
 (0)