build: add link-time dead method elimination#1868
Open
luoliwoshang wants to merge 11 commits into
Open
Conversation
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Contributor
Author
|
补充一个 DCE 方法槽修复点: 对于被判定为 dead 的方法槽, 原因是运行时构造 itab 时, 这会导致同一个 concrete type 到同一个接口的转换生成多个不同 itab。典型表现是 t0 == t1 // true
m[t1] // false最终会影响标准库里这类逻辑,例如 supportedTypes[reflect.TypeOf(5)]所以现在的策略是:dead method slot 仍保留非零函数入口,指向 |
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
Notes
-vcache hit logging now prints only the package path.Test Plan
go test ./internal/deadcode ./internal/dcepass ./internal/metadata ./internal/build -count=1Demo Size Comparison
Built
_demo/godemos with DCE from this PR into_demo/go/520-dce, and with localupstream/main(ec1b2f74) into_demo/go/520-nodce.Build command shape:
LLGO_BUILD_CACHE=off llgo build -a -o <output> .Summary for demos that built successfully on both sides:
Two demos failed on both sides and were excluded from the size total:
defer/setjmp: C source files are present but this directllgo build .path is not using cgo/SWIG.defer/test: existing source errors aroundc.Printf/c.Str.Top reductions:
goimporter-1389embedunexport-1598gotypesabimethodmimeheaderreflectpointertoreflectmakenetipgobuild-1389randdemogotokensysexecoslookpathsynccreatetemp-1654