feat: add pointer access and alias attributes - #2598
Draft
zhouguangyuan0718 wants to merge 1 commit into
Draft
zhouguangyuan0718 wants to merge 1 commit into
zhouguangyuan0718 wants to merge 1 commit into
Conversation
This was referenced Sep 14, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
LLGo WebAssembly build benchmarks
WebAssembly output sizes
LLGo WebAssembly build measurements
Compared with |
LLGo baseline benchmarks
Program measurements
Core language and compiler benchmarks
Timer runtime benchmarks
Compared with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
access(none/read/write/readwrite)andnoaliason pointer parameters and receivers, completing the scoped attributes in #2590.The compiler validates pointer selectors and maps them to LLVM parameter attributes, preserving their source meaning when other arguments or results require ABI conversion.
accessrestricts accesses through the selected pointer;noaliasrestricts independent accesses to modified memory and permits shared reads of unmodified memory. Applicable runtime hash, equality, copy, clear, map-length and channel-capacity helpers use source annotations.Definitions and imported declarations conservatively omit pointer restrictions in modes with GC root publication or cooperative safepoints. Other compiler-generated runtime protocols diagnose retained restrictions at the annotation. A small callback carries the same check into late large-result allocation. Source positions remain in backend-owned Go data.
Depends on #2597. This diff contains only pointer access/alias support and its runtime checks.
Validation on macOS arm64, Go 1.27.0 / LLVM 22.1.8:
cl,ssa,internal/funcattrs,internal/abiandinternal/buildsuites passed; C ABI unit tests passed excluding external toolchain build/corpus tests.noaliasandreadonlyon the source pointer through byval/sret conversion, with no leakage onto transfer storage.nogc, including overlapping copies in both directions, reads after mutation, valid noalias stores and shared reads through identical pointers.Review order: #2572 (function properties) → #2595 (parameter and single-result values) → #2596 (large-aggregate projections) → #2597 (result relations and multiple results) → #2598 (pointer access and aliasing). Each PR targets its predecessor so its diff contains only that step.