summaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/line.go
Commit message (Collapse)AuthorAgeFilesLines
* [dev.link] cmd: remove "2", another roundCherry Zhang2020-08-111-3/+3
| | | | | | | | | | Rename the goobj2 package to goobj. Change-Id: Iff97b5575cbac45ac44de96b6bd9d555b9a4a12a Reviewed-on: https://go-review.googlesource.com/c/go/+/246444 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* [dev.link] use per package filenames to build pclntabJeremy Faller2020-08-101-0/+6
| | | | | | | | | | | | | | | | | | | In order to prevent renumbering of filenames in pclntab generation, use the per-package file list (previously only used for DWARF generation) as file-indices. This is the largest step to eliminate renumbering of filenames in pclntab. Note, this is probably not the final state of the file table within the object file. In this form, the linker loads all filenames for all objects. I'll move to storing the filenames as regular string symbols,and defaulting all string symbols to using the larger hash value to make generation of pcln simplest, and most memory friendly. Change-Id: I23daafa3f4b4535076e23100200ae0e7163aafe0 Reviewed-on: https://go-review.googlesource.com/c/go/+/245485 Run-TryBot: Jeremy Faller <jeremy@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* [dev.link] cmd/internal/goobj2: add index fingerprint to object fileCherry Zhang2020-04-241-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new object files use indices for symbol references, instead of names. Fundamental to the design, it requires that the importing and imported packages have consistent view of symbol indices. The Go command should already ensure this, when using "go build". But in case it goes wrong, it could lead to obscure errors like run-time crashes. It would be better to check the index consistency at build time. To do that, we add a fingerprint to each object file, which is a hash of symbol indices. In the object file it records the fingerprints of all imported packages, as well as its own fingerprint. At link time, the linker checks that a package's fingerprint matches the fingerprint recorded in the importing packages, and issue an error if they don't match. This CL does the first part: introducing the fingerprint in the object file, and propagating fingerprints through importing/exporting by the compiler. It is not yet used by the linker. Next CL will do. Change-Id: I0aa372da652e4afb11f2867cb71689a3e3f9966e Reviewed-on: https://go-review.googlesource.com/c/go/+/229617 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
* cmd/internal/objabi: extract shared functionality from objMatthew Dempsky2017-04-191-61/+0
| | | | | | | | | | | | | | | | | | | | | | | Now only cmd/asm and cmd/compile depend on cmd/internal/obj. Changing the assembler backends no longer requires reinstalling cmd/link or cmd/addr2line. There's also now one canonical definition of the object file format in cmd/internal/objabi/doc.go, with a warning to update all three implementations. objabi is still something of a grab bag of unrelated code (e.g., flag and environment variable handling probably belong in a separate "tool" package), but this is still progress. Fixes #15165. Fixes #20026. Change-Id: Ic4b92fac7d0d35438e0d20c9579aad4085c5534c Reviewed-on: https://go-review.googlesource.com/40972 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
* cmd/internal/obj: use string instead of LSym in PclnJosh Bleecher Snyder2017-04-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | In a concurrent backend, Ctxt.Lookup will need some form of concurrency protection, which will make it more expensive. This CL changes the pcln table builder to track filenames as strings rather than LSyms. Those strings are then converted into LSyms at the last moment, for writing the object file. This CL removes over 85% of the calls to Ctxt.Lookup in a run of make.bash. Passes toolstash-check. Updates #15756 Change-Id: I3c53deff6f16f2643169f3bdfcc7aca2ca58b0a4 Reviewed-on: https://go-review.googlesource.com/39291 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/internal/obj: remove AUSEFIELD pseudo-opMatthew Dempsky2017-03-061-18/+0
| | | | | | | | | | | | Instead, cmd/compile can directly emit R_USEFIELD relocations. Manually verified rsc.io/tmp/fieldtrack still passes. Change-Id: Ib1fb5ab902ff0ad17ef6a862a9a5692caf7f87d1 Reviewed-on: https://go-review.googlesource.com/37871 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
* cmd/internal/src: cache prefixed filenamesJosh Bleecher Snyder2017-03-041-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CL 37234 introduced string concatenation into some hot code. This CL does that work earlier and caches the result. Updates #19386 Performance impact vs master: name old time/op new time/op delta Template 223ms ± 5% 216ms ± 5% -2.98% (p=0.001 n=20+20) Unicode 98.7ms ± 4% 99.0ms ± 4% ~ (p=0.749 n=20+19) GoTypes 631ms ± 4% 626ms ± 4% ~ (p=0.253 n=20+20) Compiler 2.91s ± 1% 2.87s ± 3% -1.11% (p=0.005 n=18+20) SSA 4.48s ± 2% 4.36s ± 2% -2.77% (p=0.000 n=20+20) Flate 130ms ± 2% 129ms ± 6% ~ (p=0.428 n=19+20) GoParser 160ms ± 4% 157ms ± 3% -1.62% (p=0.005 n=20+18) Reflect 395ms ± 2% 394ms ± 4% ~ (p=0.445 n=20+20) Tar 120ms ± 5% 118ms ± 6% ~ (p=0.101 n=19+20) XML 224ms ± 3% 223ms ± 3% ~ (p=0.544 n=19+19) name old user-ns/op new user-ns/op delta Template 291user-ms ± 5% 265user-ms ± 5% -9.02% (p=0.000 n=20+19) Unicode 140user-ms ± 3% 139user-ms ± 8% ~ (p=0.904 n=20+20) GoTypes 844user-ms ± 3% 849user-ms ± 3% ~ (p=0.251 n=20+18) Compiler 4.06user-s ± 5% 3.98user-s ± 2% ~ (p=0.056 n=20+20) SSA 6.89user-s ± 5% 6.50user-s ± 3% -5.61% (p=0.000 n=20+20) Flate 164user-ms ± 5% 163user-ms ± 4% ~ (p=0.365 n=20+19) GoParser 206user-ms ± 6% 204user-ms ± 4% ~ (p=0.534 n=20+18) Reflect 501user-ms ± 4% 505user-ms ± 5% ~ (p=0.383 n=20+20) Tar 151user-ms ± 3% 152user-ms ± 7% ~ (p=0.798 n=17+20) XML 283user-ms ± 7% 280user-ms ± 5% ~ (p=0.301 n=20+20) name old alloc/op new alloc/op delta Template 42.5MB ± 0% 40.2MB ± 0% -5.59% (p=0.000 n=20+20) Unicode 31.7MB ± 0% 31.0MB ± 0% -2.19% (p=0.000 n=20+18) GoTypes 124MB ± 0% 117MB ± 0% -5.90% (p=0.000 n=20+20) Compiler 533MB ± 0% 490MB ± 0% -8.07% (p=0.000 n=20+20) SSA 989MB ± 0% 893MB ± 0% -9.74% (p=0.000 n=20+20) Flate 27.8MB ± 0% 26.1MB ± 0% -5.92% (p=0.000 n=20+20) GoParser 34.3MB ± 0% 32.1MB ± 0% -6.43% (p=0.000 n=19+20) Reflect 84.6MB ± 0% 81.4MB ± 0% -3.84% (p=0.000 n=20+20) Tar 28.8MB ± 0% 27.7MB ± 0% -3.89% (p=0.000 n=20+20) XML 47.2MB ± 0% 44.2MB ± 0% -6.45% (p=0.000 n=20+19) name old allocs/op new allocs/op delta Template 420k ± 1% 381k ± 1% -9.35% (p=0.000 n=20+20) Unicode 338k ± 1% 324k ± 1% -4.29% (p=0.000 n=20+19) GoTypes 1.28M ± 0% 1.15M ± 0% -10.30% (p=0.000 n=20+20) Compiler 5.06M ± 0% 4.41M ± 0% -12.92% (p=0.000 n=20+20) SSA 9.14M ± 0% 7.91M ± 0% -13.46% (p=0.000 n=19+20) Flate 267k ± 0% 241k ± 1% -9.53% (p=0.000 n=20+20) GoParser 347k ± 1% 312k ± 0% -10.15% (p=0.000 n=19+20) Reflect 1.07M ± 0% 1.00M ± 0% -6.86% (p=0.000 n=20+20) Tar 274k ± 1% 256k ± 1% -6.73% (p=0.000 n=20+20) XML 448k ± 0% 398k ± 0% -11.17% (p=0.000 n=20+18) Performance impact when applied together with CL 37234 atop CL 37234's parent commit (i.e. as if it were a part of CL 37234), to show that this commit makes CL 37234 completely performance-neutral: name old time/op new time/op delta Template 222ms ±14% 222ms ±14% ~ (p=1.000 n=14+15) Unicode 104ms ±18% 106ms ±18% ~ (p=0.650 n=13+14) GoTypes 653ms ± 7% 638ms ± 5% ~ (p=0.145 n=14+12) Compiler 3.10s ± 1% 3.13s ±10% ~ (p=1.000 n=2+2) SSA 4.73s ±11% 4.68s ±11% ~ (p=0.567 n=15+15) Flate 136ms ± 4% 133ms ± 7% ~ (p=0.231 n=12+14) GoParser 163ms ±11% 169ms ±10% ~ (p=0.352 n=14+14) Reflect 415ms ±15% 423ms ±20% ~ (p=0.715 n=15+14) Tar 133ms ±17% 130ms ±23% ~ (p=0.252 n=14+15) XML 236ms ±16% 235ms ±14% ~ (p=0.874 n=14+14) name old user-ns/op new user-ns/op delta Template 271user-ms ±10% 271user-ms ±10% ~ (p=0.780 n=14+15) Unicode 143user-ms ± 5% 146user-ms ±11% ~ (p=0.432 n=12+14) GoTypes 864user-ms ± 5% 866user-ms ± 9% ~ (p=0.905 n=14+13) Compiler 4.17user-s ± 1% 4.26user-s ± 7% ~ (p=1.000 n=2+2) SSA 6.79user-s ± 8% 6.79user-s ± 6% ~ (p=0.902 n=15+15) Flate 169user-ms ± 8% 164user-ms ± 5% -3.13% (p=0.014 n=14+14) GoParser 212user-ms ± 7% 217user-ms ±22% ~ (p=1.000 n=13+15) Reflect 521user-ms ± 7% 533user-ms ±15% ~ (p=0.511 n=14+14) Tar 165user-ms ±17% 161user-ms ±15% ~ (p=0.345 n=15+15) XML 294user-ms ±11% 292user-ms ±10% ~ (p=0.839 n=14+14) name old alloc/op new alloc/op delta Template 39.9MB ± 0% 39.9MB ± 0% ~ (p=0.621 n=15+14) Unicode 31.0MB ± 0% 31.0MB ± 0% ~ (p=0.098 n=13+15) GoTypes 117MB ± 0% 117MB ± 0% ~ (p=0.775 n=15+15) Compiler 488MB ± 0% 488MB ± 0% ~ (p=0.333 n=2+2) SSA 892MB ± 0% 892MB ± 0% +0.03% (p=0.000 n=15+15) Flate 26.1MB ± 0% 26.1MB ± 0% ~ (p=0.098 n=15+15) GoParser 31.8MB ± 0% 31.8MB ± 0% ~ (p=0.525 n=15+13) Reflect 81.2MB ± 0% 81.2MB ± 0% +0.06% (p=0.001 n=12+14) Tar 27.5MB ± 0% 27.5MB ± 0% ~ (p=0.595 n=15+15) XML 44.1MB ± 0% 44.1MB ± 0% ~ (p=0.486 n=15+15) name old allocs/op new allocs/op delta Template 378k ± 1% 378k ± 0% ~ (p=0.949 n=15+14) Unicode 324k ± 0% 324k ± 1% ~ (p=0.057 n=14+15) GoTypes 1.15M ± 0% 1.15M ± 0% ~ (p=0.461 n=15+15) Compiler 4.39M ± 0% 4.39M ± 0% ~ (p=0.333 n=2+2) SSA 7.90M ± 0% 7.90M ± 0% +0.06% (p=0.008 n=15+15) Flate 240k ± 1% 241k ± 0% ~ (p=0.233 n=15+15) GoParser 309k ± 1% 309k ± 0% ~ (p=0.867 n=15+12) Reflect 1.00M ± 0% 1.00M ± 0% ~ (p=0.139 n=12+15) Tar 254k ± 1% 253k ± 1% ~ (p=0.345 n=15+15) XML 398k ± 0% 397k ± 1% ~ (p=0.267 n=15+15) Change-Id: Ic999a0f456a371c99eebba0f9747263a13836e33 Reviewed-on: https://go-review.googlesource.com/37766 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/internal/obj: avoid duplicate file name symbolsDavid Lazar2017-03-031-2/+4
| | | | | | | | | | | | | | | | | | | | | The meaning of Version=1 was overloaded: it was reserved for file name symbols (to avoid conflicts with non-file name symbols), but was also used to mean "give me a fresh version number for this symbol." With the new inlining tree, the same file name symbol can appear in multiple entries, but each one would become a distinct symbol with its own version number. Now, we avoid duplicating symbols by using Version=0 for file name symbols and we avoid conflicts with other symbols by prefixing the symbol name with "gofile..". Change-Id: I8d0374053b8cdb6a9ca7fb71871b69b4dd369a9c Reviewed-on: https://go-review.googlesource.com/37234 Run-TryBot: David Lazar <lazard@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
* [dev.inline] cmd/internal/obj: remove vestiges of LineHist - not used anymoreRobert Griesemer2017-01-091-232/+0
| | | | | | | | | Change-Id: I9d3fcdd5b002953fa9d2f001bf7a834073443794 Reviewed-on: https://go-review.googlesource.com/34722 TryBot-Result: Gobot Gobot <gobot@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* [dev.inline] cmd/internal/src: introduce compact source position representationRobert Griesemer2017-01-091-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | XPos is a compact (8 instead of 16 bytes on a 64bit machine) source position representation. There is a 1:1 correspondence between each XPos and each regular Pos, translated via a global table. In some sense this brings back the LineHist, though positions can track line and column information; there is a O(1) translation between the representations (no binary search), and the translation is factored out. The size increase with the prior change is brought down again and the compiler speed is in line with the master repo (measured on the same "quiet" machine as for prior change): name old time/op new time/op delta Template 256ms ± 1% 262ms ± 2% ~ (p=0.063 n=5+4) Unicode 132ms ± 1% 135ms ± 2% ~ (p=0.063 n=5+4) GoTypes 891ms ± 1% 871ms ± 1% -2.28% (p=0.016 n=5+4) Compiler 3.84s ± 2% 3.89s ± 2% ~ (p=0.413 n=5+4) MakeBash 47.1s ± 1% 46.2s ± 2% ~ (p=0.095 n=5+5) name old user-ns/op new user-ns/op delta Template 309M ± 1% 314M ± 2% ~ (p=0.111 n=5+4) Unicode 165M ± 1% 172M ± 9% ~ (p=0.151 n=5+5) GoTypes 1.14G ± 2% 1.12G ± 1% ~ (p=0.063 n=5+4) Compiler 5.00G ± 1% 4.96G ± 1% ~ (p=0.286 n=5+4) Change-Id: Icc570cc60ab014d8d9af6976f1f961ab8828cc47 Reviewed-on: https://go-review.googlesource.com/34506 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* [dev.inline] cmd/internal/src: replace src.Pos with syntax.PosRobert Griesemer2017-01-091-21/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the src.Pos LineHist-based position tracking with the syntax.Pos implementation and updates all uses. The LineHist table is not used anymore - the respective code is still there but should be removed eventually. CL forthcoming. Passes toolstash -cmp when comparing to the master repo (with the exception of a couple of swapped assembly instructions, likely due to different instruction scheduling because the line-based sorting has changed; though this is won't affect correctness). The sizes of various important compiler data structures have increased significantly (see the various sizes_test.go files); this is probably the reason for an increase of compilation times (to be addressed). Here are the results of compilebench -count 5, run on a "quiet" machine (no apps running besides a terminal): name old time/op new time/op delta Template 256ms ± 1% 280ms ±15% +9.54% (p=0.008 n=5+5) Unicode 132ms ± 1% 132ms ± 1% ~ (p=0.690 n=5+5) GoTypes 891ms ± 1% 917ms ± 2% +2.88% (p=0.008 n=5+5) Compiler 3.84s ± 2% 3.99s ± 2% +3.95% (p=0.016 n=5+5) MakeBash 47.1s ± 1% 47.2s ± 2% ~ (p=0.841 n=5+5) name old user-ns/op new user-ns/op delta Template 309M ± 1% 326M ± 2% +5.18% (p=0.008 n=5+5) Unicode 165M ± 1% 168M ± 4% ~ (p=0.421 n=5+5) GoTypes 1.14G ± 2% 1.18G ± 1% +3.47% (p=0.008 n=5+5) Compiler 5.00G ± 1% 5.16G ± 1% +3.12% (p=0.008 n=5+5) Change-Id: I241c4246cdff627d7ecb95cac23060b38f9775ec Reviewed-on: https://go-review.googlesource.com/34273 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/internal/obj: rename obj.go to line.goMatthew Dempsky2016-12-011-0/+306
This file is entirely about the implementation of LineHist, and I can never remember which generic filename in cmd/internal/obj has it. Rename to line.go to match the already existing line_test.go. Change-Id: Id01f3339dc550c9759569d5610d808b17bca44d0 Reviewed-on: https://go-review.googlesource.com/33803 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>