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()
426 static void delete_code_block(zend_code_block *block) in delete_code_block() argument
428 if (block->protected) { in delete_code_block()
431 if (block->follow_to) { in delete_code_block()
432 zend_block_source *bs = block->sources; in delete_code_block()
435 zend_code_block *to = block->follow_to; in delete_code_block()
436 if (from_block->op1_to == block) { in delete_code_block()
440 if (from_block->op2_to == block) { in delete_code_block()
444 if (from_block->ext_to == block) { in delete_code_block()
448 if (from_block->follow_to == block) { in delete_code_block()
455 block->access = 0; in delete_code_block()
458 static void zend_access_path(zend_code_block *block) in zend_access_path() argument
460 if (block->access) { in zend_access_path()
464 block->access = 1; in zend_access_path()
465 if (block->op1_to) { in zend_access_path()
466 zend_access_path(block->op1_to); in zend_access_path()
467 ADD_SOURCE(block, block->op1_to); in zend_access_path()
469 if (block->op2_to) { in zend_access_path()
470 zend_access_path(block->op2_to); in zend_access_path()
471 ADD_SOURCE(block, block->op2_to); in zend_access_path()
473 if (block->ext_to) { in zend_access_path()
474 zend_access_path(block->ext_to); in zend_access_path()
475 ADD_SOURCE(block, block->ext_to); in zend_access_path()
477 if (block->follow_to) { in zend_access_path()
478 zend_access_path(block->follow_to); in zend_access_path()
479 ADD_SOURCE(block, block->follow_to); in zend_access_path()
561 static void strip_nop(zend_code_block *block) in strip_nop() argument
563 zend_op *opline = block->start_opline; in strip_nop()
567 while (block->len > 0 && block->start_opline->opcode == ZEND_NOP) { in strip_nop()
568 if (block->len == 1) { in strip_nop()
570 if (block->follow_to) { in strip_nop()
571 delete_code_block(block); in strip_nop()
575 block->start_opline++; in strip_nop()
576 block->start_opline_no++; in strip_nop()
577 block->len--; in strip_nop()
581 opline = new_end = block->start_opline; in strip_nop()
582 end = opline + block->len; in strip_nop()
603 block->len = new_end - block->start_opline; in strip_nop()
606 static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, char *used_ext TSR… in zend_optimize_block() argument
608 zend_op *opline = block->start_opline; in zend_optimize_block()
612 print_block(block, op_array->opcodes, "Opt "); in zend_optimize_block()
615 while (block->len > 0 && block->start_opline->opcode == ZEND_NOP) { in zend_optimize_block()
616 if (block->len == 1) { in zend_optimize_block()
618 if (block->follow_to) { in zend_optimize_block()
619 delete_code_block(block); in zend_optimize_block()
623 block->start_opline++; in zend_optimize_block()
624 block->start_opline_no++; in zend_optimize_block()
625 block->len--; in zend_optimize_block()
632 opline = block->start_opline; in zend_optimize_block()
633 end = opline + block->len; in zend_optimize_block()
734 if(sv >= block->start_opline && sv->opcode == ZEND_SEND_VAL && in zend_optimize_block()
848 op_b = block->ext_to; in zend_optimize_block()
849 block->ext_to = block->op2_to; in zend_optimize_block()
850 block->op2_to = op_b; in zend_optimize_block()
1180 strip_nop(block); in zend_optimize_block()
1319 static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_array, zend_code_block … in zend_jmp_optimization() argument
1322 zend_op *last_op = (block->start_opline + block->len - 1); in zend_jmp_optimization()
1324 if (!block->len) { in zend_jmp_optimization()
1330 zend_op *target = block->op1_to->start_opline; in zend_jmp_optimization()
1331 zend_code_block *next = block->next; in zend_jmp_optimization()
1339 if (block->op1_to == next) { in zend_jmp_optimization()
1340 block->follow_to = block->op1_to; in zend_jmp_optimization()
1341 block->op1_to = NULL; in zend_jmp_optimization()
1343 block->len--; in zend_jmp_optimization()
1344 if (block->len == 0) { in zend_jmp_optimization()
1346 delete_code_block(block); in zend_jmp_optimization()
1352 block->op1_to != block->op1_to->op1_to) || in zend_jmp_optimization()
1354 !block->op1_to->protected) { in zend_jmp_optimization()
1369 del_source(block, block->op1_to); in zend_jmp_optimization()
1370 if (block->op1_to->op2_to) { in zend_jmp_optimization()
1371 block->op2_to = block->op1_to->op2_to; in zend_jmp_optimization()
1372 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1374 if (block->op1_to->ext_to) { in zend_jmp_optimization()
1375 block->ext_to = block->op1_to->ext_to; in zend_jmp_optimization()
1376 ADD_SOURCE(block, block->ext_to); in zend_jmp_optimization()
1378 if (block->op1_to->op1_to) { in zend_jmp_optimization()
1379 block->op1_to = block->op1_to->op1_to; in zend_jmp_optimization()
1380 ADD_SOURCE(block, block->op1_to); in zend_jmp_optimization()
1382 block->op1_to = NULL; in zend_jmp_optimization()
1405 del_source(block, block->op1_to); in zend_jmp_optimization()
1406 block->op1_to = NULL; in zend_jmp_optimization()
1409 } else if (0&& block->op1_to != block && in zend_jmp_optimization()
1410 block->op1_to != blocks && in zend_jmp_optimization()
1419 zend_block_source *cs = block->op1_to->sources; in zend_jmp_optimization()
1423 if (cs->from->follow_to == block->op1_to) { in zend_jmp_optimization()
1430 next = block->op1_to; in zend_jmp_optimization()
1433 if (next->follow_to == block) { in zend_jmp_optimization()
1442 while (prev->next != block->op1_to) { in zend_jmp_optimization()
1446 next->next = block->next; in zend_jmp_optimization()
1447 block->next = block->op1_to; in zend_jmp_optimization()
1449 block->follow_to = block->op1_to; in zend_jmp_optimization()
1450 block->op1_to = NULL; in zend_jmp_optimization()
1452 block->len--; in zend_jmp_optimization()
1453 if(block->len == 0) { in zend_jmp_optimization()
1455 delete_code_block(block); in zend_jmp_optimization()
1479 block->op1_to = block->op2_to; in zend_jmp_optimization()
1480 del_source(block, block->follow_to); in zend_jmp_optimization()
1481 block->op2_to = NULL; in zend_jmp_optimization()
1482 block->follow_to = NULL; in zend_jmp_optimization()
1486 del_source(block, block->op2_to); in zend_jmp_optimization()
1487 block->op2_to = NULL; in zend_jmp_optimization()
1492 if (block->op2_to) { in zend_jmp_optimization()
1497 zend_code_block *target_block = block->op2_to;; in zend_jmp_optimization()
1518 del_source(block, block->op2_to); in zend_jmp_optimization()
1519 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1520 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1530 del_source(block, block->op2_to); in zend_jmp_optimization()
1531 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1532 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1540 del_source(block, block->op2_to); in zend_jmp_optimization()
1541 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1542 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->op1_to; in zend_jmp_optimization()
1549 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1558 del_source(block, block->op2_to); in zend_jmp_optimization()
1560 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1562 block->op2_to = target_block->ext_to; in zend_jmp_optimization()
1564 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1568 if (block->follow_to && in zend_jmp_optimization()
1574 target = block->follow_to->start_opline; in zend_jmp_optimization()
1575 target_end = block->follow_to->start_opline + block->follow_to->len; in zend_jmp_optimization()
1582 del_source(block, block->follow_to); in zend_jmp_optimization()
1583 block->follow_to = block->follow_to->follow_to; in zend_jmp_optimization()
1584 ADD_SOURCE(block, block->follow_to); in zend_jmp_optimization()
1591 block->follow_to->op1_to && in zend_jmp_optimization()
1592 !block->follow_to->protected) { in zend_jmp_optimization()
1593 del_source(block, block->follow_to); in zend_jmp_optimization()
1595 block->ext_to = block->follow_to->op1_to; in zend_jmp_optimization()
1596 ADD_SOURCE(block, block->ext_to); in zend_jmp_optimization()
1598 block->ext_to = block->op2_to; in zend_jmp_optimization()
1599 block->op2_to = block->follow_to->op1_to; in zend_jmp_optimization()
1600 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1602 block->follow_to = NULL; in zend_jmp_optimization()
1622 del_source(block, block->op2_to); in zend_jmp_optimization()
1623 block->op2_to = NULL; in zend_jmp_optimization()
1628 if (block->op2_to) { in zend_jmp_optimization()
1647 target_block = block->op2_to; in zend_jmp_optimization()
1664 del_source(block, block->op2_to); in zend_jmp_optimization()
1665 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1666 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1673 del_source(block, block->op2_to); in zend_jmp_optimization()
1674 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1675 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1683 del_source(block, block->op2_to); in zend_jmp_optimization()
1684 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1685 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1693 del_source(block, block->op2_to); in zend_jmp_optimization()
1694 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1695 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->op1_to; in zend_jmp_optimization()
1702 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1710 del_source(block, block->op2_to); in zend_jmp_optimization()
1712 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1714 block->op2_to = target_block->ext_to; in zend_jmp_optimization()
1716 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1725 zend_code_block *next = block->next; in zend_jmp_optimization()
1741 block->op1_to = block->op2_to; in zend_jmp_optimization()
1742 todel = block->ext_to; in zend_jmp_optimization()
1743 block->op2_to = NULL; in zend_jmp_optimization()
1744 block->ext_to = NULL; in zend_jmp_optimization()
1745 del_source(block, todel); in zend_jmp_optimization()
1754 block->op1_to = block->ext_to; in zend_jmp_optimization()
1755 todel = block->op2_to; in zend_jmp_optimization()
1756 block->op2_to = NULL; in zend_jmp_optimization()
1757 block->ext_to = NULL; in zend_jmp_optimization()
1758 del_source(block, todel); in zend_jmp_optimization()
1760 } else if (block->op2_to == block->ext_to) { in zend_jmp_optimization()
1767 block->op1_to = block->op2_to; in zend_jmp_optimization()
1768 block->op2_to = NULL; in zend_jmp_optimization()
1769 block->ext_to = NULL; in zend_jmp_optimization()
1771 } else if (block->op2_to == next) { in zend_jmp_optimization()
1775 block->op2_to = block->ext_to; in zend_jmp_optimization()
1776 block->follow_to = next; in zend_jmp_optimization()
1777 block->ext_to = NULL; in zend_jmp_optimization()
1779 } else if (block->ext_to == next) { in zend_jmp_optimization()
1783 block->follow_to = next; in zend_jmp_optimization()
1784 block->ext_to = NULL; in zend_jmp_optimization()
1788 if (last_op->opcode == ZEND_JMPZNZ && block->op2_to) { in zend_jmp_optimization()
1793 zend_code_block *target_block = block->op2_to; in zend_jmp_optimization()
1812 del_source(block, block->op2_to); in zend_jmp_optimization()
1813 block->op2_to = target_block->op2_to; in zend_jmp_optimization()
1814 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1822 del_source(block, block->op2_to); in zend_jmp_optimization()
1823 block->op2_to = target_block->follow_to; in zend_jmp_optimization()
1824 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->op1_to; in zend_jmp_optimization()
1831 ADD_SOURCE(block, block->op2_to); in zend_jmp_optimization()
1869 static void zend_t_usage(zend_code_block *block, zend_op_array *op_array, char *used_ext) in zend_t_usage() argument
1871 zend_code_block *next_block = block->next; in zend_t_usage()
1921 while (block) { in zend_t_usage()
1922 zend_op *opline = block->start_opline + block->len - 1; in zend_t_usage()
1924 if (!block->access) { in zend_t_usage()
1925 block = block->next; in zend_t_usage()
1931 while (opline >= block->start_opline) { in zend_t_usage()
2018 block = block->next; in zend_t_usage()