@@ -169,6 +169,9 @@ static void zend_dump_type_info(uint32_t info, zend_class_entry *ce, int is_inst
169169 int first = 1 ;
170170
171171 fprintf (stderr , " [" );
172+ if (info & MAY_BE_GUARD ) {
173+ fprintf (stderr , "!" );
174+ }
172175 if (info & MAY_BE_UNDEF ) {
173176 if (first ) first = 0 ; else fprintf (stderr , ", " );
174177 fprintf (stderr , "undef" );
@@ -329,7 +332,7 @@ static void zend_dump_ssa_var_info(const zend_ssa *ssa, int ssa_var_num, uint32_
329332 dump_flags );
330333}
331334
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 )
333336{
334337 if (ssa_var_num >= 0 ) {
335338 fprintf (stderr , "#%d." , ssa_var_num );
@@ -402,21 +405,16 @@ static void zend_dump_range_constraint(const zend_op_array *op_array, const zend
402405 }
403406}
404407
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 )
406409{
407410 const char * name = zend_get_opcode_name (opline -> opcode );
408411 uint32_t flags = zend_get_opcode_flags (opline -> opcode );
409412 uint32_t n = 0 ;
410- const zend_ssa * ssa = NULL ;
411413
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 ) {
417415 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 ;
420418 zend_dump_ssa_var (op_array , ssa , ssa_var_num , opline -> result_type , EX_VAR_TO_NUM (opline -> result .var ), dump_flags );
421419 } else {
422420 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
582580 if (opline -> op1_type == IS_CONST ) {
583581 zend_dump_const (CRT_CONSTANT (opline -> op1 ));
584582 } 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 ;
587585 if (ssa_var_num >= 0 ) {
588586 fprintf (stderr , " " );
589587 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 ) {
591589 fprintf (stderr , " " );
592590 zend_dump_var (op_array , opline -> op1_type , EX_VAR_TO_NUM (opline -> op1 .var ));
593591 }
594592 } else {
595593 fprintf (stderr , " " );
596594 zend_dump_var (op_array , opline -> op1_type , EX_VAR_TO_NUM (opline -> op1 .var ));
597595 }
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 ;
600598 if (ssa_var_num >= 0 ) {
601599 fprintf (stderr , " -> " );
602600 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
643641 zend_dump_const (op );
644642 }
645643 } 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 ;
648646 if (ssa_var_num >= 0 ) {
649647 fprintf (stderr , " " );
650648 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 ) {
652650 fprintf (stderr , " " );
653651 zend_dump_var (op_array , opline -> op2_type , EX_VAR_TO_NUM (opline -> op2 .var ));
654652 }
655653 } else {
656654 fprintf (stderr , " " );
657655 zend_dump_var (op_array , opline -> op2_type , EX_VAR_TO_NUM (opline -> op2 .var ));
658656 }
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 ;
661659 if (ssa_var_num >= 0 ) {
662660 fprintf (stderr , " -> " );
663661 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
697695 } else if (opline -> result_type & IS_SMART_BRANCH_JMPNZ ) {
698696 fprintf (stderr , " jmpnz" );
699697#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 ) {
701699 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 ;
704702 if (ssa_var_num >= 0 ) {
705703 fprintf (stderr , " " );
706704 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
709707 fprintf (stderr , " " );
710708 zend_dump_var (op_array , opline -> result_type , EX_VAR_TO_NUM (opline -> result .var ));
711709 }
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 ;
714712 if (ssa_var_num >= 0 ) {
715713 fprintf (stderr , " -> " );
716714 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
723721static 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 )
724722{
725723 int len = 0 ;
724+ const zend_ssa * ssa = NULL ;
725+ zend_ssa_op * ssa_op = NULL ;
726726
727727 if (dump_flags & ZEND_DUMP_NUMERIC_OPLINES ) {
728728 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
731731 }
732732 fprintf (stderr , "%*c" , 12 - len , ' ' );
733733
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 );
735742 fprintf (stderr , "\n" );
736743}
737744
0 commit comments