@@ -70,7 +70,7 @@ void scdf_mark_edge_feasible(scdf_ctx *scdf, int from, int to) {
7070 } else {
7171 /* Block is already executable, only a new edge became feasible.
7272 * Reevaluate phi nodes to account for changed source operands. */
73- zend_ssa_block * ssa_block = & scdf -> ssa -> blocks [to ];
73+ const zend_ssa_block * ssa_block = & scdf -> ssa -> blocks [to ];
7474 zend_ssa_phi * phi ;
7575 for (phi = ssa_block -> phis ; phi ; phi = phi -> next ) {
7676 zend_bitset_excl (scdf -> phi_var_worklist , phi -> ssa_var );
@@ -101,7 +101,7 @@ void scdf_init(zend_optimizer_ctx *ctx, scdf_ctx *scdf, zend_op_array *op_array,
101101}
102102
103103void scdf_solve (scdf_ctx * scdf , const char * name ) {
104- zend_ssa * ssa = scdf -> ssa ;
104+ const zend_ssa * ssa = scdf -> ssa ;
105105 DEBUG_PRINT ("Start SCDF solve (%s)\n" , name );
106106 while (!zend_bitset_empty (scdf -> instr_worklist , scdf -> instr_worklist_len )
107107 || !zend_bitset_empty (scdf -> phi_var_worklist , scdf -> phi_var_worklist_len )
@@ -140,7 +140,7 @@ void scdf_solve(scdf_ctx *scdf, const char *name) {
140140 while ((i = zend_bitset_pop_first (scdf -> block_worklist , scdf -> block_worklist_len )) >= 0 ) {
141141 /* This block is now live. Interpret phis and instructions in it. */
142142 zend_basic_block * block = & ssa -> cfg .blocks [i ];
143- zend_ssa_block * ssa_block = & ssa -> blocks [i ];
143+ const zend_ssa_block * ssa_block = & ssa -> blocks [i ];
144144
145145 DEBUG_PRINT ("Pop block %d from worklist\n" , i );
146146 zend_bitset_incl (scdf -> executable_blocks , i );
@@ -185,7 +185,7 @@ void scdf_solve(scdf_ctx *scdf, const char *name) {
185185 * not eliminate the latter. While it cannot be reached, the FREE opcode of the loop var
186186 * is necessary for the correctness of temporary compaction. */
187187static bool is_live_loop_var_free (
188- scdf_ctx * scdf , const zend_op * opline , const zend_ssa_op * ssa_op ) {
188+ const scdf_ctx * scdf , const zend_op * opline , const zend_ssa_op * ssa_op ) {
189189 if (!zend_optimizer_is_loop_var_free (opline )) {
190190 return false;
191191 }
@@ -195,7 +195,7 @@ static bool is_live_loop_var_free(
195195 return false;
196196 }
197197
198- zend_ssa_var * ssa_var = & scdf -> ssa -> vars [var ];
198+ const zend_ssa_var * ssa_var = & scdf -> ssa -> vars [var ];
199199 uint32_t def_block ;
200200 if (ssa_var -> definition >= 0 ) {
201201 def_block = scdf -> ssa -> cfg .map [ssa_var -> definition ];
@@ -205,7 +205,7 @@ static bool is_live_loop_var_free(
205205 return zend_bitset_in (scdf -> executable_blocks , def_block );
206206}
207207
208- static bool kept_alive_by_loop_var_free (scdf_ctx * scdf , const zend_basic_block * block ) {
208+ static bool kept_alive_by_loop_var_free (const scdf_ctx * scdf , const zend_basic_block * block ) {
209209 const zend_op_array * op_array = scdf -> op_array ;
210210 const zend_cfg * cfg = & scdf -> ssa -> cfg ;
211211 if (!(cfg -> flags & ZEND_FUNC_FREE_LOOP_VAR )) {
@@ -220,7 +220,7 @@ static bool kept_alive_by_loop_var_free(scdf_ctx *scdf, const zend_basic_block *
220220 return false;
221221}
222222
223- static uint32_t cleanup_loop_var_free_block (scdf_ctx * scdf , zend_basic_block * block ) {
223+ static uint32_t cleanup_loop_var_free_block (const scdf_ctx * scdf , const zend_basic_block * block ) {
224224 zend_ssa * ssa = scdf -> ssa ;
225225 const zend_op_array * op_array = scdf -> op_array ;
226226 const zend_cfg * cfg = & ssa -> cfg ;
@@ -256,12 +256,12 @@ static uint32_t cleanup_loop_var_free_block(scdf_ctx *scdf, zend_basic_block *bl
256256/* Removes unreachable blocks. This will remove both the instructions (and phis) in the
257257 * blocks, as well as remove them from the successor / predecessor lists and mark them
258258 * unreachable. Blocks already marked unreachable are not removed. */
259- uint32_t scdf_remove_unreachable_blocks (scdf_ctx * scdf ) {
259+ uint32_t scdf_remove_unreachable_blocks (const scdf_ctx * scdf ) {
260260 zend_ssa * ssa = scdf -> ssa ;
261261 int i ;
262262 uint32_t removed_ops = 0 ;
263263 for (i = 0 ; i < ssa -> cfg .blocks_count ; i ++ ) {
264- zend_basic_block * block = & ssa -> cfg .blocks [i ];
264+ const zend_basic_block * block = & ssa -> cfg .blocks [i ];
265265 if (!zend_bitset_in (scdf -> executable_blocks , i ) && (block -> flags & ZEND_BB_REACHABLE )) {
266266 if (!kept_alive_by_loop_var_free (scdf , block )) {
267267 removed_ops += block -> len ;
0 commit comments