Commit fcc74e6
committed
Fix truncated function codegen: safety fallback + entry slice boundary fix
Two fixes for functions that end without jr $ra (issue #86):
1. code_generator.cpp: Emit implicit `ctx->pc = GPR_U32(ctx, 31); return;`
at end of every generated function. For correct functions this is
unreachable dead code. For functions with wrong TOML/CSV boundaries, it
returns via $ra instead of leaving ctx->pc in a bad state that cascades
returns up the entire call chain.
2. ps2_recompiler.cpp: When reslicing entry functions, skip boundary starts
that fall inside the containing parent function. Ghidra sub-functions
(sub_xxx) inside a parent were creating false boundaries that truncated
sibling entry slices before their jr $ra.1 parent 553a902 commit fcc74e6
2 files changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1003 | 1003 | | |
1004 | 1004 | | |
1005 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
1006 | 1012 | | |
1007 | 1013 | | |
1008 | 1014 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
639 | 643 | | |
640 | | - | |
| 644 | + | |
641 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
642 | 653 | | |
| 654 | + | |
643 | 655 | | |
644 | 656 | | |
645 | 657 | | |
| |||
0 commit comments