Lines Matching refs:block
43 static inline void print_block(zend_code_block *block, zend_op *opcodes, char *txt) in print_block() argument
45 …derr, "%sBlock: %d-%d (%d)", txt, block->start_opline - opcodes, block->start_opline - opcodes + b… in print_block()
46 if (!block->access) { in print_block()
49 if (block->op1_to) { in print_block()
50 fprintf(stderr, " 1: %d", block->op1_to->start_opline - opcodes); in print_block()
52 if (block->op2_to) { in print_block()
53 fprintf(stderr, " 2: %d", block->op2_to->start_opline - opcodes); in print_block()
55 if (block->ext_to) { in print_block()
56 fprintf(stderr, " e: %d", block->ext_to->start_opline - opcodes); in print_block()
58 if (block->follow_to) { in print_block()
59 fprintf(stderr, " f: %d", block->follow_to->start_opline - opcodes); in print_block()
62 if (block->sources) { in print_block()
63 zend_block_source *bs = block->sources; in print_block()
430 static void delete_code_block(zend_code_block *block) in delete_code_block() argument
432 if (block->protected) { in delete_code_block()
435 if (block->follow_to) { in delete_code_block()
436 zend_block_source *bs = block->sources; in delete_code_block()
439 zend_code_block *to = block->follow_to; in delete_code_block()
440 if (from_block->op1_to == block) { in delete_code_block()
444 if (from_block->op2_to == block) { in delete_code_block()
448 if (from_block->ext_to == block) { in delete_code_block()
452 if (from_block->follow_to == block) { in delete_code_block()
459 block->access = 0; in delete_code_block()
462 static void zend_access_path(zend_code_block *block) in zend_access_path() argument
464 if (block->access) { in zend_access_path()
468 block->access = 1; in zend_access_path()
469 if (block->op1_to) { in zend_access_path()
470 zend_access_path(block->op1_to); in zend_access_path()
471 ADD_SOURCE(block, block->op1_to); in zend_access_path()
473 if (block->op2_to) { in zend_access_path()
474 zend_access_path(block->op2_to); in zend_access_path()
475 ADD_SOURCE(block, block->op2_to); in zend_access_path()
477 if (block->ext_to) { in zend_access_path()
478 zend_access_path(block->ext_to); in zend_access_path()
479 ADD_SOURCE(block, block->ext_to); in zend_access_path()
481 if (block->follow_to) { in zend_access_path()
482 zend_access_path(block->follow_to); in zend_access_path()
483 ADD_SOURCE(block, block->follow_to); in zend_access_path()
565 static void strip_nop(zend_code_block *block) in strip_nop() argument
567 zend_op *opline = block->start_opline; in strip_nop()
571 while (block->len > 0 && block->start_opline->opcode == ZEND_NOP) { in strip_nop()
572 if (block->len == 1) { in strip_nop()
574 if (block->follow_to) { in strip_nop()
575 delete_code_block(block); in strip_nop()
579 block->start_opline++; in strip_nop()
580 block->start_opline_no++; in strip_nop()
581 block->len--; in strip_nop()
585 opline = new_end = block->start_opline; in strip_nop()
586 end = opline + block->len; in strip_nop()
607 block->len = new_end - block->start_opline; in strip_nop()
610 static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, char *used_ext TSR… in zend_optimize_block() argument
612 zend_op *opline = block->start_opline; in zend_optimize_block()
616 print_block(block, op_array->opcodes, "Opt "); in zend_optimize_block()
619 while (block->len > 0 && block->start_opline->opcode == ZEND_NOP) { in zend_optimize_block()
620 if (block->len == 1) { in zend_optimize_block()
622 if (block->follow_to) { in zend_optimize_block()
623 delete_code_block(block); in zend_optimize_block()
627 block->start_opline++; in zend_optimize_block()
628 block->start_opline_no++; in zend_optimize_block()
629 block->len--; in zend_optimize_block()
636 opline = block->start_opline; in zend_optimize_block()
637 end = opline + block->len; in zend_optimize_block()
741 if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL && in zend_optimize_block()
855 op_b = block->ext_to; in zend_optimize_block()
856 block->ext_to = block->op2_to; in zend_optimize_block()
857 block->op2_to = op_b; in zend_optimize_block()
1187 strip_nop(block); in zend_optimize_block()
1326 static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_array, zend_code_block … in zend_jmp_optimization() argument
1329 zend_op *last_op = (block->start_opline + block->len - 1); in zend_jmp_optimization()
1331 if (!block->len) { in zend_jmp_optimization()
1337 zend_op *target = block->op1_to->start_opline; in zend_jmp_optimization()
1338 zend_code_block *next = block->next; in zend_jmp_optimization()
1346 if (block->op1_to == next) { in zend_jmp_optimization()
1347 block->follow_to = block->op1_to; in zend_jmp_optimization()
1348 block->op1_to = NULL; in zend_jmp_optimization()
1350 block->len--; in zend_jmp_optimization()
1351 if (block->len == 0) { in zend_jmp_optimization()
1353 delete_code_block(block); in zend_jmp_optimization()
1359 block->op1_to != block->op1_to->op1_to) || in zend_jmp_optimization()
1361 !block->op1_to->protected) { in zend_jmp_optimization()
1376 del_source(block, block->op1_to); in zend_jmp_optimization()
1377 if (block->op1_to->op2_to) { in zend_jmp_optimization()
1378 block->op2_to = block->op1_to->op2_to; in zend_jmp_optimization()
1379 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1381 if (block->op1_to->ext_to) { in zend_jmp_optimization()
1382 block->ext_to = block->op1_to->ext_to; in zend_jmp_optimization()
1383 ADD_SOURCE(block, block->ext_to); in zend_jmp_optimization()
1385 if (block->op1_to->op1_to) { in zend_jmp_optimization()
1386 block->op1_to = block->op1_to->op1_to; in zend_jmp_optimization()
1387 ADD_SOURCE(block, block->op1_to); in zend_jmp_optimization()
1389 block->op1_to = NULL; in zend_jmp_optimization()
1412 del_source(block, block->op1_to); in zend_jmp_optimization()
1413 block->op1_to = NULL; in zend_jmp_optimization()
1416 } else if (0&& block->op1_to != block && in zend_jmp_optimization()
1417 block->op1_to != blocks && in zend_jmp_optimization()
1426 zend_block_source *cs = block->op1_to->sources; in zend_jmp_optimization()
1430 if (cs->from->follow_to == block->op1_to) { in zend_jmp_optimization()
1437 next = block->op1_to; in zend_jmp_optimization()
1440 if (next->follow_to == block) { in zend_jmp_optimization()
1449 while (prev->next != block->op1_to) { in zend_jmp_optimization()
1453 next->next = block->next; in zend_jmp_optimization()
1454 block->next = block->op1_to; in zend_jmp_optimization()
1456 block->follow_to = block->op1_to; in zend_jmp_optimization()
1457 block->op1_to = NULL; in zend_jmp_optimization()
1459 block->len--; in zend_jmp_optimization()
1460 if(block->len == 0) { in zend_jmp_optimization()
1462 delete_code_block(block); in zend_jmp_optimization()
1486 block->op1_to = block->op2_to; in zend_jmp_optimization()
1487 del_source(block, block->follow_to); in zend_jmp_optimization()
1488 block->op2_to = NULL; in zend_jmp_optimization()
1489 block->follow_to = NULL; in zend_jmp_optimization()
1493 del_source(block, block->op2_to); in zend_jmp_optimization()
1494 block->op2_to = NULL; in zend_jmp_optimization()
1499 if (block->op2_to) { in zend_jmp_optimization()
1504 zend_code_block *target_block = block->op2_to;; in zend_jmp_optimization()
1525 del_source(block, block->op2_to); in zend_jmp_optimization()
1526 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1527 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1537 del_source(block, block->op2_to); in zend_jmp_optimization()
1538 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1539 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1547 del_source(block, block->op2_to); in zend_jmp_optimization()
1548 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1549 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1554 del_source(block, block->op2_to); in zend_jmp_optimization()
1555 block->op2_to = target_block->op1_to; in zend_jmp_optimization()
1556 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1565 del_source(block, block->op2_to); in zend_jmp_optimization()
1567 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1569 block->op2_to = target_block->ext_to; in zend_jmp_optimization()
1571 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1575 if (block->follow_to && in zend_jmp_optimization()
1581 target = block->follow_to->start_opline; in zend_jmp_optimization()
1582 target_end = block->follow_to->start_opline + block->follow_to->len; in zend_jmp_optimization()
1588 if (target == target_end && ! block->follow_to->protected) { in zend_jmp_optimization()
1589 del_source(block, block->follow_to); in zend_jmp_optimization()
1590 block->follow_to = block->follow_to->follow_to; in zend_jmp_optimization()
1591 ADD_SOURCE(block, block->follow_to); in zend_jmp_optimization()
1598 block->follow_to->op1_to && in zend_jmp_optimization()
1599 !block->follow_to->protected) { in zend_jmp_optimization()
1600 del_source(block, block->follow_to); in zend_jmp_optimization()
1602 block->ext_to = block->follow_to->op1_to; in zend_jmp_optimization()
1603 ADD_SOURCE(block, block->ext_to); in zend_jmp_optimization()
1605 block->ext_to = block->op2_to; in zend_jmp_optimization()
1606 block->op2_to = block->follow_to->op1_to; in zend_jmp_optimization()
1607 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1609 block->follow_to = NULL; in zend_jmp_optimization()
1629 del_source(block, block->op2_to); in zend_jmp_optimization()
1630 block->op2_to = NULL; in zend_jmp_optimization()
1635 if (block->op2_to) { in zend_jmp_optimization()
1654 target_block = block->op2_to; in zend_jmp_optimization()
1671 del_source(block, block->op2_to); in zend_jmp_optimization()
1672 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1673 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1680 del_source(block, block->op2_to); in zend_jmp_optimization()
1681 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1682 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1690 del_source(block, block->op2_to); in zend_jmp_optimization()
1691 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1692 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1700 del_source(block, block->op2_to); in zend_jmp_optimization()
1701 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1702 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1707 del_source(block, block->op2_to); in zend_jmp_optimization()
1708 block->op2_to = target_block->op1_to; in zend_jmp_optimization()
1709 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1717 del_source(block, block->op2_to); in zend_jmp_optimization()
1719 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1721 block->op2_to = target_block->ext_to; in zend_jmp_optimization()
1723 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1732 zend_code_block *next = block->next; in zend_jmp_optimization()
1748 block->op1_to = block->op2_to; in zend_jmp_optimization()
1749 todel = block->ext_to; in zend_jmp_optimization()
1750 block->op2_to = NULL; in zend_jmp_optimization()
1751 block->ext_to = NULL; in zend_jmp_optimization()
1752 del_source(block, todel); in zend_jmp_optimization()
1761 block->op1_to = block->ext_to; in zend_jmp_optimization()
1762 todel = block->op2_to; in zend_jmp_optimization()
1763 block->op2_to = NULL; in zend_jmp_optimization()
1764 block->ext_to = NULL; in zend_jmp_optimization()
1765 del_source(block, todel); in zend_jmp_optimization()
1767 } else if (block->op2_to == block->ext_to) { in zend_jmp_optimization()
1774 block->op1_to = block->op2_to; in zend_jmp_optimization()
1775 block->op2_to = NULL; in zend_jmp_optimization()
1776 block->ext_to = NULL; in zend_jmp_optimization()
1778 } else if (block->op2_to == next) { in zend_jmp_optimization()
1782 block->op2_to = block->ext_to; in zend_jmp_optimization()
1783 block->follow_to = next; in zend_jmp_optimization()
1784 block->ext_to = NULL; in zend_jmp_optimization()
1786 } else if (block->ext_to == next) { in zend_jmp_optimization()
1790 block->follow_to = next; in zend_jmp_optimization()
1791 block->ext_to = NULL; in zend_jmp_optimization()
1795 if (last_op->opcode == ZEND_JMPZNZ && block->op2_to) { in zend_jmp_optimization()
1800 zend_code_block *target_block = block->op2_to; in zend_jmp_optimization()
1819 del_source(block, block->op2_to); in zend_jmp_optimization()
1820 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1821 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1829 del_source(block, block->op2_to); in zend_jmp_optimization()
1830 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1831 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1836 del_source(block, block->op2_to); in zend_jmp_optimization()
1837 block->op2_to = target_block->op1_to; in zend_jmp_optimization()
1838 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1876 static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *used_ext) in zend_t_usage() argument
1878 zend_code_block *next_block = block->next; in zend_t_usage()
1931 while (block) { in zend_t_usage()
1932 zend_op *opline = block->start_opline + block->len - 1; in zend_t_usage()
1934 if (!block->access) { in zend_t_usage()
1935 block = block->next; in zend_t_usage()
1941 while (opline >= block->start_opline) { in zend_t_usage()
2031 block = block->next; in zend_t_usage()