@@ -2443,7 +2443,7 @@ static void zend_jit_trace_setup_ret_counter(const zend_op *opline, size_t offse
2443
2443
{
2444
2444
zend_op * next_opline = (zend_op * )(opline + 1 );
2445
2445
2446
- if (!ZEND_OP_TRACE_INFO (next_opline , offset )-> trace_flags ) {
2446
+ if (JIT_G ( hot_return ) && !ZEND_OP_TRACE_INFO (next_opline , offset )-> trace_flags ) {
2447
2447
if (!ZEND_OP_TRACE_INFO (next_opline , offset )-> counter ) {
2448
2448
ZEND_OP_TRACE_INFO (next_opline , offset )-> counter =
2449
2449
& zend_jit_hot_counters [ZEND_JIT_COUNTER_NUM ];
@@ -5056,7 +5056,7 @@ int ZEND_FASTCALL zend_jit_trace_exit(uint32_t exit_num, zend_jit_registers_buf
5056
5056
}
5057
5057
return 0 ;
5058
5058
}
5059
- } else if (zend_jit_trace_exit_is_hot (trace_num , exit_num )) {
5059
+ } else if (JIT_G ( hot_side_exit ) && zend_jit_trace_exit_is_hot (trace_num , exit_num )) {
5060
5060
return zend_jit_trace_hot_side (execute_data , trace_num , exit_num );
5061
5061
}
5062
5062
@@ -5086,18 +5086,13 @@ static int zend_jit_setup_hot_trace_counters(zend_op_array *op_array)
5086
5086
{
5087
5087
zend_op * opline ;
5088
5088
zend_jit_op_array_trace_extension * jit_extension ;
5089
- zend_cfg cfg ;
5090
5089
uint32_t i ;
5091
5090
5092
5091
ZEND_ASSERT (zend_jit_func_trace_counter_handler != NULL );
5093
5092
ZEND_ASSERT (zend_jit_ret_trace_counter_handler != NULL );
5094
5093
ZEND_ASSERT (zend_jit_loop_trace_counter_handler != NULL );
5095
5094
ZEND_ASSERT (sizeof (zend_op_trace_info ) == sizeof (zend_op ));
5096
5095
5097
- if (zend_jit_build_cfg (op_array , & cfg ) != SUCCESS ) {
5098
- return FAILURE ;
5099
- }
5100
-
5101
5096
jit_extension = (zend_jit_op_array_trace_extension * )zend_shared_alloc (sizeof (zend_jit_op_array_trace_extension ) + (op_array -> last - 1 ) * sizeof (zend_op_trace_info ));
5102
5097
memset (& jit_extension -> func_info , 0 , sizeof (zend_func_info ));
5103
5098
jit_extension -> func_info .num_args = -1 ;
@@ -5112,42 +5107,52 @@ static int zend_jit_setup_hot_trace_counters(zend_op_array *op_array)
5112
5107
}
5113
5108
ZEND_SET_FUNC_INFO (op_array , (void * )jit_extension );
5114
5109
5115
- opline = op_array -> opcodes ;
5116
- if (!(op_array -> fn_flags & ZEND_ACC_HAS_TYPE_HINTS )) {
5117
- while (opline -> opcode == ZEND_RECV || opline -> opcode == ZEND_RECV_INIT ) {
5118
- opline ++ ;
5119
- }
5120
- }
5110
+ if (JIT_G (hot_loop )) {
5111
+ zend_cfg cfg ;
5121
5112
5122
- if (!(ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> trace_flags & ZEND_JIT_TRACE_UNSUPPORTED )) {
5123
- /* function entry */
5124
- opline -> handler = (const void * )zend_jit_func_trace_counter_handler ;
5125
- ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> counter =
5126
- & zend_jit_hot_counters [ZEND_JIT_COUNTER_NUM ];
5127
- ZEND_JIT_COUNTER_NUM = (ZEND_JIT_COUNTER_NUM + 1 ) % ZEND_HOT_COUNTERS_COUNT ;
5128
- ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> trace_flags |=
5129
- ZEND_JIT_TRACE_START_ENTER ;
5130
- }
5113
+ if (zend_jit_build_cfg (op_array , & cfg ) != SUCCESS ) {
5114
+ return FAILURE ;
5115
+ }
5131
5116
5132
- for (i = 0 ; i < cfg .blocks_count ; i ++ ) {
5133
- if (cfg .blocks [i ].flags & ZEND_BB_REACHABLE ) {
5134
- if (cfg .blocks [i ].flags & ZEND_BB_LOOP_HEADER ) {
5135
- /* loop header */
5136
- opline = op_array -> opcodes + cfg .blocks [i ].start ;
5137
- if (!(ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> trace_flags & ZEND_JIT_TRACE_UNSUPPORTED )) {
5138
- opline -> handler = (const void * )zend_jit_loop_trace_counter_handler ;
5139
- if (!ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> counter ) {
5140
- ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> counter =
5141
- & zend_jit_hot_counters [ZEND_JIT_COUNTER_NUM ];
5142
- ZEND_JIT_COUNTER_NUM = (ZEND_JIT_COUNTER_NUM + 1 ) % ZEND_HOT_COUNTERS_COUNT ;
5117
+ for (i = 0 ; i < cfg .blocks_count ; i ++ ) {
5118
+ if (cfg .blocks [i ].flags & ZEND_BB_REACHABLE ) {
5119
+ if (cfg .blocks [i ].flags & ZEND_BB_LOOP_HEADER ) {
5120
+ /* loop header */
5121
+ opline = op_array -> opcodes + cfg .blocks [i ].start ;
5122
+ if (!(ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> trace_flags & ZEND_JIT_TRACE_UNSUPPORTED )) {
5123
+ opline -> handler = (const void * )zend_jit_loop_trace_counter_handler ;
5124
+ if (!ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> counter ) {
5125
+ ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> counter =
5126
+ & zend_jit_hot_counters [ZEND_JIT_COUNTER_NUM ];
5127
+ ZEND_JIT_COUNTER_NUM = (ZEND_JIT_COUNTER_NUM + 1 ) % ZEND_HOT_COUNTERS_COUNT ;
5128
+ }
5129
+ ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> trace_flags |=
5130
+ ZEND_JIT_TRACE_START_LOOP ;
5143
5131
}
5144
- ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> trace_flags |=
5145
- ZEND_JIT_TRACE_START_LOOP ;
5146
5132
}
5147
5133
}
5148
5134
}
5149
5135
}
5150
5136
5137
+ if (JIT_G (hot_func )) {
5138
+ opline = op_array -> opcodes ;
5139
+ if (!(op_array -> fn_flags & ZEND_ACC_HAS_TYPE_HINTS )) {
5140
+ while (opline -> opcode == ZEND_RECV || opline -> opcode == ZEND_RECV_INIT ) {
5141
+ opline ++ ;
5142
+ }
5143
+ }
5144
+
5145
+ if (!ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> trace_flags ) {
5146
+ /* function entry */
5147
+ opline -> handler = (const void * )zend_jit_func_trace_counter_handler ;
5148
+ ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> counter =
5149
+ & zend_jit_hot_counters [ZEND_JIT_COUNTER_NUM ];
5150
+ ZEND_JIT_COUNTER_NUM = (ZEND_JIT_COUNTER_NUM + 1 ) % ZEND_HOT_COUNTERS_COUNT ;
5151
+ ZEND_OP_TRACE_INFO (opline , jit_extension -> offset )-> trace_flags |=
5152
+ ZEND_JIT_TRACE_START_ENTER ;
5153
+ }
5154
+ }
5155
+
5151
5156
return SUCCESS ;
5152
5157
}
5153
5158
0 commit comments