@@ -53,8 +53,6 @@ register const zend_op* volatile opline __asm__("x28");
53
53
54
54
ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_nested_func_helper (uint32_t call_info EXECUTE_DATA_DC )
55
55
{
56
- zend_execute_data * old_execute_data ;
57
-
58
56
if (UNEXPECTED (call_info & ZEND_CALL_HAS_SYMBOL_TABLE )) {
59
57
zend_clean_and_cache_symbol_table (EX (symbol_table ));
60
58
}
@@ -69,7 +67,7 @@ ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_leave_nested_func_helper(uint32_t
69
67
zend_free_extra_named_params (EX (extra_named_params ));
70
68
}
71
69
72
- old_execute_data = execute_data ;
70
+ zend_execute_data * const old_execute_data = execute_data ;
73
71
execute_data = EX (prev_execute_data );
74
72
zend_vm_stack_free_call_frame_ex (call_info , old_execute_data );
75
73
@@ -132,7 +130,6 @@ void ZEND_FASTCALL zend_jit_copy_extra_args_helper(EXECUTE_DATA_D)
132
130
if (EXPECTED (!(op_array -> fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE ))) {
133
131
uint32_t first_extra_arg = op_array -> num_args ;
134
132
uint32_t num_args = EX_NUM_ARGS ();
135
- zval * end , * src , * dst ;
136
133
uint32_t type_flags = 0 ;
137
134
138
135
if (EXPECTED ((op_array -> fn_flags & ZEND_ACC_HAS_TYPE_HINTS ) == 0 )) {
@@ -145,9 +142,9 @@ void ZEND_FASTCALL zend_jit_copy_extra_args_helper(EXECUTE_DATA_D)
145
142
}
146
143
147
144
/* move extra args into separate array after all CV and TMP vars */
148
- end = EX_VAR_NUM (first_extra_arg - 1 );
149
- src = end + (num_args - first_extra_arg );
150
- dst = src + (op_array -> last_var + op_array -> T - first_extra_arg );
145
+ zval * const end = EX_VAR_NUM (first_extra_arg - 1 );
146
+ zval * src = end + (num_args - first_extra_arg );
147
+ zval * dst = src + (op_array -> last_var + op_array -> T - first_extra_arg );
151
148
if (EXPECTED (src != dst )) {
152
149
do {
153
150
type_flags |= Z_TYPE_INFO_P (src );
@@ -256,11 +253,10 @@ static zend_always_inline zend_constant* _zend_quick_get_constant(
256
253
zend_execute_data * execute_data = EG (current_execute_data );
257
254
#endif
258
255
const zend_op * opline = EX (opline );
259
- zval * zv ;
260
256
zend_constant * c = NULL ;
261
257
262
258
/* null/true/false are resolved during compilation, so don't check for them here. */
263
- zv = zend_hash_find_known_hash (EG (zend_constants ), Z_STR_P (key ));
259
+ zval * zv = zend_hash_find_known_hash (EG (zend_constants ), Z_STR_P (key ));
264
260
if (zv ) {
265
261
c = (zend_constant * )Z_PTR_P (zv );
266
262
} else if (flags & IS_CONSTANT_UNQUALIFIED_IN_NAMESPACE ) {
@@ -395,21 +391,19 @@ ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_jit_loop_trace_helper(ZEND_OPCODE_HAN
395
391
396
392
static int zend_jit_trace_recursive_call_count (const zend_op_array * op_array , const zend_op_array * * unrolled_calls , int ret_level , int level )
397
393
{
398
- int i ;
399
394
int count = 0 ;
400
395
401
- for (i = ret_level ; i < level ; i ++ ) {
396
+ for (int i = ret_level ; i < level ; i ++ ) {
402
397
count += (unrolled_calls [i ] == op_array );
403
398
}
404
399
return count ;
405
400
}
406
401
407
402
static int zend_jit_trace_recursive_ret_count (const zend_op_array * op_array , const zend_op_array * * unrolled_calls , int ret_level )
408
403
{
409
- int i ;
410
404
int count = 0 ;
411
405
412
- for (i = 0 ; i < ret_level ; i ++ ) {
406
+ for (int i = 0 ; i < ret_level ; i ++ ) {
413
407
count += (unrolled_calls [i ] == op_array );
414
408
}
415
409
return count ;
@@ -432,12 +426,11 @@ static uint8_t zend_jit_trace_bad_stop_event(const zend_op *opline, int count)
432
426
const zend_op * * cache_opline = JIT_G (bad_root_cache_opline );
433
427
uint8_t * cache_count = JIT_G (bad_root_cache_count );
434
428
uint8_t * cache_stop = JIT_G (bad_root_cache_stop );
435
- uint32_t i ;
436
429
437
430
if (count < 0 ) {
438
431
count = 0 ;
439
432
}
440
- for (i = 0 ; i < ZEND_JIT_TRACE_BAD_ROOT_SLOTS ; i ++ ) {
433
+ for (uint32_t i = 0 ; i < ZEND_JIT_TRACE_BAD_ROOT_SLOTS ; i ++ ) {
441
434
if (cache_opline [i ] == opline ) {
442
435
if (cache_count [i ] >= count ) {
443
436
return cache_stop [i ];
@@ -455,17 +448,14 @@ static int zend_jit_trace_record_fake_init_call_ex(zend_execute_data *call, zend
455
448
zend_jit_trace_stop stop ZEND_ATTRIBUTE_UNUSED = ZEND_JIT_TRACE_STOP_ERROR ;
456
449
457
450
do {
458
- zend_function * func ;
459
- zend_jit_op_array_trace_extension * jit_extension ;
460
-
461
451
if (call -> prev_execute_data ) {
462
452
idx = zend_jit_trace_record_fake_init_call_ex (call -> prev_execute_data , trace_buffer , idx , is_megamorphic , init_level + 1 );
463
453
if (idx < 0 ) {
464
454
return idx ;
465
455
}
466
456
}
467
457
468
- func = call -> func ;
458
+ zend_function * func = call -> func ;
469
459
if (func -> common .fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE |ZEND_ACC_NEVER_CACHE )) {
470
460
/* TODO: Can we continue recording ??? */
471
461
return -1 ;
@@ -476,7 +466,7 @@ static int zend_jit_trace_record_fake_init_call_ex(zend_execute_data *call, zend
476
466
}
477
467
if (func -> type == ZEND_USER_FUNCTION
478
468
&& (func -> op_array .fn_flags & ZEND_ACC_CLOSURE )) {
479
- jit_extension =
469
+ zend_jit_op_array_trace_extension * const jit_extension =
480
470
(zend_jit_op_array_trace_extension * )ZEND_FUNC_INFO (& func -> op_array );
481
471
if (UNEXPECTED (!jit_extension
482
472
|| !(jit_extension -> func_info .flags & ZEND_FUNC_JIT_ON_HOT_TRACE )
@@ -548,18 +538,11 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
548
538
zend_execute_data * save_execute_data = execute_data ;
549
539
const zend_op * save_opline = opline ;
550
540
#endif
551
- const zend_op * orig_opline , * end_opline ;
552
541
zend_jit_trace_stop stop = ZEND_JIT_TRACE_STOP_ERROR ;
553
542
zend_jit_trace_stop halt = 0 ;
554
543
int level = 0 ;
555
544
int ret_level = 0 ;
556
- zend_vm_opcode_handler_t handler ;
557
- const zend_op_array * op_array ;
558
- zend_jit_op_array_trace_extension * jit_extension ;
559
- size_t offset ;
560
- int idx , count ;
561
- uint8_t trace_flags , op1_type , op2_type , op3_type ;
562
- zend_class_entry * ce1 , * ce2 ;
545
+ int idx ;
563
546
const zend_op * link_to_enter_opline = NULL ;
564
547
int backtrack_link_to_enter = -1 ;
565
548
int backtrack_recursion = -1 ;
@@ -576,18 +559,17 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
576
559
execute_data = ex ;
577
560
opline = EX (opline ) = op ;
578
561
#else
579
- int rc ;
580
562
zend_execute_data * execute_data = ex ;
581
563
const zend_op * opline = EX (opline );
582
564
#endif
583
565
zend_execute_data * prev_call = EX (call );
584
566
585
- orig_opline = opline ;
567
+ const zend_op * const orig_opline = opline ;
586
568
587
- op_array = & EX (func )-> op_array ;
588
- jit_extension =
569
+ const zend_op_array * op_array = & EX (func )-> op_array ;
570
+ zend_jit_op_array_trace_extension * const jit_extension =
589
571
(zend_jit_op_array_trace_extension * )ZEND_FUNC_INFO (op_array );
590
- offset = jit_extension -> offset ;
572
+ size_t offset = jit_extension -> offset ;
591
573
if (!op_array -> function_name
592
574
|| (op_array -> fn_flags & ZEND_ACC_CLOSURE )) {
593
575
op_array = jit_extension -> op_array ;
@@ -619,8 +601,8 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
619
601
}
620
602
621
603
while (1 ) {
622
- ce1 = ce2 = NULL ;
623
- op1_type = op2_type = op3_type = IS_UNKNOWN ;
604
+ zend_class_entry * ce1 = NULL , * ce2 = NULL ;
605
+ uint8_t op1_type = IS_UNKNOWN , op2_type = IS_UNKNOWN , op3_type = IS_UNKNOWN ;
624
606
if ((opline -> op1_type & (IS_TMP_VAR |IS_VAR |IS_CV ))
625
607
&& opline -> opcode != ZEND_ROPE_ADD
626
608
&& opline -> opcode != ZEND_ROPE_END
@@ -846,7 +828,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
846
828
break ;
847
829
}
848
830
849
- handler = (zend_vm_opcode_handler_t )ZEND_OP_TRACE_INFO (opline , offset )-> call_handler ;
831
+ const zend_vm_opcode_handler_t handler = (zend_vm_opcode_handler_t )ZEND_OP_TRACE_INFO (opline , offset )-> call_handler ;
850
832
#ifdef HAVE_GCC_GLOBAL_REGS
851
833
handler ();
852
834
if (UNEXPECTED (opline == zend_jit_halt_op )) {
@@ -857,7 +839,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
857
839
}
858
840
if (UNEXPECTED (execute_data != prev_execute_data )) {
859
841
#else
860
- rc = handler (ZEND_OPCODE_HANDLER_ARGS_PASSTHRU );
842
+ int rc = handler (ZEND_OPCODE_HANDLER_ARGS_PASSTHRU );
861
843
if (rc != 0 ) {
862
844
if (rc < 0 ) {
863
845
stop = ZEND_JIT_TRACE_STOP_RETURN ;
@@ -873,7 +855,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
873
855
#endif
874
856
875
857
op_array = & EX (func )-> op_array ;
876
- jit_extension =
858
+ zend_jit_op_array_trace_extension * const jit_extension =
877
859
(zend_jit_op_array_trace_extension * )ZEND_FUNC_INFO (op_array );
878
860
if (UNEXPECTED (!jit_extension )
879
861
|| UNEXPECTED (!(jit_extension -> func_info .flags & ZEND_FUNC_JIT_ON_HOT_TRACE ))) {
@@ -910,7 +892,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
910
892
EX (return_value ) != NULL ? ZEND_JIT_TRACE_RETURN_VALUE_USED : 0 ,
911
893
op_array );
912
894
913
- count = zend_jit_trace_recursive_call_count (& EX (func )-> op_array , unrolled_calls , ret_level , level );
895
+ const int count = zend_jit_trace_recursive_call_count (& EX (func )-> op_array , unrolled_calls , ret_level , level );
914
896
915
897
if (opline == orig_opline ) {
916
898
if (count + 1 >= JIT_G (max_recursive_calls )) {
@@ -940,7 +922,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
940
922
break ;
941
923
}
942
924
TRACE_RECORD (ZEND_JIT_TRACE_BACK , 0 , op_array );
943
- count = zend_jit_trace_recursive_ret_count (& EX (func )-> op_array , unrolled_calls , ret_level );
925
+ const int count = zend_jit_trace_recursive_ret_count (& EX (func )-> op_array , unrolled_calls , ret_level );
944
926
if (opline == orig_opline ) {
945
927
if (count + 1 >= JIT_G (max_recursive_returns )) {
946
928
stop = ZEND_JIT_TRACE_STOP_RECURSIVE_RET ;
@@ -998,9 +980,6 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
998
980
if (EX (call ) != prev_call ) {
999
981
if (EX (call )
1000
982
&& EX (call )-> prev_execute_data == prev_call ) {
1001
- zend_function * func ;
1002
- zend_jit_op_array_trace_extension * jit_extension ;
1003
-
1004
983
if (EX (call )-> func -> common .fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE ) {
1005
984
/* TODO: Can we continue recording ??? */
1006
985
stop = ZEND_JIT_TRACE_STOP_TRAMPOLINE ;
@@ -1010,15 +989,15 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
1010
989
stop = ZEND_JIT_TRACE_STOP_BAD_FUNC ;
1011
990
break ;
1012
991
}
1013
- func = EX (call )-> func ;
992
+ zend_function * func = EX (call )-> func ;
1014
993
if (func -> type == ZEND_INTERNAL_FUNCTION
1015
994
&& (func -> op_array .fn_flags & (ZEND_ACC_CLOSURE |ZEND_ACC_FAKE_CLOSURE ))) {
1016
995
stop = ZEND_JIT_TRACE_STOP_BAD_FUNC ;
1017
996
break ;
1018
997
}
1019
998
if (func -> type == ZEND_USER_FUNCTION
1020
999
&& (func -> op_array .fn_flags & ZEND_ACC_CLOSURE )) {
1021
- jit_extension =
1000
+ zend_jit_op_array_trace_extension * const jit_extension =
1022
1001
(zend_jit_op_array_trace_extension * )ZEND_FUNC_INFO (& func -> op_array );
1023
1002
if (UNEXPECTED (!jit_extension )
1024
1003
|| !(jit_extension -> func_info .flags & ZEND_FUNC_JIT_ON_HOT_TRACE )
@@ -1059,7 +1038,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
1059
1038
break ;
1060
1039
}
1061
1040
1062
- trace_flags = ZEND_OP_TRACE_INFO (opline , offset )-> trace_flags ;
1041
+ const uint8_t trace_flags = ZEND_OP_TRACE_INFO (opline , offset )-> trace_flags ;
1063
1042
if (trace_flags ) {
1064
1043
if (trace_flags & ZEND_JIT_TRACE_JITED ) {
1065
1044
if (trace_flags & ZEND_JIT_TRACE_START_LOOP ) {
@@ -1144,7 +1123,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
1144
1123
}
1145
1124
}
1146
1125
1147
- end_opline = opline ;
1126
+ const zend_op * end_opline = opline ;
1148
1127
if (!ZEND_JIT_TRACE_STOP_OK (stop )) {
1149
1128
if (backtrack_recursion > 0 ) {
1150
1129
idx = backtrack_recursion ;
0 commit comments