[Go] Emit GoObj entry and stack-growth maps - #75
Conversation
|
Hello @zhouguangyuan0718 👋 Thank you for submitting a Pull Request (PR) to the LLVM Project. Since this is your first PR, here are a few useful links covering our main contribution policies and review practices.
Please reply to this message to confirm that you have read these policies, especially the LLVM AI Tool Use Policy, and that any AI tool usage has been noted in the PR description. Frequently asked questionsHow do I add reviewers? This PR will be automatically labeled, and the relevant teams will be notified. For some parts of the project, reviewers may also be added automatically. You can also add reviewers manually using the Reviewers section on this page. If you cannot use that section, it is probably because you do not have write permissions for the repository. In that case, you can request a review by tagging reviewers in a comment using What if there are no comments? If you have not received any comments on your PR after a week, you can request a review by pinging the PR with a comment such as “Ping”. The common courtesy ping rate is once a week. Please remember that you are asking for volunteer time from other developers. Are any special GitHub settings required to contribute to LLVM? We only require contributors to have a public email address associated with their GitHub commits, see this section of LLVM Developer Policy for details. If you have questions, feel free to leave a comment on this PR, or ask on LLVM Discord or LLVM Discourse. Thank you, |
ac6ae73 to
aa55715
Compare
9743f08 to
c859054
Compare
8c41777 to
b0fe7aa
Compare
c859054 to
a0fbb6d
Compare
b0fe7aa to
e16ab84
Compare
a0fbb6d to
f6436d9
Compare
e16ab84 to
f931e51
Compare
f6436d9 to
c2800d8
Compare
f931e51 to
94a25ae
Compare
## Summary - use `go-nosplit` as the sole opt-out from the native Go stack check; split functions call `runtime.morestack*<ABI0>` with an ordinary target call - emit one function-level `EntryArgsStackMapID` record for every GoObj Go function, independent of split/nosplit behavior - serialize the entry map as map 0 and use the Machine-CFG-derived PCSP stream to restore map 0 on entry-stack-depth paths, without identifying `runtime.morestack*` in GoObj emission - serialize ordinary statepoints as additional live maps and let same-PC statepoints override a CFG map-0 transition - retain complete ABI register homes for morestack retries while omitting unused, potentially poison incoming pointer values from the entry GC bitmap - model `go-systemstack` with `g.stackguard1` and `runtime.morestackc` ## Stack position This is 2/3 in the runtime LLVM support stack. Depends on #77. Next/final layer: #76, X86 ABI0/ABIInternal boundary repair. #75 has been folded into this PR so the stack semantics and the entry-map contract can be reviewed as one coherent change. ## Testing - fresh Release build of `llc` for X86 and AArch64 - 12 `GoObjStackMapUtilsTest` unit tests - 38 Generic/X86/AArch64 GoObj codegen tests - dedicated object test covering map 0 -> ordinary map 1 -> CFG-derived map 0 on both targets
Summary
go-nosplitas the sole exceptionEntryArgsStackMapIDrecord for every GoObj Go function, including nosplit functionsStackGrowthStatepointIDonly atruntime.morestack*for split functionsStack position
This is 3/4 in the runtime LLVM support stack.
Depends on #73 (and transitively #77).
Next/final layer: #76, X86 ABI0/ABIInternal boundary repair.
Testing
The reordered stack is tree-identical to the previously green #71 integration head. The integrated stack passed the LLVM GoObj suite, GoALLC plugin tests, Go
TestLLVM, and mixedruntime.test.