@@ -4190,16 +4190,19 @@ static void zend_jit_cleanup_func_info(zend_op_array *op_array)
4190
4190
}
4191
4191
}
4192
4192
4193
- static int zend_real_jit_func (zend_op_array * op_array , zend_script * script , const zend_op * rt_opline )
4193
+ static int zend_real_jit_func (zend_op_array * op_array , zend_script * script , const zend_op * rt_opline , uint8_t trigger )
4194
4194
{
4195
4195
zend_ssa ssa ;
4196
4196
void * checkpoint ;
4197
4197
zend_func_info * func_info ;
4198
+ uint8_t orig_trigger ;
4198
4199
4199
4200
if (* dasm_ptr == dasm_end ) {
4200
4201
return FAILURE ;
4201
4202
}
4202
4203
4204
+ orig_trigger = JIT_G (trigger );
4205
+ JIT_G (trigger ) = trigger ;
4203
4206
checkpoint = zend_arena_checkpoint (CG (arena ));
4204
4207
4205
4208
/* Build SSA */
@@ -4232,11 +4235,13 @@ static int zend_real_jit_func(zend_op_array *op_array, zend_script *script, cons
4232
4235
4233
4236
zend_jit_cleanup_func_info (op_array );
4234
4237
zend_arena_release (& CG (arena ), checkpoint );
4238
+ JIT_G (trigger ) = orig_trigger ;
4235
4239
return SUCCESS ;
4236
4240
4237
4241
jit_failure :
4238
4242
zend_jit_cleanup_func_info (op_array );
4239
4243
zend_arena_release (& CG (arena ), checkpoint );
4244
+ JIT_G (trigger ) = orig_trigger ;
4240
4245
return FAILURE ;
4241
4246
}
4242
4247
@@ -4267,7 +4272,7 @@ static int ZEND_FASTCALL zend_runtime_jit(void)
4267
4272
opline -> handler = jit_extension -> orig_handler ;
4268
4273
4269
4274
/* perform real JIT for this function */
4270
- zend_real_jit_func (op_array , NULL , NULL );
4275
+ zend_real_jit_func (op_array , NULL , NULL , ZEND_JIT_ON_FIRST_EXEC );
4271
4276
} zend_catch {
4272
4277
do_bailout = true;
4273
4278
} zend_end_try ();
@@ -4313,7 +4318,7 @@ void zend_jit_check_funcs(HashTable *function_table, bool is_method) {
4313
4318
jit_extension = (zend_jit_op_array_extension * )ZEND_FUNC_INFO (op_array );
4314
4319
opline -> handler = jit_extension -> orig_handler ;
4315
4320
if (((double )counter / (double )zend_jit_profile_counter ) > JIT_G (prof_threshold )) {
4316
- zend_real_jit_func (op_array , NULL , NULL );
4321
+ zend_real_jit_func (op_array , NULL , NULL , ZEND_JIT_ON_PROF_REQUEST );
4317
4322
}
4318
4323
}
4319
4324
} ZEND_HASH_FOREACH_END ();
@@ -4339,7 +4344,7 @@ void ZEND_FASTCALL zend_jit_hot_func(zend_execute_data *execute_data, const zend
4339
4344
}
4340
4345
4341
4346
/* perform real JIT for this function */
4342
- zend_real_jit_func (op_array , NULL , opline );
4347
+ zend_real_jit_func (op_array , NULL , opline , ZEND_JIT_ON_HOT_COUNTERS );
4343
4348
} zend_catch {
4344
4349
do_bailout = 1 ;
4345
4350
} zend_end_try ();
@@ -4507,7 +4512,7 @@ ZEND_EXT_API int zend_jit_op_array(zend_op_array *op_array, zend_script *script)
4507
4512
} else if (JIT_G (trigger ) == ZEND_JIT_ON_HOT_TRACE ) {
4508
4513
return zend_jit_setup_hot_trace_counters (op_array );
4509
4514
} else if (JIT_G (trigger ) == ZEND_JIT_ON_SCRIPT_LOAD ) {
4510
- return zend_real_jit_func (op_array , script , NULL );
4515
+ return zend_real_jit_func (op_array , script , NULL , ZEND_JIT_ON_SCRIPT_LOAD );
4511
4516
} else {
4512
4517
ZEND_UNREACHABLE ();
4513
4518
}
0 commit comments