@@ -2871,26 +2871,29 @@ static void zend_jit_cleanup_func_info(zend_op_array *op_array)
2871
2871
}
2872
2872
}
2873
2873
2874
- static int zend_real_jit_func (zend_op_array * op_array , zend_script * script , const zend_op * rt_opline )
2874
+ static int zend_real_jit_func (zend_op_array * op_array , zend_script * script , const zend_op * rt_opline , uint8_t trigger )
2875
2875
{
2876
2876
zend_ssa ssa ;
2877
2877
void * checkpoint ;
2878
2878
zend_func_info * func_info ;
2879
+ uint8_t orig_trigger ;
2879
2880
2880
2881
if (* dasm_ptr == dasm_end ) {
2881
2882
return FAILURE ;
2882
2883
}
2883
2884
2885
+ orig_trigger = JIT_G (trigger );
2886
+ JIT_G (trigger ) = trigger ;
2884
2887
checkpoint = zend_arena_checkpoint (CG (arena ));
2885
2888
2886
2889
/* Build SSA */
2887
2890
memset (& ssa , 0 , sizeof (zend_ssa ));
2888
2891
2889
2892
if (op_array -> fn_flags & ZEND_ACC_CLOSURE ) {
2890
- if (JIT_G ( trigger ) == ZEND_JIT_ON_FIRST_EXEC ) {
2893
+ if (trigger == ZEND_JIT_ON_FIRST_EXEC ) {
2891
2894
zend_jit_op_array_extension * jit_extension = (zend_jit_op_array_extension * )ZEND_FUNC_INFO (op_array );
2892
2895
op_array = (zend_op_array * ) jit_extension -> op_array ;
2893
- } else if (JIT_G ( trigger ) == ZEND_JIT_ON_HOT_COUNTERS ) {
2896
+ } else if (trigger == ZEND_JIT_ON_HOT_COUNTERS ) {
2894
2897
zend_jit_op_array_hot_extension * jit_extension = (zend_jit_op_array_hot_extension * )ZEND_FUNC_INFO (op_array );
2895
2898
op_array = (zend_op_array * ) jit_extension -> op_array ;
2896
2899
} else {
@@ -2925,11 +2928,13 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
2925
2928
2926
2929
zend_jit_cleanup_func_info (op_array );
2927
2930
zend_arena_release (& CG (arena ), checkpoint );
2931
+ JIT_G (trigger ) = orig_trigger ;
2928
2932
return SUCCESS ;
2929
2933
2930
2934
jit_failure :
2931
2935
zend_jit_cleanup_func_info (op_array );
2932
2936
zend_arena_release (& CG (arena ), checkpoint );
2937
+ JIT_G (trigger ) = orig_trigger ;
2933
2938
return FAILURE ;
2934
2939
}
2935
2940
@@ -2960,7 +2965,7 @@ static int ZEND_FASTCALL zend_runtime_jit(void)
2960
2965
opline -> handler = jit_extension -> orig_handler ;
2961
2966
2962
2967
/* perform real JIT for this function */
2963
- zend_real_jit_func (op_array , NULL , NULL );
2968
+ zend_real_jit_func (op_array , NULL , NULL , ZEND_JIT_ON_FIRST_EXEC );
2964
2969
} zend_catch {
2965
2970
do_bailout = true;
2966
2971
} zend_end_try ();
@@ -3006,7 +3011,7 @@ void zend_jit_check_funcs(HashTable *function_table, bool is_method) {
3006
3011
jit_extension = (zend_jit_op_array_extension * )ZEND_FUNC_INFO (op_array );
3007
3012
opline -> handler = jit_extension -> orig_handler ;
3008
3013
if (((double )counter / (double )zend_jit_profile_counter ) > JIT_G (prof_threshold )) {
3009
- zend_real_jit_func (op_array , NULL , NULL );
3014
+ zend_real_jit_func (op_array , NULL , NULL , ZEND_JIT_ON_PROF_REQUEST );
3010
3015
}
3011
3016
}
3012
3017
} ZEND_HASH_FOREACH_END ();
@@ -3032,7 +3037,7 @@ void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend
3032
3037
}
3033
3038
3034
3039
/* perform real JIT for this function */
3035
- zend_real_jit_func (op_array , NULL , opline );
3040
+ zend_real_jit_func (op_array , NULL , opline , ZEND_JIT_ON_HOT_COUNTERS );
3036
3041
} zend_catch {
3037
3042
do_bailout = 1 ;
3038
3043
} zend_end_try ();
@@ -3203,7 +3208,7 @@ int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
3203
3208
} else if (JIT_G (trigger ) == ZEND_JIT_ON_HOT_TRACE ) {
3204
3209
return zend_jit_setup_hot_trace_counters (op_array );
3205
3210
} else if (JIT_G (trigger ) == ZEND_JIT_ON_SCRIPT_LOAD ) {
3206
- return zend_real_jit_func (op_array , script , NULL );
3211
+ return zend_real_jit_func (op_array , script , NULL , ZEND_JIT_ON_SCRIPT_LOAD );
3207
3212
} else {
3208
3213
ZEND_UNREACHABLE ();
3209
3214
}
0 commit comments