Skip to content

[Go] Emit GoObj entry and stack-growth maps - #75

Closed
zhouguangyuan0718 wants to merge 2 commits into
review/runtime-stack-semanticsfrom
review/runtime-goobj-stack-maps
Closed

[Go] Emit GoObj entry and stack-growth maps#75
zhouguangyuan0718 wants to merge 2 commits into
review/runtime-stack-semanticsfrom
review/runtime-goobj-stack-maps

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • make split-stack growth the default for GoObj Go functions, with go-nosplit as the sole exception
  • emit one zero-byte EntryArgsStackMapID record for every GoObj Go function, including nosplit functions
  • emit a real root-free StackGrowthStatepointID only at runtime.morestack* for split functions
  • adapt Machine StackMaps in core AsmPrinter/GoObj emission and reject inconsistent entry, nosplit, or rooted stack-growth records
  • retain target-specific argument homes and fixed-frame fail-closed checks

Stack 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 mixed runtime.test.

@github-actions

Copy link
Copy Markdown

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.

  • All contributions to LLVM must follow our LLVM AI Tool Use Policy. In particular, if you used AI while working on this PR, remember to add a note to the PR description.
  • The LLVM Code-Review Policy and Practices document contains practical information about the PR process, including how patches are reviewed and accepted, and who can review a PR.
  • Our LLVM Developer Policy describes our expectations for code quality, commit summaries and contains notes on our CI system.

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 questions

How 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 @ followed by their GitHub username.

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,
The LLVM Community

@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-abi0-symbol-resolution branch from ac6ae73 to aa55715 Compare August 13, 2026 07:01
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-goobj-stack-maps branch from 9743f08 to c859054 Compare August 13, 2026 07:01
@zhouguangyuan0718
zhouguangyuan0718 changed the base branch from review/runtime-abi0-symbol-resolution to review/runtime-stack-semantics August 13, 2026 07:02
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-stack-semantics branch from 8c41777 to b0fe7aa Compare August 13, 2026 09:26
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-goobj-stack-maps branch from c859054 to a0fbb6d Compare August 13, 2026 09:31
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-stack-semantics branch from b0fe7aa to e16ab84 Compare August 13, 2026 09:35
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-goobj-stack-maps branch from a0fbb6d to f6436d9 Compare August 13, 2026 09:35
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-stack-semantics branch from e16ab84 to f931e51 Compare August 13, 2026 10:34
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-goobj-stack-maps branch from f6436d9 to c2800d8 Compare August 13, 2026 10:35
@zhouguangyuan0718
zhouguangyuan0718 force-pushed the review/runtime-stack-semantics branch from f931e51 to 94a25ae Compare August 13, 2026 12:46
@zhouguangyuan0718

Copy link
Copy Markdown
Author

按最新评审结论,这一层已经完整折叠进 #73:入口 ArgsPointerMaps 与 split/nosplit 解耦,morestack 不再制造 statepoint,GoObj 通过 CFG 派生的 PCSP 在入口栈深度恢复 map 0。#76 也已直接 rebase 到 #73,因此关闭这个过时的中间层。

zhouguangyuan0718 added a commit that referenced this pull request Aug 13, 2026
## 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
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.

1 participant