You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Its use anywhere in a program forces the linker's deadcode pass to go into its conservative mode when deciding whether to preserve otherwise-unused exported methods.
Because net/http depends on httptrace, any net/http program is potentially larger than it needs to be, even if the caller program doesn't use httptrace. That then makes binaries bigger (138 KiB larger in one program here)
reflect.Value.Call, if reachable, used to bring all exported
methods live. CL 228792 fixes this, removing the check of
reflect.Value.Call. This CL adds a test.
Updates #38505.
Change-Id: Ib4cab3c3c86c9c9702d041266e59b159d0ff0a97
Reviewed-on: https://go-review.googlesource.com/c/go/+/228878
Reviewed-by: Brad Fitzpatrick <[email protected]>
It's also not as bad as I originally thought: a program that imported net/http but didn't use httptrace.WithClientTrace didn't end up going into conservative reflectSeen mode.
But with the latest toolchain changes (notably https://go-review.googlesource.com/c/go/+/228792), even using WithClientTrace shouldn't trigger the linker's reflectSeen, as it doesn't do any method lookups.
net/http/httptrace uses reflect.Value.Call:
https://github.com/golang/go/blob/release-branch.go1.14/src/net/http/httptrace/trace.go#L201
Its use anywhere in a program forces the linker's deadcode pass to go into its conservative mode when deciding whether to preserve otherwise-unused exported methods.
Because net/http depends on httptrace, any net/http program is potentially larger than it needs to be, even if the caller program doesn't use httptrace. That then makes binaries bigger (138 KiB larger in one program here)
(People who like this bug might also like #38450)
We should probably rewrite (or auto-generate?) httptrace to not use reflect.Value.Call.
The text was updated successfully, but these errors were encountered: