@@ -2805,26 +2805,29 @@ static void zend_jit_cleanup_func_info(zend_op_array *op_array)
2805
2805
}
2806
2806
}
2807
2807
2808
- static int zend_real_jit_func (zend_op_array * op_array , zend_script * script , const zend_op * rt_opline )
2808
+ static int zend_real_jit_func (zend_op_array * op_array , zend_script * script , const zend_op * rt_opline , uint8_t trigger )
2809
2809
{
2810
2810
zend_ssa ssa ;
2811
2811
void * checkpoint ;
2812
2812
zend_func_info * func_info ;
2813
+ uint8_t orig_trigger ;
2813
2814
2814
2815
if (* dasm_ptr == dasm_end ) {
2815
2816
return FAILURE ;
2816
2817
}
2817
2818
2819
+ orig_trigger = JIT_G (trigger );
2820
+ JIT_G (trigger ) = trigger ;
2818
2821
checkpoint = zend_arena_checkpoint (CG (arena ));
2819
2822
2820
2823
/* Build SSA */
2821
2824
memset (& ssa , 0 , sizeof (zend_ssa ));
2822
2825
2823
2826
if (op_array -> fn_flags & ZEND_ACC_CLOSURE ) {
2824
- if (JIT_G ( trigger ) == ZEND_JIT_ON_FIRST_EXEC ) {
2827
+ if (trigger == ZEND_JIT_ON_FIRST_EXEC ) {
2825
2828
zend_jit_op_array_extension * jit_extension = (zend_jit_op_array_extension * )ZEND_FUNC_INFO (op_array );
2826
2829
op_array = (zend_op_array * ) jit_extension -> op_array ;
2827
- } else if (JIT_G ( trigger ) == ZEND_JIT_ON_HOT_COUNTERS ) {
2830
+ } else if (trigger == ZEND_JIT_ON_HOT_COUNTERS ) {
2828
2831
zend_jit_op_array_hot_extension * jit_extension = (zend_jit_op_array_hot_extension * )ZEND_FUNC_INFO (op_array );
2829
2832
op_array = (zend_op_array * ) jit_extension -> op_array ;
2830
2833
} else {
@@ -2859,11 +2862,13 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
2859
2862
2860
2863
zend_jit_cleanup_func_info (op_array );
2861
2864
zend_arena_release (& CG (arena ), checkpoint );
2865
+ JIT_G (trigger ) = orig_trigger ;
2862
2866
return SUCCESS ;
2863
2867
2864
2868
jit_failure :
2865
2869
zend_jit_cleanup_func_info (op_array );
2866
2870
zend_arena_release (& CG (arena ), checkpoint );
2871
+ JIT_G (trigger ) = orig_trigger ;
2867
2872
return FAILURE ;
2868
2873
}
2869
2874
@@ -2894,7 +2899,7 @@ static int ZEND_FASTCALL zend_runtime_jit(void)
2894
2899
opline -> handler = jit_extension -> orig_handler ;
2895
2900
2896
2901
/* perform real JIT for this function */
2897
- zend_real_jit_func (op_array , NULL , NULL );
2902
+ zend_real_jit_func (op_array , NULL , NULL , ZEND_JIT_ON_FIRST_EXEC );
2898
2903
} zend_catch {
2899
2904
do_bailout = true;
2900
2905
} zend_end_try ();
@@ -2940,7 +2945,7 @@ void zend_jit_check_funcs(HashTable *function_table, bool is_method) {
2940
2945
jit_extension = (zend_jit_op_array_extension * )ZEND_FUNC_INFO (op_array );
2941
2946
opline -> handler = jit_extension -> orig_handler ;
2942
2947
if (((double )counter / (double )zend_jit_profile_counter ) > JIT_G (prof_threshold )) {
2943
- zend_real_jit_func (op_array , NULL , NULL );
2948
+ zend_real_jit_func (op_array , NULL , NULL , ZEND_JIT_ON_PROF_REQUEST );
2944
2949
}
2945
2950
}
2946
2951
} ZEND_HASH_FOREACH_END ();
@@ -2966,7 +2971,7 @@ void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend
2966
2971
}
2967
2972
2968
2973
/* perform real JIT for this function */
2969
- zend_real_jit_func (op_array , NULL , opline );
2974
+ zend_real_jit_func (op_array , NULL , opline , ZEND_JIT_ON_HOT_COUNTERS );
2970
2975
} zend_catch {
2971
2976
do_bailout = 1 ;
2972
2977
} zend_end_try ();
@@ -3137,7 +3142,7 @@ int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
3137
3142
} else if (JIT_G (trigger ) == ZEND_JIT_ON_HOT_TRACE ) {
3138
3143
return zend_jit_setup_hot_trace_counters (op_array );
3139
3144
} else if (JIT_G (trigger ) == ZEND_JIT_ON_SCRIPT_LOAD ) {
3140
- return zend_real_jit_func (op_array , script , NULL );
3145
+ return zend_real_jit_func (op_array , script , NULL , ZEND_JIT_ON_SCRIPT_LOAD );
3141
3146
} else {
3142
3147
ZEND_UNREACHABLE ();
3143
3148
}
0 commit comments