This is an archive of the discontinued LLVM Phabricator instance.

AArch64: change the location of the Swift async frame record
ClosedPublic

Authored by compnerd on Apr 26 2022, 8:16 PM.

Details

Summary

The frame layout on Windows differs from that on other platforms. It
will spill the registers in descending numeric value (i.e. x30, x29,
...). Furthermore, the x29, x30 pair is particularly important as it
is used for the fast stack walking. As a result, we cannot simply
insert the Swift async frame record in between the store. To provide
the simplistic search mechanism, always spill the async frame record
prior to the spilled registers.

This was caught by the assertion failure in the frame lowering code when
building the runtime for Windows AArch64.

Diff Detail

Event Timeline

compnerd created this revision.Apr 26 2022, 8:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 26 2022, 8:16 PM
compnerd requested review of this revision.Apr 26 2022, 8:16 PM
mstorsjo accepted this revision.Apr 26 2022, 11:20 PM

LGTM, but I think it'd be good to mention Windows in the commit message subject too, not only in the body of the commit message.

Also, the commit message mentions that Windows prologues store x30, x29 ... in descending numerical order on the stack - while the testcase you add actually doesn't - this threw me off for a bit. But since the function is marked nounwind, it doesn't apply those changes but keeps things more like on other platforms here. (Also, if the nounwind attribute is removed, the function probably isn't unwindable by the Windows unwinder anyway, due to orr x29, x29, #0x1000000000000000 which can't be mapped to any SEH unwind opcode.)

This revision is now accepted and ready to land.Apr 26 2022, 11:20 PM

Oh, also, please reference the bug https://github.com/llvm/llvm-project/issues/55058 in the commit message!

This revision was landed with ongoing or failed builds.Apr 30 2022, 9:24 AM
This revision was automatically updated to reflect the committed changes.