Repository navigation
[AUTOMATED] Pass a call's result on to the tail call that reads it - #1908
Conversation
AArch64 `bl h; b g` is `return g(h(a0))`, but kuna printed
`int f(void) { h(); return g(); }` for a single function (and
`h(a0); return g();` in decompile-all): the tail call returned a value
computed from no argument.
passthrough now also claims a register at a call whose previous direct
call's callee states its result there, when the later callee's stated
parameter lies inside it; heritage links the read to the earlier call's
output. The protoorder single-function bootstrap also states the callee
just before each tail call to a callee that takes a parameter, within the
existing budget of four.
Automated change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
f1577fb to
79e8d98
Compare
…tailcallees stage comment Since the forwarded-register change merged, a single-function decompile already passes a0 to _helper; what it still lacked was _helper's result at the tail call. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
…ee's first register is one the function never touches The single-function and narrowed drive stated the callee before every tail call to a callee with a parameter. The result can only be handed on when the tail callee's first parameter register is untouched by the function (the passthrough claim's own precondition), so elsewhere, e.g. every x86-64 integer tail call, the extra statement only retyped the rest of the function, and in a narrowed batch it carried over to later functions. Gate the feeder statement on that precondition. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
|
[AUTOMATED] Pushed on top of 79e8d98: c124a2a (docs), 30b4bc0 (a narrower feeder statement), and two merges of current main (5f4505f, 12c8676). Only What changed in the drive. The single-function and narrowed drive stated the callee before every tail call to a callee with a parameter. That callee's result can only be passed on when the tail callee's first parameter register is one the function never touches, which is the claim's own precondition. Everywhere else, including every x86-64 integer tail call ( Measured on
Whole-binary |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b # Conflicts: # docs/baseline-stages.json
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013BBaWTdjVzTz11WxPZmJ9b
A function that calls
hand then tail-callsgwithh's result (AArch64bl h; b g, which isreturn g(h(a0))) drops the link between them:h's result is discarded andgis called with nothing, while the function returnsg's result._helperand_helper2each take anintinw0and return one.decompile-allprints the same two calls.The fix:
passthroughalso claims a register at a call whose previous direct call's callee states its result in that register, when the later callee's stated parameter lies inside it. Heritage then links the read to the earlier call's output, which becomes that call's result.decompile-all) now also states the callee just before each tail call to a callee that takes a parameter, within the existing budget of four, so the earlier call's result is known there too. A tail call that takes nothing, such as__stack_chk_fail, adds nothing.Now:
Tests:
tests/stages/kuna-protoorder-tailcallees.xmlgains two_tail_authpasses (passthrough offkeeps the argument-less calls, the default pins the chain);kuna-ptrauthtrap.xml's_tail_authassertions now pin the arguments. Whole-binarydecompile-allof macOSless(arm64e) is byte-identical at the same cost; a--limit 500run costs 1.3% more instructions onlessand 0.1% onzip, and the 64 changed lines move toward the whole-binary output.🤖 Generated with Claude Code
Model:
claude-opus-5-5