Skip to content

Commit e874811

Browse files
committed
Build call graph before type inference
1 parent b418f33 commit e874811

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2924,6 +2924,7 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
29242924
{
29252925
zend_ssa ssa;
29262926
void *checkpoint;
2927+
zend_func_info *func_info;
29272928

29282929
if (*dasm_ptr == dasm_end) {
29292930
return FAILURE;
@@ -2938,6 +2939,18 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
29382939
goto jit_failure;
29392940
}
29402941

2942+
if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNCS) {
2943+
if (zend_jit_collect_calls(op_array, script) != SUCCESS) {
2944+
ZEND_SET_FUNC_INFO(op_array, NULL);
2945+
goto jit_failure;
2946+
}
2947+
func_info = ZEND_FUNC_INFO(op_array);
2948+
func_info->call_map = zend_build_call_map(&CG(arena), func_info, op_array);
2949+
if (op_array->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
2950+
zend_init_func_return_info(op_array, script, &func_info->return_info);
2951+
}
2952+
}
2953+
29412954
if (zend_jit_op_array_analyze2(op_array, script, &ssa) != SUCCESS) {
29422955
goto jit_failure;
29432956
}
@@ -2946,13 +2959,6 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
29462959
zend_dump_op_array(op_array, ZEND_DUMP_HIDE_UNREACHABLE|ZEND_DUMP_RC_INFERENCE|ZEND_DUMP_SSA, "JIT", &ssa);
29472960
}
29482961

2949-
if (zend_jit_level >= ZEND_JIT_LEVEL_OPT_FUNCS) {
2950-
if (zend_jit_collect_calls(op_array, script) != SUCCESS) {
2951-
ZEND_SET_FUNC_INFO(op_array, NULL);
2952-
goto jit_failure;
2953-
}
2954-
}
2955-
29562962
if (zend_jit(op_array, &ssa, rt_opline) != SUCCESS) {
29572963
goto jit_failure;
29582964
}

0 commit comments

Comments
 (0)