From: Matthew Dempsky Date: Tue, 12 Apr 2016 22:51:24 +0000 (-0700) Subject: runtime: simplify setPanicOnFault slightly X-Git-Tag: go1.7beta1~718 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6af4e996e2f0408f159a8553d11122b9fe052ffb;p=gostls13.git runtime: simplify setPanicOnFault slightly No need to acquire the M just to change G's paniconfault flag, and the original C implementation of SetPanicOnFault did not. The M acquisition logic is an artifact of golang.org/cl/131010044, which was started before golang.org/cl/123640043 (which introduced the current "getg" function) was submitted. Change-Id: I6d1939008660210be46904395cf5f5bbc2c8f754 Reviewed-on: https://go-review.googlesource.com/21935 Run-TryBot: Matthew Dempsky TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/runtime/rdebug.go b/src/runtime/rdebug.go index d966734813..1b213f1934 100644 --- a/src/runtime/rdebug.go +++ b/src/runtime/rdebug.go @@ -15,9 +15,8 @@ func setMaxStack(in int) (out int) { //go:linkname setPanicOnFault runtime/debug.setPanicOnFault func setPanicOnFault(new bool) (old bool) { - mp := acquirem() - old = mp.curg.paniconfault - mp.curg.paniconfault = new - releasem(mp) + _g_ := getg() + old = _g_.paniconfault + _g_.paniconfault = new return old }