aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/symtab.go
diff options
context:
space:
mode:
authorJeremy Faller <jeremy@golang.org>2020-07-16 16:18:49 -0400
committerJeremy Faller <jeremy@golang.org>2020-07-31 13:55:07 +0000
commit6ac9914383bc88d014cbc681dae758372e6ca823 (patch)
tree1f41b4cbe03c274902ad26b6e19d33edbb5d6803 /src/runtime/symtab.go
parent3067a8dc02f62c287a8ccd3fcf16bfdf4f687f5f (diff)
downloadgo-6ac9914383bc88d014cbc681dae758372e6ca823.tar.xz
[dev.link] create runtime.funcnametab
Move the function names out of runtime.pclntab_old, creating runtime.funcnametab. There is an unfortunate artifact in this change in that calculating the funcID still requires loading the name. Future work will likely pull this out and put it into the object file Funcs. ls -l cmd/compile (darwin): before: 18524016 after: 18519952 The difference in size can be attributed to alignment in pclntab_old. Change-Id: Ibcbb230d4632178f8fcd0667165f5335786381f8 Reviewed-on: https://go-review.googlesource.com/c/go/+/243223 Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/symtab.go')
-rw-r--r--src/runtime/symtab.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 95f01c555b..ddb5ea82b4 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -336,12 +336,13 @@ const (
// PCHeader holds data used by the pclntab lookups.
type pcHeader struct {
- magic uint32 // 0xFFFFFFFA
- pad1, pad2 uint8 // 0,0
- minLC uint8 // min instruction size
- ptrSize uint8 // size of a ptr in bytes
- nfunc int // number of functions in the module
- pclnOffset uintptr // offset to the pclntab variable from pcHeader
+ magic uint32 // 0xFFFFFFFA
+ pad1, pad2 uint8 // 0,0
+ minLC uint8 // min instruction size
+ ptrSize uint8 // size of a ptr in bytes
+ nfunc int // number of functions in the module
+ funcnameOffset uintptr // offset to the funcnametab variable from pcHeader
+ pclnOffset uintptr // offset to the pclntab variable from pcHeader
}
// moduledata records information about the layout of the executable
@@ -351,6 +352,7 @@ type pcHeader struct {
// none of the pointers here are visible to the garbage collector.
type moduledata struct {
pcHeader *pcHeader
+ funcnametab []byte
pclntable []byte
ftab []functab
filetab []uint32
@@ -826,7 +828,7 @@ func cfuncname(f funcInfo) *byte {
if !f.valid() || f.nameoff == 0 {
return nil
}
- return &f.datap.pclntable[f.nameoff]
+ return &f.datap.funcnametab[f.nameoff]
}
func funcname(f funcInfo) string {
@@ -837,7 +839,7 @@ func cfuncnameFromNameoff(f funcInfo, nameoff int32) *byte {
if !f.valid() {
return nil
}
- return &f.datap.pclntable[nameoff]
+ return &f.datap.funcnametab[nameoff]
}
func funcnameFromNameoff(f funcInfo, nameoff int32) string {