(op: parser.CodeDef)
| 817 | |
| 818 | |
| 819 | def always_exits(op: parser.CodeDef) -> bool: |
| 820 | depth = 0 |
| 821 | tkn_iter = iter(op.tokens) |
| 822 | for tkn in tkn_iter: |
| 823 | if tkn.kind == "LBRACE": |
| 824 | depth += 1 |
| 825 | elif tkn.kind == "RBRACE": |
| 826 | depth -= 1 |
| 827 | elif depth > 1: |
| 828 | continue |
| 829 | elif tkn.kind == "GOTO" or tkn.kind == "RETURN": |
| 830 | return True |
| 831 | elif tkn.kind == "KEYWORD": |
| 832 | if tkn.text in EXITS: |
| 833 | return True |
| 834 | elif tkn.kind == "IDENTIFIER": |
| 835 | if tkn.text in EXITS: |
| 836 | return True |
| 837 | if tkn.text == "DEOPT_IF" or tkn.text == "ERROR_IF": |
| 838 | next(tkn_iter) # '(' |
| 839 | t = next(tkn_iter) |
| 840 | if t.text in ("true", "1"): |
| 841 | return True |
| 842 | return False |
| 843 | |
| 844 | |
| 845 | def stack_effect_only_peeks(instr: parser.InstDef) -> bool: |
no outgoing calls
no test coverage detected
searching dependent graphs…