diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-02-02 19:59:23 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-02-02 19:59:23 +0100 |
| commit | 9b9ecfdedd10fd96322e231a21b9337f050b9128 (patch) | |
| tree | 5fa4694dda60ec52f016755d237c7ac12f408868 /scripts | |
| parent | 930ad1cc4422f19251ea77a625816e3aebcc6eea (diff) | |
| download | tools.nes-9b9ecfdedd10fd96322e231a21b9337f050b9128.tar.gz tools.nes-9b9ecfdedd10fd96322e231a21b9337f050b9128.zip | |
Warn on pointless (un)conditional branching
Sometimes performing some 'jmp'/'jsr' can be quite pointless, and the
programmer might not be fully aware of this because of the layout of the
code. Imagine:
.proc foo
;; code
jmp bar
.endproc
;; Documentation, comments, extra space, etc.
.proc bar
;; whatever
.endproc
The 'jmp' in the code above tries to perform a call stack optimization,
but it's actually not needed because the next instruction after 'jmp' is
the one inside of 'bar', but that's obfuscated because of the layout.
In these sort of cases (and also for 'jsr' and branches) warn the
programmer about it so it can remove that instruction.
Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/test-e2e.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/test-e2e.sh b/scripts/test-e2e.sh index ca4dbbb..2f7ff5f 100755 --- a/scripts/test-e2e.sh +++ b/scripts/test-e2e.sh @@ -71,6 +71,11 @@ echo "test: custom => asan_reserve_constant.nes" diff tests/out/asan_reserve_constant.txt tests/expected/asan_reserve_constant.txt exit_code=$((exit_code + $?)) +echo "test: custom => bad_jal.nes" +./target/debug/nasm -c empty --asan tests/bad_jal.s -o /dev/null 2>tests/out/bad_jal.txt +diff tests/out/bad_jal.txt tests/expected/bad_jal.txt +exit_code=$((exit_code + $?)) + ## # code.nes |
