summaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj/funcdata.go
Commit message (Collapse)AuthorAgeFilesLines
* cmd/internal/objabi: extract shared functionality from objMatthew Dempsky2017-04-191-25/+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/compile,link: generate PC-value tables with inlining informationDavid Lazar2017-03-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to generate accurate tracebacks, the runtime needs to know the inlined call stack for a given PC. This creates two tables per function for this purpose. The first table is the inlining tree (stored in the function's funcdata), which has a node containing the file, line, and function name for every inlined call. The second table is a PC-value table that maps each PC to a node in the inlining tree (or -1 if the PC is not the result of inlining). To give the appearance that inlining hasn't happened, the runtime also needs the original source position information of inlined AST nodes. Previously the compiler plastered over the line numbers of inlined AST nodes with the line number of the call. This meant that the PC-line table mapped each PC to line number of the outermost call in its inlined call stack, with no way to access the innermost line number. Now the compiler retains line numbers of inlined AST nodes and writes the innermost source position information to the PC-line and PC-file tables. Some tools and tests expect to see outermost line numbers, so we provide the OutermostLine function for displaying line info. To keep track of the inlined call stack for an AST node, we extend the src.PosBase type with an index into a global inlining tree. Every time the compiler inlines a call, it creates a node in the global inlining tree for the call, and writes its index to the PosBase of every inlined AST node. The parent of this node is the inlining tree index of the call. -1 signifies no parent. For each function, the compiler creates a local inlining tree and a PC-value table mapping each PC to an index in the local tree. These are written to an object file, which is read by the linker. The linker re-encodes these tables compactly by deduplicating function names and file names. This change increases the size of binaries by 4-5%. For example, this is how the go1 benchmark binary is impacted by this change: section old bytes new bytes delta .text 3.49M ± 0% 3.49M ± 0% +0.06% .rodata 1.12M ± 0% 1.21M ± 0% +8.21% .gopclntab 1.50M ± 0% 1.68M ± 0% +11.89% .debug_line 338k ± 0% 435k ± 0% +28.78% Total 9.21M ± 0% 9.58M ± 0% +4.01% Updates #19348. Change-Id: Ic4f180c3b516018138236b0c35e0218270d957d3 Reviewed-on: https://go-review.googlesource.com/37231 Run-TryBot: David Lazar <lazard@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* cmd/internal/obj, runtime: update funcdata commentsAustin Clements2017-02-271-34/+9
| | | | | | | | | | | | | | The comments in cmd/internal/obj/funcdata.go are identical to the comments in runtime/funcdata.h, but the majority of the definitions they refer to don't apply to Go sources and have been stripped out of funcdata.go. Remove these stale comments from funcdata.go and clean up the references to other copies of the PCDATA and FUNCDATA indexes. Change-Id: I5d6e49a6e586cc9aecd7c3ce1567679f2a605884 Reviewed-on: https://go-review.googlesource.com/37330 Reviewed-by: Keith Randall <khr@golang.org>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* cmd/internal/obj: remove 3 incorrect copyright noticesRuss Cox2015-12-141-32/+2
| | | | | | | | | | | | | | | These three files contain only code written for Go (and trivial amounts at that), not any code ported from Inferno or Plan 9. Remove the incorrect Inferno/Plan 9 notices. Fixes #13576. Change-Id: Ib9901fb360232282aae5ee0f4aa527bd6f4eaaed Reviewed-on: https://go-review.googlesource.com/17779 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* cmd/internal/obj: remove dead code and small cleanupsMichael Hudson-Doyle2015-09-081-1/+0
| | | | | | Change-Id: I88fa0cc245a2141af04acced8716e08b1133abd1 Reviewed-on: https://go-review.googlesource.com/14350 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* [dev.cc] cmd/internal/obj: reconvert from liblinkRuss Cox2015-02-051-4/+5
| | | | | | | | | | | | | | | | | | | | | | cmd/internal/obj reconverted using rsc.io/c2go rev 2a95256. - Brings in new, more regular Prog, Addr definitions - Add Prog* argument to oclass in liblink/asm[68].c, for c2go conversion. - Update objwriter for change in TEXT size encoding. - Merge 5a, 6a, 8a, 9a changes into new5a, new6a, new8a, new9a (by hand). - Add +build ignore to cmd/asm/internal/{addr,arch,asm}, cmd/asm. They need to be updated for the changes. - Reenable verifyAsm in cmd/go. - Reenable GOOBJ=2 mode by default in liblink. All architectures build successfully again. Change-Id: I2c845c5d365aa484b570476898171bee657b626d Reviewed-on: https://go-review.googlesource.com/3963 Reviewed-by: Rob Pike <r@golang.org>
* [dev.cc] cmd/internal/obj: convert liblink C to GoRuss Cox2015-01-211-0/+78
This CL adds the real cmd/internal/obj packages. Collectively they correspond to the liblink library. The conversion was done using rsc.io/c2go's run script at rsc.io/c2go repo version 706fac7. This is not the final conversion, just the first working draft. There will be more updates, but this works well enough to use with go tool objwriter and pass all.bash. Change-Id: I9359e835425f995a392bb2fcdbebf29511477bed Reviewed-on: https://go-review.googlesource.com/3046 Reviewed-by: Ian Lance Taylor <iant@golang.org>