@@ -449,7 +449,9 @@ static uint8_t zend_jit_trace_bad_stop_event(const zend_op *opline, int count)
449
449
return 0 ;
450
450
}
451
451
452
- static int zend_jit_trace_record_fake_init_call_ex (zend_execute_data * call , zend_jit_trace_rec * trace_buffer , int idx , uint32_t is_megamorphic , uint32_t * megamorphic , uint32_t level , uint32_t init_level , uint32_t * call_level )
452
+ #define ZEND_CALL_MEGAMORPHIC ZEND_CALL_JIT_RESERVED
453
+
454
+ static int zend_jit_trace_record_fake_init_call_ex (zend_execute_data * call , zend_jit_trace_rec * trace_buffer , int idx , uint32_t is_megamorphic , uint32_t init_level )
453
455
{
454
456
zend_jit_trace_stop stop ZEND_ATTRIBUTE_UNUSED = ZEND_JIT_TRACE_STOP_ERROR ;
455
457
@@ -458,7 +460,7 @@ static int zend_jit_trace_record_fake_init_call_ex(zend_execute_data *call, zend
458
460
zend_jit_op_array_trace_extension * jit_extension ;
459
461
460
462
if (call -> prev_execute_data ) {
461
- idx = zend_jit_trace_record_fake_init_call_ex (call -> prev_execute_data , trace_buffer , idx , is_megamorphic , megamorphic , level , init_level + 1 , call_level );
463
+ idx = zend_jit_trace_record_fake_init_call_ex (call -> prev_execute_data , trace_buffer , idx , is_megamorphic , init_level + 1 );
462
464
if (idx < 0 ) {
463
465
return idx ;
464
466
}
@@ -489,32 +491,16 @@ static int zend_jit_trace_record_fake_init_call_ex(zend_execute_data *call, zend
489
491
&& ((ZEND_CALL_INFO (call ) & ZEND_CALL_DYNAMIC )
490
492
|| func -> common .scope )) {
491
493
func = NULL ;
492
- * megamorphic |= (1 << (level + * call_level ));
493
- } else {
494
- * megamorphic &= ~(1 << (level + * call_level ));
494
+ ZEND_ADD_CALL_FLAG (EX (call ), ZEND_CALL_MEGAMORPHIC );
495
495
}
496
- (* call_level )++ ;
497
496
TRACE_RECORD (ZEND_JIT_TRACE_INIT_CALL , ZEND_JIT_TRACE_FAKE_INFO (init_level ), func );
498
497
} while (0 );
499
498
return idx ;
500
499
}
501
500
502
- static int zend_jit_trace_record_fake_init_call (zend_execute_data * call , zend_jit_trace_rec * trace_buffer , int idx , uint32_t is_megamorphic , uint32_t * megamorphic , uint32_t level )
501
+ static int zend_jit_trace_record_fake_init_call (zend_execute_data * call , zend_jit_trace_rec * trace_buffer , int idx , uint32_t is_megamorphic )
503
502
{
504
- uint32_t call_level = 0 ;
505
-
506
- return zend_jit_trace_record_fake_init_call_ex (call , trace_buffer , idx , is_megamorphic , megamorphic , level , 0 , & call_level );
507
- }
508
-
509
- static int zend_jit_trace_call_level (const zend_execute_data * call )
510
- {
511
- int call_level = 0 ;
512
-
513
- while (call -> prev_execute_data ) {
514
- call_level ++ ;
515
- call = call -> prev_execute_data ;
516
- }
517
- return call_level ;
503
+ return zend_jit_trace_record_fake_init_call_ex (call , trace_buffer , idx , is_megamorphic , 0 );
518
504
}
519
505
520
506
static int zend_jit_trace_subtrace (zend_jit_trace_rec * trace_buffer , int start , int end , uint8_t event , const zend_op_array * op_array , const zend_op * opline )
@@ -568,7 +554,6 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
568
554
zend_jit_trace_stop halt = 0 ;
569
555
int level = 0 ;
570
556
int ret_level = 0 ;
571
- int call_level ;
572
557
zend_vm_opcode_handler_t handler ;
573
558
const zend_op_array * op_array ;
574
559
zend_jit_op_array_trace_extension * jit_extension ;
@@ -585,7 +570,6 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
585
570
int last_loop = -1 ;
586
571
int last_loop_level = -1 ;
587
572
const zend_op * last_loop_opline = NULL ;
588
- uint32_t megamorphic = 0 ;
589
573
const zend_op_array * unrolled_calls [ZEND_JIT_TRACE_MAX_CALL_DEPTH + ZEND_JIT_TRACE_MAX_RET_DEPTH ];
590
574
#ifdef HAVE_GCC_GLOBAL_REGS
591
575
zend_execute_data * prev_execute_data = ex ;
@@ -623,7 +607,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
623
607
}
624
608
625
609
if (prev_call ) {
626
- int ret = zend_jit_trace_record_fake_init_call (prev_call , trace_buffer , idx , is_megamorphic , & megamorphic , ret_level + level );
610
+ int ret = zend_jit_trace_record_fake_init_call (prev_call , trace_buffer , idx , is_megamorphic );
627
611
if (ret < 0 ) {
628
612
TRACE_END (ZEND_JIT_TRACE_END , ZEND_JIT_TRACE_STOP_BAD_FUNC , opline );
629
613
#ifdef HAVE_GCC_GLOBAL_REGS
@@ -831,8 +815,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
831
815
|| opline -> opcode == ZEND_DO_ICALL
832
816
|| opline -> opcode == ZEND_DO_UCALL
833
817
|| opline -> opcode == ZEND_DO_FCALL_BY_NAME ) {
834
- call_level = zend_jit_trace_call_level (EX (call ));
835
- if (megamorphic & (1 << (ret_level + level + call_level ))) {
818
+ if (ZEND_CALL_INFO (EX (call )) & ZEND_CALL_MEGAMORPHIC ) {
836
819
stop = ZEND_JIT_TRACE_STOP_INTERPRETER ;
837
820
break ;
838
821
}
@@ -962,7 +945,7 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
962
945
last_loop_opline = NULL ;
963
946
964
947
if (prev_call ) {
965
- int ret = zend_jit_trace_record_fake_init_call (prev_call , trace_buffer , idx , 0 , & megamorphic , ret_level + level );
948
+ int ret = zend_jit_trace_record_fake_init_call (prev_call , trace_buffer , idx , 0 );
966
949
if (ret < 0 ) {
967
950
stop = ZEND_JIT_TRACE_STOP_BAD_FUNC ;
968
951
break ;
@@ -1045,12 +1028,8 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
1045
1028
&& trace_buffer [1 ].opline == opline - 1 ) {
1046
1029
func = NULL ;
1047
1030
}
1048
- call_level = zend_jit_trace_call_level (EX (call ));
1049
- ZEND_ASSERT (ret_level + level + call_level < 32 );
1050
- if (func ) {
1051
- megamorphic &= ~(1 << (ret_level + level + call_level ));
1052
- } else {
1053
- megamorphic |= (1 << (ret_level + level + call_level ));
1031
+ if (!func ) {
1032
+ ZEND_ADD_CALL_FLAG (EX (call ), ZEND_CALL_MEGAMORPHIC );
1054
1033
}
1055
1034
TRACE_RECORD (ZEND_JIT_TRACE_INIT_CALL , 0 , func );
1056
1035
}
0 commit comments