@@ -1273,24 +1273,23 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
1273
1273
// op_1: VERIFY_RETURN_TYPE #orig_var.? [T] -> #v.? [T] => NOP
1274
1274
1275
1275
int orig_var = ssa -> ops [op_1 ].op1_use ;
1276
- if ( zend_ssa_unlink_use_chain (ssa , op_1 , orig_var )) {
1276
+ zend_ssa_unlink_use_chain (ssa , op_1 , orig_var );
1277
1277
1278
- int ret = ssa -> vars [v ].use_chain ;
1279
- if (ret >= 0 ) {
1280
- ssa -> ops [ret ].op1_use = orig_var ;
1281
- ssa -> ops [ret ].op1_use_chain = ssa -> vars [orig_var ].use_chain ;
1282
- ssa -> vars [orig_var ].use_chain = ret ;
1283
- }
1278
+ int ret = ssa -> vars [v ].use_chain ;
1279
+ if (ret >= 0 ) {
1280
+ ssa -> ops [ret ].op1_use = orig_var ;
1281
+ ssa -> ops [ret ].op1_use_chain = ssa -> vars [orig_var ].use_chain ;
1282
+ ssa -> vars [orig_var ].use_chain = ret ;
1283
+ }
1284
1284
1285
- ssa -> vars [v ].definition = -1 ;
1286
- ssa -> vars [v ].use_chain = -1 ;
1285
+ ssa -> vars [v ].definition = -1 ;
1286
+ ssa -> vars [v ].use_chain = -1 ;
1287
1287
1288
- ssa -> ops [op_1 ].op1_def = -1 ;
1289
- ssa -> ops [op_1 ].op1_use = -1 ;
1288
+ ssa -> ops [op_1 ].op1_def = -1 ;
1289
+ ssa -> ops [op_1 ].op1_use = -1 ;
1290
1290
1291
- MAKE_NOP (opline );
1292
- remove_nops = 1 ;
1293
- }
1291
+ MAKE_NOP (opline );
1292
+ remove_nops = 1 ;
1294
1293
}
1295
1294
}
1296
1295
@@ -1322,7 +1321,8 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
1322
1321
// op_2: #src_var.T = OP ... => #v.CV = OP ...
1323
1322
// op_1: QM_ASSIGN #src_var.T #orig_var.CV [undef,scalar] -> #v.CV, NOP
1324
1323
1325
- if (orig_var < 0 || zend_ssa_unlink_use_chain (ssa , op_1 , orig_var )) {
1324
+ if (orig_var < 0 ) {
1325
+ zend_ssa_unlink_use_chain (ssa , op_1 , orig_var );
1326
1326
/* Reconstruct SSA */
1327
1327
ssa -> vars [v ].definition = op_2 ;
1328
1328
ssa -> ops [op_2 ].result_def = v ;
@@ -1476,80 +1476,79 @@ void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx
1476
1476
// op_2: #src_var.T = OP ... => #v.CV = OP ...
1477
1477
// op_1: ASSIGN #orig_var.CV [undef,scalar] -> #v.CV, #src_var.T NOP
1478
1478
1479
- if ( zend_ssa_unlink_use_chain (ssa , op_1 , orig_var )) {
1480
- /* Reconstruct SSA */
1481
- ssa -> vars [v ].definition = op_2 ;
1482
- ssa -> ops [op_2 ].result_def = v ;
1479
+ zend_ssa_unlink_use_chain (ssa , op_1 , orig_var );
1480
+ /* Reconstruct SSA */
1481
+ ssa -> vars [v ].definition = op_2 ;
1482
+ ssa -> ops [op_2 ].result_def = v ;
1483
1483
1484
- ssa -> vars [src_var ].definition = -1 ;
1485
- ssa -> vars [src_var ].use_chain = -1 ;
1484
+ ssa -> vars [src_var ].definition = -1 ;
1485
+ ssa -> vars [src_var ].use_chain = -1 ;
1486
1486
1487
- ssa -> ops [op_1 ].op1_use = -1 ;
1488
- ssa -> ops [op_1 ].op2_use = -1 ;
1489
- ssa -> ops [op_1 ].op1_def = -1 ;
1490
- ssa -> ops [op_1 ].op1_use_chain = -1 ;
1487
+ ssa -> ops [op_1 ].op1_use = -1 ;
1488
+ ssa -> ops [op_1 ].op2_use = -1 ;
1489
+ ssa -> ops [op_1 ].op1_def = -1 ;
1490
+ ssa -> ops [op_1 ].op1_use_chain = -1 ;
1491
1491
1492
- /* Update opcodes */
1493
- op_array -> opcodes [op_2 ].result_type = opline -> op1_type ;
1494
- op_array -> opcodes [op_2 ].result .var = opline -> op1 .var ;
1492
+ /* Update opcodes */
1493
+ op_array -> opcodes [op_2 ].result_type = opline -> op1_type ;
1494
+ op_array -> opcodes [op_2 ].result .var = opline -> op1 .var ;
1495
1495
1496
- MAKE_NOP (opline );
1497
- remove_nops = 1 ;
1498
-
1499
- if (op_array -> opcodes [op_2 ].opcode == ZEND_SUB
1500
- && op_array -> opcodes [op_2 ].op1_type == op_array -> opcodes [op_2 ].result_type
1501
- && op_array -> opcodes [op_2 ].op1 .var == op_array -> opcodes [op_2 ].result .var
1502
- && op_array -> opcodes [op_2 ].op2_type == IS_CONST
1503
- && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == IS_LONG
1504
- && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == 1
1505
- && ssa -> ops [op_2 ].op1_use >= 0
1506
- && !(ssa -> var_info [ssa -> ops [op_2 ].op1_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1507
-
1508
- op_array -> opcodes [op_2 ].opcode = ZEND_PRE_DEC ;
1509
- SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1510
- SET_UNUSED (op_array -> opcodes [op_2 ].result );
1511
-
1512
- ssa -> ops [op_2 ].result_def = -1 ;
1513
- ssa -> ops [op_2 ].op1_def = v ;
1514
-
1515
- } else if (op_array -> opcodes [op_2 ].opcode == ZEND_ADD
1516
- && op_array -> opcodes [op_2 ].op1_type == op_array -> opcodes [op_2 ].result_type
1517
- && op_array -> opcodes [op_2 ].op1 .var == op_array -> opcodes [op_2 ].result .var
1518
- && op_array -> opcodes [op_2 ].op2_type == IS_CONST
1519
- && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == IS_LONG
1520
- && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == 1
1521
- && ssa -> ops [op_2 ].op1_use >= 0
1522
- && !(ssa -> var_info [ssa -> ops [op_2 ].op1_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1523
-
1524
- op_array -> opcodes [op_2 ].opcode = ZEND_PRE_INC ;
1525
- SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1526
- SET_UNUSED (op_array -> opcodes [op_2 ].result );
1527
-
1528
- ssa -> ops [op_2 ].result_def = -1 ;
1529
- ssa -> ops [op_2 ].op1_def = v ;
1530
-
1531
- } else if (op_array -> opcodes [op_2 ].opcode == ZEND_ADD
1532
- && op_array -> opcodes [op_2 ].op2_type == op_array -> opcodes [op_2 ].result_type
1533
- && op_array -> opcodes [op_2 ].op2 .var == op_array -> opcodes [op_2 ].result .var
1534
- && op_array -> opcodes [op_2 ].op1_type == IS_CONST
1535
- && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op1 .constant )) == IS_LONG
1536
- && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op1 .constant )) == 1
1537
- && ssa -> ops [op_2 ].op2_use >= 0
1538
- && !(ssa -> var_info [ssa -> ops [op_2 ].op2_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1539
-
1540
- op_array -> opcodes [op_2 ].opcode = ZEND_PRE_INC ;
1541
- op_array -> opcodes [op_2 ].op1_type = op_array -> opcodes [op_2 ].op2_type ;
1542
- op_array -> opcodes [op_2 ].op1 .var = op_array -> opcodes [op_2 ].op2 .var ;
1543
- SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1544
- SET_UNUSED (op_array -> opcodes [op_2 ].result );
1545
-
1546
- ssa -> ops [op_2 ].result_def = -1 ;
1547
- ssa -> ops [op_2 ].op1_def = v ;
1548
- ssa -> ops [op_2 ].op1_use = ssa -> ops [op_2 ].op2_use ;
1549
- ssa -> ops [op_2 ].op1_use_chain = ssa -> ops [op_2 ].op2_use_chain ;
1550
- ssa -> ops [op_2 ].op2_use = -1 ;
1551
- ssa -> ops [op_2 ].op2_use_chain = -1 ;
1552
- }
1496
+ MAKE_NOP (opline );
1497
+ remove_nops = 1 ;
1498
+
1499
+ if (op_array -> opcodes [op_2 ].opcode == ZEND_SUB
1500
+ && op_array -> opcodes [op_2 ].op1_type == op_array -> opcodes [op_2 ].result_type
1501
+ && op_array -> opcodes [op_2 ].op1 .var == op_array -> opcodes [op_2 ].result .var
1502
+ && op_array -> opcodes [op_2 ].op2_type == IS_CONST
1503
+ && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == IS_LONG
1504
+ && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == 1
1505
+ && ssa -> ops [op_2 ].op1_use >= 0
1506
+ && !(ssa -> var_info [ssa -> ops [op_2 ].op1_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1507
+
1508
+ op_array -> opcodes [op_2 ].opcode = ZEND_PRE_DEC ;
1509
+ SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1510
+ SET_UNUSED (op_array -> opcodes [op_2 ].result );
1511
+
1512
+ ssa -> ops [op_2 ].result_def = -1 ;
1513
+ ssa -> ops [op_2 ].op1_def = v ;
1514
+
1515
+ } else if (op_array -> opcodes [op_2 ].opcode == ZEND_ADD
1516
+ && op_array -> opcodes [op_2 ].op1_type == op_array -> opcodes [op_2 ].result_type
1517
+ && op_array -> opcodes [op_2 ].op1 .var == op_array -> opcodes [op_2 ].result .var
1518
+ && op_array -> opcodes [op_2 ].op2_type == IS_CONST
1519
+ && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == IS_LONG
1520
+ && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op2 .constant )) == 1
1521
+ && ssa -> ops [op_2 ].op1_use >= 0
1522
+ && !(ssa -> var_info [ssa -> ops [op_2 ].op1_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1523
+
1524
+ op_array -> opcodes [op_2 ].opcode = ZEND_PRE_INC ;
1525
+ SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1526
+ SET_UNUSED (op_array -> opcodes [op_2 ].result );
1527
+
1528
+ ssa -> ops [op_2 ].result_def = -1 ;
1529
+ ssa -> ops [op_2 ].op1_def = v ;
1530
+
1531
+ } else if (op_array -> opcodes [op_2 ].opcode == ZEND_ADD
1532
+ && op_array -> opcodes [op_2 ].op2_type == op_array -> opcodes [op_2 ].result_type
1533
+ && op_array -> opcodes [op_2 ].op2 .var == op_array -> opcodes [op_2 ].result .var
1534
+ && op_array -> opcodes [op_2 ].op1_type == IS_CONST
1535
+ && Z_TYPE_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op1 .constant )) == IS_LONG
1536
+ && Z_LVAL_P (CT_CONSTANT_EX (op_array , op_array -> opcodes [op_2 ].op1 .constant )) == 1
1537
+ && ssa -> ops [op_2 ].op2_use >= 0
1538
+ && !(ssa -> var_info [ssa -> ops [op_2 ].op2_use ].type & (MAY_BE_FALSE |MAY_BE_TRUE |MAY_BE_STRING |MAY_BE_ARRAY |MAY_BE_OBJECT |MAY_BE_RESOURCE |MAY_BE_REF ))) {
1539
+
1540
+ op_array -> opcodes [op_2 ].opcode = ZEND_PRE_INC ;
1541
+ op_array -> opcodes [op_2 ].op1_type = op_array -> opcodes [op_2 ].op2_type ;
1542
+ op_array -> opcodes [op_2 ].op1 .var = op_array -> opcodes [op_2 ].op2 .var ;
1543
+ SET_UNUSED (op_array -> opcodes [op_2 ].op2 );
1544
+ SET_UNUSED (op_array -> opcodes [op_2 ].result );
1545
+
1546
+ ssa -> ops [op_2 ].result_def = -1 ;
1547
+ ssa -> ops [op_2 ].op1_def = v ;
1548
+ ssa -> ops [op_2 ].op1_use = ssa -> ops [op_2 ].op2_use ;
1549
+ ssa -> ops [op_2 ].op1_use_chain = ssa -> ops [op_2 ].op2_use_chain ;
1550
+ ssa -> ops [op_2 ].op2_use = -1 ;
1551
+ ssa -> ops [op_2 ].op2_use_chain = -1 ;
1553
1552
}
1554
1553
} else if (opline -> op2_type == IS_CONST
1555
1554
|| ((opline -> op2_type & (IS_TMP_VAR |IS_VAR |IS_CV ))
0 commit comments