]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: simplify setPanicOnFault slightly
authorMatthew Dempsky <mdempsky@google.com>
Tue, 12 Apr 2016 22:51:24 +0000 (15:51 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 13 Apr 2016 06:14:06 +0000 (06:14 +0000)
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 <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/runtime/rdebug.go

index d9667348135607df01dd2fa93a9365eef09b8123..1b213f19340548be21e383f7d808853b2f934b8d 100644 (file)
@@ -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
 }