feat(metadata): add PackageMeta Builder for summary extraction during compilation#1860
Draft
luoliwoshang wants to merge 1 commit into
Draft
feat(metadata): add PackageMeta Builder for summary extraction during compilation#1860luoliwoshang wants to merge 1 commit into
luoliwoshang wants to merge 1 commit into
Conversation
6b6744e to
46d870b
Compare
… compilation Add metadata.Builder to accumulate facts (TypeChildren, InterfaceInfo, UseIface, UseIfaceMethod, MethodInfo) during cl/ssa compilation. Wire via aPackage.SetMetaBuilder/BuildMeta, called after deferred inits. Includes golden-file tests under cl/_testmeta/ and gentests support. Excludes OrdinaryEdges (separate PR). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
46d870b to
126f9ec
Compare
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Summary
First PR for Whole-Program Method Reachability Analysis and Package Summary Cache (#1853). Implements Package Summary extraction — collecting metadata facts during compilation and storing them in
PackageMeta.What's Included
Core Infrastructure
internal/metadata/— V1 binary format (LLPS,encode.go/decode.go/meta.gofrom [WIP] proposal: LLGo Whole-Program Method Reachability Analysis and Package Summary Cache #1853 bench work),Builder(builder.go), and human-readable formatter (format.go)SSA-Layer Metadata Collection
ssa/abitype.go—collectTypeChildren()for parent→child ABI type relationships;mthName()for method name normalization;MethodInfocollection inabiUncommonMethods()ssa/interface.go— Interface metadata:emitIfaceMethodUse,emitInterfaceInfo,emitUseIfaceduringImethod/MakeInterfacessa/metadata.go— Bridge functionsEmitUseNamedMethod/EmitReflectMethodfor future cl-layer usessa/package.go—SetMetaBuilder/MetaBuilder/BuildMeta/MetaaccessorsCL-Layer Wiring
cl/compile.go— Creates Builder, callsBuildMeta()after deferred init functionsinternal/build/build.go—ModuleHookcallback field on ConfigTesting
cl/_testmeta/— 3 golden-file test cases (iface, methods, nested)cl/cltest/meta.go—TestMetaFromDirhelper +CaptureMetafor regenerationcl/compile_test.go—TestMetaentry pointchore/gentests/gentests.go—genMetaDirfor golden file regenerationWhat's Excluded (Separate PRs)
Test Plan
LLGO_ROOT=. go test ./cl/ -run TestMeta -v— all 3 cases PASSgo build ./...compiles cleanly[SectionName]\nkey:\n valueformat🤖 Generated with Claude Code