Changeset 834
- Timestamp:
- 2012-03-23T18:17:10+01:00 (14 months ago)
- File:
-
- 1 edited
-
trunk/optimizer.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/optimizer.c
r822 r834 57 57 { 58 58 int i; 59 zend_bool preserve_brk_cont_array = 0; 59 60 60 61 if (op_array->brk_cont_array == NULL) { … … 65 66 zend_op *opline = &op_array->opcodes[i]; 66 67 zend_brk_cont_element *jmp_to; 68 zend_bool can_convert = 1; 67 69 int array_offset, nest_levels, original_nest_levels; 68 70 69 if (opline->opcode != ZEND_BRK && opline->opcode != ZEND_CONT) { 71 switch (opline->opcode) { 72 case ZEND_BRK: 73 case ZEND_CONT: 74 break; 75 76 #ifdef ZEND_GOTO 77 case ZEND_GOTO: 78 preserve_brk_cont_array = 1; 70 79 continue; 71 } 80 #endif 81 82 default: 83 continue; 84 } 85 72 86 if (Z_OP_TYPE(opline->op2) != IS_CONST 73 87 || Z_OP_CONSTANT(opline->op2).type != IS_LONG) { … … 92 106 switch (brk_opline->opcode) { 93 107 case ZEND_SWITCH_FREE: 94 break;95 108 case ZEND_FREE: 109 if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) { 110 can_convert = 0; 111 preserve_brk_cont_array = 1; 112 } 96 113 break; 97 114 } … … 100 117 } while (--nest_levels > 0); 101 118 102 /* rewrite to jmp */ 103 if (opline->opcode == ZEND_BRK) { 104 Z_OP(opline->op1).opline_num = jmp_to->brk; 105 } 106 else { 107 Z_OP(opline->op1).opline_num = jmp_to->cont; 108 } 109 Z_OP_TYPE(opline->op2) = IS_UNUSED; 110 opline->opcode = ZEND_JMP; 111 } 112 113 if (op_array->brk_cont_array != NULL) { 114 efree(op_array->brk_cont_array); 115 op_array->brk_cont_array = NULL; 116 } 117 op_array->last_brk_cont = 0; 119 if (can_convert) { 120 /* rewrite to jmp */ 121 switch (opline->opcode) { 122 case ZEND_BRK: 123 Z_OP(opline->op1).opline_num = jmp_to->brk; 124 break; 125 126 case ZEND_CONT: 127 Z_OP(opline->op1).opline_num = jmp_to->cont; 128 break; 129 } 130 Z_OP_TYPE(opline->op2) = IS_UNUSED; 131 opline->opcode = ZEND_JMP; 132 } 133 } 134 135 if (!preserve_brk_cont_array) { 136 if (op_array->brk_cont_array != NULL) { 137 efree(op_array->brk_cont_array); 138 op_array->brk_cont_array = NULL; 139 } 140 op_array->last_brk_cont = 0; 141 } 118 142 return SUCCESS; 119 143 }
Note: See TracChangeset
for help on using the changeset viewer.

