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

JIT: Update run_time_cache slot in zend_jit_find_func helper

This commit is contained in:
Dmitry Stogov
2021-09-07 13:13:47 +03:00
parent c8f858ef49
commit d4ed6b635f
3 changed files with 10 additions and 10 deletions

View File

@@ -8464,21 +8464,19 @@ static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t
if (opline->opcode == ZEND_INIT_FCALL) {
| LOAD_ADDR FCARG1x, Z_STR_P(zv);
| add FCARG2x, REG2, #opline->result.num
| EXT_CALL zend_jit_find_func_helper, REG0
} else if (opline->opcode == ZEND_INIT_FCALL_BY_NAME) {
| LOAD_ADDR FCARG1x, Z_STR_P(zv + 1);
| add FCARG2x, REG2, #opline->result.num
| EXT_CALL zend_jit_find_func_helper, REG0
} else if (opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME) {
| LOAD_ADDR FCARG1x, zv;
| add FCARG2x, REG2, #opline->result.num
| EXT_CALL zend_jit_find_ns_func_helper, REG0
} else {
ZEND_UNREACHABLE();
}
| // CACHE_PTR(opline->result.num, fbc);
| ldr REG1, EX->run_time_cache
| // Get the return value of function zend_jit_find_func_helper/zend_jit_find_ns_func_helper
| mov REG0, RETVALx
| str REG0, [REG1, #opline->result.num]
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
int32_t exit_point = zend_jit_trace_get_exit_point(opline, 0);
const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);

View File

@@ -61,7 +61,7 @@ static zend_never_inline zend_op_array* ZEND_FASTCALL zend_jit_init_func_run_tim
}
/* }}} */
static zend_function* ZEND_FASTCALL zend_jit_find_func_helper(zend_string *name)
static zend_function* ZEND_FASTCALL zend_jit_find_func_helper(zend_string *name, void **cache_slot)
{
zval *func = zend_hash_find_known_hash(EG(function_table), name);
zend_function *fbc;
@@ -73,10 +73,11 @@ static zend_function* ZEND_FASTCALL zend_jit_find_func_helper(zend_string *name)
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
fbc = _zend_jit_init_func_run_time_cache(&fbc->op_array);
}
*cache_slot = fbc;
return fbc;
}
static zend_function* ZEND_FASTCALL zend_jit_find_ns_func_helper(zval *func_name)
static zend_function* ZEND_FASTCALL zend_jit_find_ns_func_helper(zval *func_name, void **cache_slot)
{
zval *func = zend_hash_find_known_hash(EG(function_table), Z_STR_P(func_name + 1));
zend_function *fbc;
@@ -91,6 +92,7 @@ static zend_function* ZEND_FASTCALL zend_jit_find_ns_func_helper(zval *func_name
if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
fbc = _zend_jit_init_func_run_time_cache(&fbc->op_array);
}
*cache_slot = fbc;
return fbc;
}

View File

@@ -9030,19 +9030,19 @@ static int zend_jit_init_fcall(dasm_State **Dst, const zend_op *opline, uint32_t
if (opline->opcode == ZEND_INIT_FCALL) {
| LOAD_ADDR FCARG1a, Z_STR_P(zv);
| lea FCARG2a, aword [r2 + opline->result.num]
| EXT_CALL zend_jit_find_func_helper, r0
} else if (opline->opcode == ZEND_INIT_FCALL_BY_NAME) {
| LOAD_ADDR FCARG1a, Z_STR_P(zv + 1);
| lea FCARG2a, aword [r2 + opline->result.num]
| EXT_CALL zend_jit_find_func_helper, r0
} else if (opline->opcode == ZEND_INIT_NS_FCALL_BY_NAME) {
| LOAD_ADDR FCARG1a, zv;
| lea FCARG2a, aword [r2 + opline->result.num]
| EXT_CALL zend_jit_find_ns_func_helper, r0
} else {
ZEND_UNREACHABLE();
}
| // CACHE_PTR(opline->result.num, fbc);
| mov r1, EX->run_time_cache
| mov aword [r1 + opline->result.num], r0
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE) {
int32_t exit_point = zend_jit_trace_get_exit_point(opline, 0);
const void *exit_addr = zend_jit_trace_get_exit_addr(exit_point);