[dev.link] move FuncID creation into the compiler/assembler

Leaving creation of the funcID till the linker requires the linker to
load the function and file names into memory. Moving these into the
compiler/assembler prevents this.

This work is a step towards moving all func metadata into the compiler.

Change-Id: Iebffdc5a909adbd03ac263fde3f4c3d492fb1eac
Reviewed-on: https://go-review.googlesource.com/c/go/+/244024
Run-TryBot: Jeremy Faller <jeremy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Jeremy Faller 2020-07-21 15:53:30 -04:00
parent 847b9be3f6
commit 89cf569a45
10 changed files with 41 additions and 36 deletions

View file

@ -1872,6 +1872,10 @@ func (fi *FuncInfo) Locals() int {
return int((*goobj2.FuncInfo)(nil).ReadLocals(fi.data))
}
func (fi *FuncInfo) FuncID() objabi.FuncID {
return objabi.FuncID((*goobj2.FuncInfo)(nil).ReadFuncID(fi.data))
}
func (fi *FuncInfo) Pcsp() []byte {
pcsp, end := (*goobj2.FuncInfo)(nil).ReadPcsp(fi.data)
return fi.r.BytesAt(fi.r.PcdataBase()+pcsp, int(end-pcsp))