GoObj: mark live stack-object pointer fields - #39
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, |
|
Closing after full-matrix validation exposed that expanding StackObject fields directly into LocalsPointerMaps violates Go stack-object reachability: stackobj.go and stackobj3.go retained dead objects, and stack pointers could be relocated twice. The branch now reverts the change completely. The replacement fix is in goallc/go#75: it materializes a short-lived pointer root for each live direct StackObject address at the corresponding safepoint, preserving both issue27518b/alloca GC coverage and the existing stackobj liveness tests. |
Depends on #38; the diff will reduce to the final commit after that PR lands.
An active address-taken stack object needs two complementary forms of GC metadata: function-wide StackObjects describe its layout for stack relocation, while the call-site LocalsPointerMaps keep its live heap-pointer fields reachable during marking. The writer previously emitted only StackObjects for this record kind, allowing GC to free objects still referenced from the stack object.
This change expands active StackObject bitmaps into LocalsPointerMaps while retaining the function-wide StackObjects record.
Validation: