]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: clean up dopanic_m
authorMichael Pratt <mpratt@google.com>
Wed, 20 Jul 2022 15:18:15 +0000 (11:18 -0400)
committerMichael Pratt <mpratt@google.com>
Tue, 2 Aug 2022 18:51:01 +0000 (18:51 +0000)
gp is a user G running on the same M as getg(), so it is a fine proxy
for gp.m.

Change-Id: I9aa1dd283ecf28878eeedd7da4ded5c901809832
Reviewed-on: https://go-review.googlesource.com/c/go/+/418576
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/runtime/panic.go

index ab8d1f82b406da5f4149c55348aa496cd2b22992..e7eee82df61c4697630c71052b986f9c01d2ed8e 100644 (file)
@@ -1240,6 +1240,8 @@ func startpanic_m() bool {
 var didothers bool
 var deadlock mutex
 
+// gp is the crashing g running on this M, but may be a user G, while getg() is
+// always g0.
 func dopanic_m(gp *g, pc, sp uintptr) bool {
        if gp.sig != 0 {
                signame := signame(gp.sig)
@@ -1252,7 +1254,6 @@ func dopanic_m(gp *g, pc, sp uintptr) bool {
        }
 
        level, all, docrash := gotraceback()
-       _g_ := getg()
        if level > 0 {
                if gp != gp.m.curg {
                        all = true
@@ -1261,7 +1262,7 @@ func dopanic_m(gp *g, pc, sp uintptr) bool {
                        print("\n")
                        goroutineheader(gp)
                        traceback(pc, sp, 0, gp)
-               } else if level >= 2 || _g_.m.throwing >= throwTypeRuntime {
+               } else if level >= 2 || gp.m.throwing >= throwTypeRuntime {
                        print("\nruntime stack:\n")
                        traceback(pc, sp, 0, gp)
                }