08029be9fc
Currently, changing putvar or putAbstractVar involves: 1. changing the abbrevs array to add new abbrevs or modify existing ones 2. changing the DW_ABRV_XXX const block to add the new abbrevs, this const block must match the changes to the abbrevs array 3. change the code at the start of putvar and putAbstractVar that selects the abbrev to use 4. change the body of putvar/putAbstractVar to emit the right attributes in the right sequence Each change must agree with all other, this is error prone and if an mistake is made there is no compile time or runtime check detecting it. Erroneous code will simply produce unreadable debug sections. This commit adds a mechanism to automatically generate code for abbrev selection as well as the abbrev definitions based on static examination of the body of putvar and putAbstractVar. TestPutVarAbbrevGenerator is responsible for checking that the generated code is kept updated and will regenerated it by passing the '-generate' option to it. benchstat output: | old.txt | new.txt | | sec/op | sec/op vs base | Template 153.8m ± 6% 153.0m ± 6% ~ (p=0.853 n=10) Unicode 98.98m ± 19% 100.22m ± 15% ~ (p=0.796 n=10) GoTypes 1013.7m ± 13% 943.6m ± 8% ~ (p=0.353 n=10) Compiler 98.48m ± 10% 97.79m ± 6% ~ (p=0.353 n=10) SSA 8.921 ± 31% 6.872 ± 37% ~ (p=0.912 n=10) Flate 114.3m ± 21% 128.0m ± 36% ~ (p=0.436 n=10) GoParser 219.0m ± 27% 214.9m ± 26% ~ (p=0.631 n=10) Reflect 447.5m ± 20% 452.6m ± 22% ~ (p=0.684 n=10) Tar 166.9m ± 27% 166.2m ± 27% ~ (p=0.529 n=10) XML 218.6m ± 25% 219.3m ± 24% ~ (p=0.631 n=10) LinkCompiler 492.7m ± 12% 523.2m ± 13% ~ (p=0.315 n=10) ExternalLinkCompiler 1.684 ± 3% 1.684 ± 2% ~ (p=0.684 n=10) LinkWithoutDebugCompiler 296.0m ± 8% 304.9m ± 12% ~ (p=0.579 n=10) StdCmd 69.59 ± 15% 70.76 ± 14% ~ (p=0.436 n=10) geomean 516.0m 511.5m -0.87% | old.txt | new.txt | | user-sec/op | user-sec/op vs base | Template 281.5m ± 10% 269.6m ± 13% ~ (p=0.315 n=10) Unicode 107.3m ± 8% 110.2m ± 8% ~ (p=0.165 n=10) GoTypes 2.414 ± 16% 2.181 ± 9% ~ (p=0.315 n=10) Compiler 116.0m ± 16% 119.1m ± 11% ~ (p=0.971 n=10) SSA 25.47 ± 39% 17.75 ± 52% ~ (p=0.739 n=10) Flate 205.2m ± 25% 256.2m ± 43% ~ (p=0.393 n=10) GoParser 456.8m ± 28% 427.0m ± 24% ~ (p=0.912 n=10) Reflect 960.3m ± 22% 990.5m ± 23% ~ (p=0.280 n=10) Tar 299.8m ± 27% 307.9m ± 27% ~ (p=0.631 n=10) XML 425.0m ± 21% 432.8m ± 24% ~ (p=0.353 n=10) LinkCompiler 768.1m ± 11% 796.9m ± 14% ~ (p=0.631 n=10) ExternalLinkCompiler 1.713 ± 5% 1.666 ± 4% ~ (p=0.190 n=10) LinkWithoutDebugCompiler 313.0m ± 9% 316.7m ± 12% ~ (p=0.481 n=10) geomean 588.6m 579.5m -1.55% | old.txt | new.txt | | text-bytes | text-bytes vs base | HelloSize 842.9Ki ± 0% 842.9Ki ± 0% ~ (p=1.000 n=10) ¹ CmdGoSize 10.95Mi ± 0% 10.95Mi ± 0% ~ (p=1.000 n=10) ¹ geomean 3.003Mi 3.003Mi +0.00% ¹ all samples are equal | old.txt | new.txt | | data-bytes | data-bytes vs base | HelloSize 15.08Ki ± 0% 15.08Ki ± 0% ~ (p=1.000 n=10) ¹ CmdGoSize 314.7Ki ± 0% 314.7Ki ± 0% ~ (p=1.000 n=10) ¹ geomean 68.88Ki 68.88Ki +0.00% ¹ all samples are equal | old.txt | new.txt | | bss-bytes | bss-bytes vs base | HelloSize 396.8Ki ± 0% 396.8Ki ± 0% ~ (p=1.000 n=10) ¹ CmdGoSize 428.8Ki ± 0% 428.8Ki ± 0% ~ (p=1.000 n=10) ¹ geomean 412.5Ki 412.5Ki +0.00% ¹ all samples are equal | old.txt | new.txt | | exe-bytes | exe-bytes vs base | HelloSize 1.310Mi ± 0% 1.310Mi ± 0% -0.01% (p=0.000 n=10) CmdGoSize 16.37Mi ± 0% 16.37Mi ± 0% -0.00% (p=0.000 n=10) geomean 4.631Mi 4.631Mi -0.00% Change-Id: I7edf37b5a47fd9aceef931ddf2c701e66a7b38b2 Reviewed-on: https://go-review.googlesource.com/c/go/+/563815 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
codereview.cfg | ||
CONTRIBUTING.md | ||
go.env | ||
LICENSE | ||
PATENTS | ||
README.md | ||
SECURITY.md |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 4.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.