@@ -169,6 +169,9 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
169
169
int first = 1 ;
170
170
171
171
fprintf (stderr , " [" );
172
+ if (info & MAY_BE_GUARD ) {
173
+ fprintf (stderr , "!" );
174
+ }
172
175
if (info & MAY_BE_UNDEF ) {
173
176
if (first ) first = 0 ; else fprintf (stderr , ", " );
174
177
fprintf (stderr , "undef" );
@@ -329,7 +332,7 @@ static void zend_dump_ssa_var_info(const zend_ssa *ssa, int ssa_var_num, uint32_
329
332
dump_flags );
330
333
}
331
334
332
- static void zend_dump_ssa_var (const zend_op_array * op_array , const zend_ssa * ssa , int ssa_var_num , zend_uchar var_type , int var_num , uint32_t dump_flags )
335
+ void zend_dump_ssa_var (const zend_op_array * op_array , const zend_ssa * ssa , int ssa_var_num , zend_uchar var_type , int var_num , uint32_t dump_flags )
333
336
{
334
337
if (ssa_var_num >= 0 ) {
335
338
fprintf (stderr , "#%d." , ssa_var_num );
@@ -402,21 +405,16 @@ static void zend_dump_range_constraint(const zend_op_array *op_array, const zend
402
405
}
403
406
}
404
407
405
- void zend_dump_op (const zend_op_array * op_array , const zend_basic_block * b , const zend_op * opline , uint32_t dump_flags , const void * data )
408
+ void zend_dump_op (const zend_op_array * op_array , const zend_basic_block * b , const zend_op * opline , uint32_t dump_flags , const zend_ssa * ssa , const zend_ssa_op * ssa_op )
406
409
{
407
410
const char * name = zend_get_opcode_name (opline -> opcode );
408
411
uint32_t flags = zend_get_opcode_flags (opline -> opcode );
409
412
uint32_t n = 0 ;
410
- const zend_ssa * ssa = NULL ;
411
413
412
- if (dump_flags & ZEND_DUMP_SSA ) {
413
- ssa = (const zend_ssa * )data ;
414
- }
415
-
416
- if (!ssa || !ssa -> ops || ssa -> ops [opline - op_array -> opcodes ].result_use < 0 ) {
414
+ if (!ssa_op || ssa_op -> result_use < 0 ) {
417
415
if (opline -> result_type & (IS_CV |IS_VAR |IS_TMP_VAR )) {
418
- if (ssa && ssa -> ops && ssa -> ops [ opline - op_array -> opcodes ]. result_def >= 0 ) {
419
- int ssa_var_num = ssa -> ops [ opline - op_array -> opcodes ]. result_def ;
416
+ if (ssa_op && ssa_op -> result_def >= 0 ) {
417
+ int ssa_var_num = ssa_op -> result_def ;
420
418
zend_dump_ssa_var (op_array , ssa , ssa_var_num , opline -> result_type , EX_VAR_TO_NUM (opline -> result .var ), dump_flags );
421
419
} else {
422
420
zend_dump_var (op_array , opline -> result_type , EX_VAR_TO_NUM (opline -> result .var ));
@@ -582,21 +580,21 @@ void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, cons
582
580
if (opline -> op1_type == IS_CONST ) {
583
581
zend_dump_const (CRT_CONSTANT (opline -> op1 ));
584
582
} else if (opline -> op1_type & (IS_CV |IS_VAR |IS_TMP_VAR )) {
585
- if (ssa && ssa -> ops ) {
586
- int ssa_var_num = ssa -> ops [ opline - op_array -> opcodes ]. op1_use ;
583
+ if (ssa_op ) {
584
+ int ssa_var_num = ssa_op -> op1_use ;
587
585
if (ssa_var_num >= 0 ) {
588
586
fprintf (stderr , " " );
589
587
zend_dump_ssa_var (op_array , ssa , ssa_var_num , opline -> op1_type , EX_VAR_TO_NUM (opline -> op1 .var ), dump_flags );
590
- } else if (ssa -> ops [ opline - op_array -> opcodes ]. op1_def < 0 ) {
588
+ } else if (ssa_op -> op1_def < 0 ) {
591
589
fprintf (stderr , " " );
592
590
zend_dump_var (op_array , opline -> op1_type , EX_VAR_TO_NUM (opline -> op1 .var ));
593
591
}
594
592
} else {
595
593
fprintf (stderr , " " );
596
594
zend_dump_var (op_array , opline -> op1_type , EX_VAR_TO_NUM (opline -> op1 .var ));
597
595
}
598
- if (ssa && ssa -> ops ) {
599
- int ssa_var_num = ssa -> ops [ opline - op_array -> opcodes ]. op1_def ;
596
+ if (ssa_op ) {
597
+ int ssa_var_num = ssa_op -> op1_def ;
600
598
if (ssa_var_num >= 0 ) {
601
599
fprintf (stderr , " -> " );
602
600
zend_dump_ssa_var (op_array , ssa , ssa_var_num , opline -> op1_type , EX_VAR_TO_NUM (opline -> op1 .var ), dump_flags );
@@ -643,21 +641,21 @@ void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, cons
643
641
zend_dump_const (op );
644
642
}
645
643
} else if (opline -> op2_type & (IS_CV |IS_VAR |IS_TMP_VAR )) {
646
- if (ssa && ssa -> ops ) {
647
- int ssa_var_num = ssa -> ops [ opline - op_array -> opcodes ]. op2_use ;
644
+ if (ssa_op ) {
645
+ int ssa_var_num = ssa_op -> op2_use ;
648
646
if (ssa_var_num >= 0 ) {
649
647
fprintf (stderr , " " );
650
648
zend_dump_ssa_var (op_array , ssa , ssa_var_num , opline -> op2_type , EX_VAR_TO_NUM (opline -> op2 .var ), dump_flags );
651
- } else if (ssa -> ops [ opline - op_array -> opcodes ]. op2_def < 0 ) {
649
+ } else if (ssa_op -> op2_def < 0 ) {
652
650
fprintf (stderr , " " );
653
651
zend_dump_var (op_array , opline -> op2_type , EX_VAR_TO_NUM (opline -> op2 .var ));
654
652
}
655
653
} else {
656
654
fprintf (stderr , " " );
657
655
zend_dump_var (op_array , opline -> op2_type , EX_VAR_TO_NUM (opline -> op2 .var ));
658
656
}
659
- if (ssa && ssa -> ops ) {
660
- int ssa_var_num = ssa -> ops [ opline - op_array -> opcodes ]. op2_def ;
657
+ if (ssa_op ) {
658
+ int ssa_var_num = ssa_op -> op2_def ;
661
659
if (ssa_var_num >= 0 ) {
662
660
fprintf (stderr , " -> " );
663
661
zend_dump_ssa_var (op_array , ssa , ssa_var_num , opline -> op2_type , EX_VAR_TO_NUM (opline -> op2 .var ), dump_flags );
@@ -697,10 +695,10 @@ void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, cons
697
695
} else if (opline -> result_type & IS_SMART_BRANCH_JMPNZ ) {
698
696
fprintf (stderr , " jmpnz" );
699
697
#endif
700
- } else if (ssa && ssa -> ops && ssa -> ops [ opline - op_array -> opcodes ]. result_use >= 0 ) {
698
+ } else if (ssa_op && ssa_op -> result_use >= 0 ) {
701
699
if (opline -> result_type & (IS_CV |IS_VAR |IS_TMP_VAR )) {
702
- if (ssa && ssa -> ops ) {
703
- int ssa_var_num = ssa -> ops [ opline - op_array -> opcodes ]. result_use ;
700
+ if (ssa_op ) {
701
+ int ssa_var_num = ssa_op -> result_use ;
704
702
if (ssa_var_num >= 0 ) {
705
703
fprintf (stderr , " " );
706
704
zend_dump_ssa_var (op_array , ssa , ssa_var_num , opline -> result_type , EX_VAR_TO_NUM (opline -> result .var ), dump_flags );
@@ -709,8 +707,8 @@ void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, cons
709
707
fprintf (stderr , " " );
710
708
zend_dump_var (op_array , opline -> result_type , EX_VAR_TO_NUM (opline -> result .var ));
711
709
}
712
- if (ssa && ssa -> ops ) {
713
- int ssa_var_num = ssa -> ops [ opline - op_array -> opcodes ]. result_def ;
710
+ if (ssa_op ) {
711
+ int ssa_var_num = ssa_op -> result_def ;
714
712
if (ssa_var_num >= 0 ) {
715
713
fprintf (stderr , " -> " );
716
714
zend_dump_ssa_var (op_array , ssa , ssa_var_num , opline -> result_type , EX_VAR_TO_NUM (opline -> result .var ), dump_flags );
@@ -723,6 +721,8 @@ void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *b, cons
723
721
static void zend_dump_op_line (const zend_op_array * op_array , const zend_basic_block * b , const zend_op * opline , uint32_t dump_flags , const void * data )
724
722
{
725
723
int len = 0 ;
724
+ const zend_ssa * ssa = NULL ;
725
+ zend_ssa_op * ssa_op = NULL ;
726
726
727
727
if (dump_flags & ZEND_DUMP_NUMERIC_OPLINES ) {
728
728
len = fprintf (stderr , "%04u:" , (uint32_t )(opline - op_array -> opcodes ));
@@ -731,7 +731,14 @@ static void zend_dump_op_line(const zend_op_array *op_array, const zend_basic_bl
731
731
}
732
732
fprintf (stderr , "%*c" , 12 - len , ' ' );
733
733
734
- zend_dump_op (op_array , b , opline , dump_flags , data );
734
+ if (dump_flags & ZEND_DUMP_SSA ) {
735
+ ssa = (const zend_ssa * )data ;
736
+ if (ssa && ssa -> ops ) {
737
+ ssa_op = & ssa -> ops [opline - op_array -> opcodes ];
738
+ }
739
+ }
740
+
741
+ zend_dump_op (op_array , b , opline , dump_flags , ssa , ssa_op );
735
742
fprintf (stderr , "\n" );
736
743
}
737
744
0 commit comments