1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 05:02:27 +02:00

Merge branch 'PHP-8.0'

* PHP-8.0:
  Added missing deoptimization code for trampoline handling
This commit is contained in:
Dmitry Stogov
2020-11-19 12:32:49 +03:00
4 changed files with 26 additions and 1 deletions

View File

@@ -494,6 +494,7 @@ static int zend_jit_disasm_init(void)
#if (PHP_VERSION_ID <= 80000) && (SIZEOF_SIZE_T == 4)
REGISTER_HELPER(zval_jit_update_constant_ex);
#endif
REGISTER_HELPER(zend_jit_free_trampoline_helper);
#undef REGISTER_HELPER
#ifndef _WIN32

View File

@@ -2666,4 +2666,11 @@ static zend_result ZEND_FASTCALL zval_jit_update_constant_ex(zval *p, zend_class
}
return SUCCESS;
}
#endif
#endif
static void ZEND_FASTCALL zend_jit_free_trampoline_helper(zend_function *func)
{
ZEND_ASSERT(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE);
zend_string_release_ex(func->common.function_name, 0);
zend_free_trampoline(func);
}

View File

@@ -3289,6 +3289,12 @@ static int zend_jit_trace_deoptimization(dasm_State **Dst,
}
}
if ((flags & ZEND_JIT_EXIT_METHOD_CALL) && !polymorphic_side_trace) {
if (!zend_jit_free_trampoline(Dst)) {
return 0;
}
}
return 1;
}

View File

@@ -3930,6 +3930,17 @@ static int zend_jit_store_const(dasm_State **Dst, int var, zend_reg reg)
return 1;
}
static int zend_jit_free_trampoline(dasm_State **Dst)
{
| /// if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))
| test dword [r0 + offsetof(zend_function, common.fn_flags)], ZEND_ACC_CALL_VIA_TRAMPOLINE
| jz >1
| mov FCARG1a, r0
| EXT_CALL zend_jit_free_trampoline_helper, r0
|1:
return 1;
}
static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, uint32_t op1_def_info, zend_jit_addr op1_def_addr, uint32_t res_use_info, uint32_t res_info, zend_jit_addr res_addr, int may_overflow, int may_throw)
{
if (op1_info & ((MAY_BE_UNDEF|MAY_BE_ANY)-MAY_BE_LONG)) {