@@ -48,7 +48,7 @@ static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_bloc
4848 } else {
4949 succ -> flags |= ZEND_BB_FOLLOW ;
5050
51- if (cfg -> split_at_calls ) {
51+ if (( cfg -> flags & ZEND_CFG_STACKLESS ) ) {
5252 if (opcode == ZEND_INCLUDE_OR_EVAL ||
5353 opcode == ZEND_GENERATOR_CREATE ||
5454 opcode == ZEND_YIELD ||
@@ -59,7 +59,7 @@ static void zend_mark_reachable(zend_op *opcodes, zend_cfg *cfg, zend_basic_bloc
5959 succ -> flags |= ZEND_BB_ENTRY ;
6060 }
6161 }
62- if (cfg -> split_at_recv ) {
62+ if (( cfg -> flags & ZEND_CFG_RECV_ENTRY ) ) {
6363 if (opcode == ZEND_RECV ||
6464 opcode == ZEND_RECV_INIT ) {
6565 succ -> flags |= ZEND_BB_RECV_ENTRY ;
@@ -149,7 +149,7 @@ static void zend_mark_reachable_blocks(const zend_op_array *op_array, zend_cfg *
149149 b = blocks + block_map [live_range -> end ];
150150 b -> flags |= ZEND_BB_KILL_VAR ;
151151 if (!(b -> flags & (ZEND_BB_REACHABLE |ZEND_BB_UNREACHABLE_FREE ))) {
152- if (cfg -> split_at_live_ranges ) {
152+ if (( cfg -> flags & ZEND_CFG_SPLIT_AT_LIVE_RANGES ) ) {
153153 changed = 1 ;
154154 zend_mark_reachable (op_array -> opcodes , cfg , b );
155155 } else {
@@ -282,7 +282,7 @@ static void initialize_block(zend_basic_block *block) {
282282 block_map[i]++; \
283283 } while (0)
284284
285- int zend_build_cfg (zend_arena * * arena , const zend_op_array * op_array , uint32_t build_flags , zend_cfg * cfg , uint32_t * func_flags ) /* {{{ */
285+ int zend_build_cfg (zend_arena * * arena , const zend_op_array * op_array , uint32_t build_flags , zend_cfg * cfg ) /* {{{ */
286286{
287287 uint32_t flags = 0 ;
288288 uint32_t i ;
@@ -294,17 +294,15 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b
294294 zval * zv ;
295295 zend_bool extra_entry_block = 0 ;
296296
297- cfg -> split_at_live_ranges = (build_flags & ZEND_CFG_SPLIT_AT_LIVE_RANGES ) != 0 ;
298- cfg -> split_at_calls = (build_flags & ZEND_CFG_STACKLESS ) != 0 ;
299- cfg -> split_at_recv = (build_flags & ZEND_CFG_RECV_ENTRY ) != 0 ;
297+ cfg -> flags = build_flags & (ZEND_CFG_SPLIT_AT_LIVE_RANGES |ZEND_CFG_STACKLESS |ZEND_CFG_RECV_ENTRY );
300298
301299 cfg -> map = block_map = zend_arena_calloc (arena , op_array -> last , sizeof (uint32_t ));
302300
303301 /* Build CFG, Step 1: Find basic blocks starts, calculate number of blocks */
304302 BB_START (0 );
305303 for (i = 0 ; i < op_array -> last ; i ++ ) {
306304 zend_op * opline = op_array -> opcodes + i ;
307- switch (opline -> opcode ) {
305+ switch (opline -> opcode ) {
308306 case ZEND_RECV :
309307 case ZEND_RECV_INIT :
310308 if (build_flags & ZEND_CFG_RECV_ENTRY ) {
@@ -443,6 +441,12 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b
443441 case ZEND_FUNC_GET_ARGS :
444442 flags |= ZEND_FUNC_VARARG ;
445443 break ;
444+ case ZEND_EXT_NOP :
445+ case ZEND_EXT_STMT :
446+ case ZEND_EXT_FCALL_BEGIN :
447+ case ZEND_EXT_FCALL_END :
448+ flags |= ZEND_FUNC_HAS_EXTENDED_INFO ;
449+ break ;
446450 }
447451 }
448452
@@ -452,7 +456,7 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b
452456 extra_entry_block = 1 ;
453457 }
454458
455- if (cfg -> split_at_live_ranges ) {
459+ if (( cfg -> flags & ZEND_CFG_SPLIT_AT_LIVE_RANGES ) ) {
456460 for (j = 0 ; j < op_array -> last_live_range ; j ++ ) {
457461 BB_START (op_array -> live_range [j ].start );
458462 BB_START (op_array -> live_range [j ].end );
@@ -600,12 +604,7 @@ int zend_build_cfg(zend_arena **arena, const zend_op_array *op_array, uint32_t b
600604 /* Build CFG, Step 4, Mark Reachable Basic Blocks */
601605 zend_mark_reachable_blocks (op_array , cfg , 0 );
602606
603- cfg -> dynamic = (flags & ZEND_FUNC_INDIRECT_VAR_ACCESS ) != 0 ;
604- cfg -> vararg = (flags & ZEND_FUNC_VARARG ) != 0 ;
605-
606- if (func_flags ) {
607- * func_flags |= flags ;
608- }
607+ cfg -> flags |= flags ;
609608
610609 return SUCCESS ;
611610}
@@ -807,7 +806,7 @@ static void swap_blocks(block_info *a, block_info *b) {
807806 * b = tmp ;
808807}
809808
810- int zend_cfg_identify_loops (const zend_op_array * op_array , zend_cfg * cfg , uint32_t * flags ) /* {{{ */
809+ int zend_cfg_identify_loops (const zend_op_array * op_array , zend_cfg * cfg ) /* {{{ */
811810{
812811 int i , j , k , n ;
813812 int time ;
@@ -913,7 +912,8 @@ int zend_cfg_identify_loops(const zend_op_array *op_array, zend_cfg *cfg, uint32
913912 free_alloca (sorted_blocks , sorted_blocks_use_heap );
914913 free_alloca (entry_times , tree_use_heap );
915914 ZEND_WORKLIST_FREE_ALLOCA (& work , list_use_heap );
916- * flags |= flag ;
915+
916+ cfg -> flags |= flag ;
917917
918918 return SUCCESS ;
919919}
0 commit comments