runtime: clean up canpanic

* The gp argument to canpanic is always equivalent to getg(), so no need
to pass it at all.
* gp must not be nil or _g_.m would have crashed, so no need to check
for nil.
* Use acquirem to better reason about preemption.

Change-Id: Ic7dc8dc1e56ab4c1644965f6aeba16807cdb2df4
Reviewed-on: https://go-review.googlesource.com/c/go/+/418575
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Pratt 2022-07-20 11:09:14 -04:00
parent 9dbc0f3556
commit 7e952962df
5 changed files with 15 additions and 12 deletions

View file

@ -815,7 +815,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
//go:linkname sigpanic
func sigpanic() {
g := getg()
if !canpanic(g) {
if !canpanic() {
throw("unexpected signal during runtime execution")
}