File tree Expand file tree Collapse file tree 1 file changed +21
-13
lines changed Expand file tree Collapse file tree 1 file changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -6729,28 +6729,36 @@ static void zend_pm_kill_last_op_if_jmp(zend_pm_context *context)
67296729{
67306730 zend_op_array * op_array = CG (active_op_array );
67316731 zend_op * opline = & op_array -> opcodes [op_array -> last - 1 ];
6732-
6733- #if ZEND_DEBUG
67346732 uint32_t * labels = zend_stack_base (& context -> labels );
67356733 uint32_t label_lower_bound = - zend_stack_count (& context -> labels );
6736- #endif
67376734
6735+ uint32_t label_idx ;
67386736 switch (opline -> opcode ) {
67396737 case ZEND_JMP :
6740- #if ZEND_DEBUG
6741- ZEND_ASSERT (opline -> op1 .opline_num >= label_lower_bound && labels [- opline -> op1 .opline_num ] == op_array -> last );
6742- #endif
6743- MAKE_NOP (opline );
6744- op_array -> last -- ;
6738+ label_idx = opline -> op1 .opline_num ;
67456739 break ;
67466740 case ZEND_JMPZ_EX :
67476741 case ZEND_JMPNZ_EX :
6748- #if ZEND_DEBUG
6749- ZEND_ASSERT (opline -> op2 .opline_num >= label_lower_bound && labels [- opline -> op2 .opline_num ] == op_array -> last );
6750- #endif
6751- MAKE_NOP (opline );
6752- op_array -> last -- ;
6742+ label_idx = opline -> op2 .opline_num ;
67536743 break ;
6744+ default :
6745+ return ;
6746+ }
6747+
6748+ ZEND_ASSERT (label_idx >= label_lower_bound );
6749+ uint32_t label_target = labels [- label_idx ];
6750+ ZEND_ASSERT (label_target == op_array -> last );
6751+
6752+ MAKE_NOP (opline );
6753+ op_array -> last -- ;
6754+
6755+ uint32_t * label = labels ;
6756+ uint32_t * label_end = zend_stack_top (& context -> labels );
6757+ while (label <= label_end ) {
6758+ if (* label == label_target ) {
6759+ (* label )-- ;
6760+ }
6761+ label ++ ;
67546762 }
67556763}
67566764
You can’t perform that action at this time.
0 commit comments