diff options
| author | Jeremy Faller <jeremy@golang.org> | 2020-07-21 15:53:30 -0400 |
|---|---|---|
| committer | Jeremy Faller <jeremy@golang.org> | 2020-08-03 17:56:50 +0000 |
| commit | 89cf569a45f035bae45553f399880b92ede65f38 (patch) | |
| tree | e84962ba6163a63a187d93b507f3626f56c452d3 /src/cmd/internal/objabi | |
| parent | 847b9be3f62c7c93d3faf34577675e97176f6f7d (diff) | |
| download | go-89cf569a45f035bae45553f399880b92ede65f38.tar.xz | |
[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>
Diffstat (limited to 'src/cmd/internal/objabi')
| -rw-r--r-- | src/cmd/internal/objabi/funcid.go | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go index 0fda1db178..6c9336f31c 100644 --- a/src/cmd/internal/objabi/funcid.go +++ b/src/cmd/internal/objabi/funcid.go @@ -4,11 +4,6 @@ package objabi -import ( - "strconv" - "strings" -) - // A FuncID identifies particular functions that need to be treated // specially by the runtime. // Note that in some situations involving plugins, there may be multiple @@ -44,7 +39,10 @@ const ( // Get the function ID for the named function in the named file. // The function should be package-qualified. -func GetFuncID(name, file string) FuncID { +func GetFuncID(name string, isWrapper bool) FuncID { + if isWrapper { + return FuncID_wrapper + } switch name { case "runtime.main": return FuncID_runtime_main @@ -98,17 +96,5 @@ func GetFuncID(name, file string) FuncID { // Don't show in the call stack (used when invoking defer functions) return FuncID_wrapper } - if file == "<autogenerated>" { - return FuncID_wrapper - } - if strings.HasPrefix(name, "runtime.call") { - if _, err := strconv.Atoi(name[12:]); err == nil { - // runtime.callXX reflect call wrappers. - return FuncID_wrapper - } - } - if strings.HasSuffix(name, "-fm") { - return FuncID_wrapper - } return FuncID_normal } |
