]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: trivial replacements of _g_ in GC files
authorMichael Pratt <mpratt@google.com>
Wed, 20 Jul 2022 16:59:50 +0000 (12:59 -0400)
committerMichael Pratt <mpratt@google.com>
Tue, 2 Aug 2022 18:51:53 +0000 (18:51 +0000)
Change-Id: Iedf10558d9a1d3b80a151927b99660b688ed9ccb
Reviewed-on: https://go-review.googlesource.com/c/go/+/418585
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/heapdump.go
src/runtime/mbitmap.go
src/runtime/mgcsweep.go

index c7f2b7a4431a27509dcfbfd9519148f8d0d88adf..543efeded4f52ddbb40bc03c3e7f5307918610e5 100644 (file)
@@ -693,9 +693,9 @@ func mdump(m *MemStats) {
 func writeheapdump_m(fd uintptr, m *MemStats) {
        assertWorldStopped()
 
-       _g_ := getg()
-       casgstatus(_g_.m.curg, _Grunning, _Gwaiting)
-       _g_.waitreason = waitReasonDumpingHeap
+       gp := getg()
+       casgstatus(gp.m.curg, _Grunning, _Gwaiting)
+       gp.waitreason = waitReasonDumpingHeap
 
        // Set dump file.
        dumpfd = fd
@@ -710,7 +710,7 @@ func writeheapdump_m(fd uintptr, m *MemStats) {
                tmpbuf = nil
        }
 
-       casgstatus(_g_.m.curg, _Gwaiting, _Grunning)
+       casgstatus(gp.m.curg, _Gwaiting, _Grunning)
 }
 
 // dumpint() the kind & offset of each field in an object.
index a3a6590d65f17d6aa36a705bca924b7db2973402..fcf59b8b3c1743b49e145946dc3d6bcd12d3ee5e 100644 (file)
@@ -2028,11 +2028,10 @@ func getgcmask(ep any) (mask []byte) {
        }
 
        // stack
-       if _g_ := getg(); _g_.m.curg.stack.lo <= uintptr(p) && uintptr(p) < _g_.m.curg.stack.hi {
+       if gp := getg(); gp.m.curg.stack.lo <= uintptr(p) && uintptr(p) < gp.m.curg.stack.hi {
                var frame stkframe
                frame.sp = uintptr(p)
-               _g_ := getg()
-               gentraceback(_g_.m.curg.sched.pc, _g_.m.curg.sched.sp, 0, _g_.m.curg, 0, nil, 1000, getgcmaskcb, noescape(unsafe.Pointer(&frame)), 0)
+               gentraceback(gp.m.curg.sched.pc, gp.m.curg.sched.sp, 0, gp.m.curg, 0, nil, 1000, getgcmaskcb, noescape(unsafe.Pointer(&frame)), 0)
                if frame.fn.valid() {
                        locals, _, _ := getStackMap(&frame, nil, false)
                        if locals.n == 0 {
index de57f18c4ff6073c34988c22611ac171fea212ef..2ac5d507dde5c820f80a3459d9b5fa2de9281619 100644 (file)
@@ -431,8 +431,8 @@ func (s *mspan) ensureSwept() {
        // Caller must disable preemption.
        // Otherwise when this function returns the span can become unswept again
        // (if GC is triggered on another goroutine).
-       _g_ := getg()
-       if _g_.m.locks == 0 && _g_.m.mallocing == 0 && _g_ != _g_.m.g0 {
+       gp := getg()
+       if gp.m.locks == 0 && gp.m.mallocing == 0 && gp != gp.m.g0 {
                throw("mspan.ensureSwept: m is not locked")
        }
 
@@ -470,8 +470,8 @@ func (s *mspan) ensureSwept() {
 func (sl *sweepLocked) sweep(preserve bool) bool {
        // It's critical that we enter this function with preemption disabled,
        // GC must not start while we are in the middle of this function.
-       _g_ := getg()
-       if _g_.m.locks == 0 && _g_.m.mallocing == 0 && _g_ != _g_.m.g0 {
+       gp := getg()
+       if gp.m.locks == 0 && gp.m.mallocing == 0 && gp != gp.m.g0 {
                throw("mspan.sweep: m is not locked")
        }