aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/signal_linux_s390x.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-02-20 22:37:07 -0500
committerAustin Clements <austin@google.com>2017-03-06 19:17:24 +0000
commit0efc8b21881ab35fdb45547088b1935fc8ebf263 (patch)
tree290a47b98c68dd5e571e4dfee037c6b379aebb68 /src/runtime/signal_linux_s390x.go
parent6533cc1ce899fa3c7fac1a85ad724e333fb9710f (diff)
downloadgo-0efc8b21881ab35fdb45547088b1935fc8ebf263.tar.gz
go-0efc8b21881ab35fdb45547088b1935fc8ebf263.zip
runtime: avoid repeated findmoduledatap calls
Currently almost every function that deals with a *_func has to first look up the *moduledata for the module containing the function's entry point. This means we almost always do at least two identical module lookups whenever we deal with a *_func (one to get the *_func and another to get something from its module data) and sometimes several more. Fix this by making findfunc return a new funcInfo type that embeds *_func, but also includes the *moduledata, and making all of the functions that currently take a *_func instead take a funcInfo and use the already-found *moduledata. This transformation is trivial for the most part, since the *_func type is usually inferred. The annoying part is that we can no longer use nil to indicate failure, so this introduces a funcInfo.valid() method and replaces nil checks with calls to valid. Change-Id: I9b8075ef1c31185c1943596d96dec45c7ab5100f Reviewed-on: https://go-review.googlesource.com/37331 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Diffstat (limited to 'src/runtime/signal_linux_s390x.go')
-rw-r--r--src/runtime/signal_linux_s390x.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/signal_linux_s390x.go b/src/runtime/signal_linux_s390x.go
index de71ee950d..a31f436411 100644
--- a/src/runtime/signal_linux_s390x.go
+++ b/src/runtime/signal_linux_s390x.go
@@ -103,7 +103,7 @@ func (c *sigctxt) preparePanic(sig uint32, gp *g) {
// but we do recognize the link register as code,
// then assume this was a call to non-code and treat like
// pc == 0, to make unwinding show the context.
- if pc != 0 && findfunc(pc) == nil && findfunc(uintptr(c.link())) != nil {
+ if pc != 0 && !findfunc(pc).valid() && findfunc(uintptr(c.link())).valid() {
pc = 0
}