Skip to content

[AUTOMATED] Follow explicit same-instruction call continuations - #1989

Merged
mahaloz merged 7 commits into
Noelo-Lab:mainfrom
thotypous:kuna-post-call-resume
Nov 26, 2026
Merged

mahaloz merged 7 commits into
Noelo-Lab:mainfrom
thotypous:kuna-post-call-resume

Conversation

@thotypous

@thotypous thotypous commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

A machine instruction can call a helper and then explicitly resume at a non-fallthrough address. If that address also names a function, Kuna emits a false tail call.

On a clean main checkout, apply only the test fixture and run it:

git fetch https://github.com/thotypous/kuna.git kuna-post-call-resume
git diff 477cb29ed FETCH_HEAD -- \
  decompiler/crates/kuna-cli/tests/{integration,post_call_resume}.rs | git apply
cd decompiler
cargo test -p kuna-cli --test integration post_call_resume:: -- --nocapture

The direct and indirect cases emit return direct_resume(); and return indirect_resume();. They should return 0x2a and 0x11 from the resumed instructions.

  • Treat an unconditional branch immediately after a same-instruction call as a continuation. Do not change separate jumps or conditional tail jumps.
  • Four cases cover direct and indirect resumes and both kinds of genuine tail jumps. Only the two resumes fail on main.
  • No changes across DecBench (770 binaries) or the multi-ISA Debian corpus (146 binaries, 13 ABIs).

Dependency for the Carmel PR (#1936): this follows a call’s encoded resume edge during lifting.

Model: openai-codex/gpt-6.2-sol

thotypous and others added 4 commits November 26, 2026 06:51
An unconditional branch immediately after a call in the same instruction is its resume edge. Keep conditional tails and separately encoded tail jumps eligible.
…e the rule applies

A `ta 0x10` in the delay slot of `ba` lifts to the trap's call followed by
the branch's goto, the one vendored-ISA shape the rule changes. The new
stage test declares a function at the branch target and checks that the
trap prints once and the resumed code's value is returned (it fails on
main). Spec 02 now names the code path, the CALLOTHER and no-return
cases, and the SPARC trap case, including its limit when the target is
genuinely another function.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Resolves the stage-corpus count (935) and merges baseline-stages.json key by
key: main's assertions plus this PR's three SPARC-TRAP-RESUME keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
@mahaloz

mahaloz commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] Pushed three commits on top of 0071858; the code change is untouched.

  • Merged origin/main twice (5eaefeb, then a7aa028). The second merge resolves the stage-corpus count (935) and docs/baseline-stages.json.
  • Added tests/stages/kuna-sparc-trap-resume.xml, a real-ISA case for the rule. No vendored constructor emits call then goto; SPARC call resumes through a CBRANCH. A SPARC ta 0x10 in the delay slot of ba does lift to call [sw_trap(..)]; goto <target>. With a function declared at the target, main prints a call to it and loses the resumed return 3;. This PR prints the trap once and then return 3;. The test fails on main and passes here.
  • Spec 02 now names FlowInfo::tail_call_kind and the CALLOTHER and no-return cases. It also notes the limit: when a delay-slot trap's branch target really is another function, flow now walks into that function's body instead of printing a tail call.

functions and decompile-all are byte-identical to the parent on 357 Debian SPARC32/64 images and on 257 x86-64/ARM/MIPS/PPC/AArch64/PE/i386 images.

mahaloz and others added 3 commits November 26, 2026 11:23
Resolves the stage-corpus count (936) and re-records
docs/baseline-stages.json on the merged tree: main's 5,536 assertions plus
this PR's three SPARC-TRAP-RESUME keys (5,539).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Resolves the stage-corpus count (937) and re-records
docs/baseline-stages.json on the merged tree: main's 5,540 assertions plus
this PR's three SPARC-TRAP-RESUME keys (5,543).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Keeps the stage-corpus count at 937 and re-records
docs/baseline-stages.json on the merged tree: main's 5,542 assertions plus
this PR's three SPARC-TRAP-RESUME keys (5,545).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
@mahaloz
mahaloz merged commit 767ec55 into Noelo-Lab:main Nov 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants