]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: trivial replacements of g in remaining files
authorMichael Pratt <mpratt@google.com>
Wed, 20 Jul 2022 17:18:06 +0000 (13:18 -0400)
committerMichael Pratt <mpratt@google.com>
Tue, 2 Aug 2022 18:52:33 +0000 (18:52 +0000)
Rename g variables to gp for consistency.

Change-Id: I09ecdc7e8439637bc0e32f9c5f96f515e6436362
Reviewed-on: https://go-review.googlesource.com/c/go/+/418591
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>

src/runtime/cgocheck.go
src/runtime/debug.go
src/runtime/export_debuglog_test.go
src/runtime/export_test.go
src/runtime/malloc.go
src/runtime/msan.go
src/runtime/os_js.go
src/runtime/os_plan9.go
src/runtime/signal_windows.go

index 74a2ec09bcd6802a78d0cfc04df6d3837a93f37c..6b492093eacc09ac948329db84b64dbf992a55f2 100644 (file)
@@ -32,14 +32,14 @@ func cgoCheckWriteBarrier(dst *uintptr, src uintptr) {
 
        // If we are running on the system stack then dst might be an
        // address on the stack, which is OK.
-       g := getg()
-       if g == g.m.g0 || g == g.m.gsignal {
+       gp := getg()
+       if gp == gp.m.g0 || gp == gp.m.gsignal {
                return
        }
 
        // Allocating memory can write to various mfixalloc structs
        // that look like they are non-Go memory.
-       if g.m.mallocing != 0 {
+       if gp.m.mallocing != 0 {
                return
        }
 
index 0ab23e0eb79ccc835ec9bc9b9b932efc1a241102..669c36f0d584bd7e2d464a893c6afc92f45c4cfa 100644 (file)
@@ -85,13 +85,13 @@ func debug_modinfo() string {
 //go:linkname mayMoreStackPreempt
 func mayMoreStackPreempt() {
        // Don't do anything on the g0 or gsignal stack.
-       g := getg()
-       if g == g.m.g0 || g == g.m.gsignal {
+       gp := getg()
+       if gp == gp.m.g0 || gp == gp.m.gsignal {
                return
        }
        // Force a preemption, unless the stack is already poisoned.
-       if g.stackguard0 < stackPoisonMin {
-               g.stackguard0 = stackPreempt
+       if gp.stackguard0 < stackPoisonMin {
+               gp.stackguard0 = stackPreempt
        }
 }
 
@@ -104,12 +104,12 @@ func mayMoreStackPreempt() {
 //go:linkname mayMoreStackMove
 func mayMoreStackMove() {
        // Don't do anything on the g0 or gsignal stack.
-       g := getg()
-       if g == g.m.g0 || g == g.m.gsignal {
+       gp := getg()
+       if gp == gp.m.g0 || gp == gp.m.gsignal {
                return
        }
        // Force stack movement, unless the stack is already poisoned.
-       if g.stackguard0 < stackPoisonMin {
-               g.stackguard0 = stackForceMove
+       if gp.stackguard0 < stackPoisonMin {
+               gp.stackguard0 = stackForceMove
        }
 }
index 1a9074e64641344a97adb7db0627a623129af45e..c9dfdcb3936dcfa417c62f313a471fad6018aa29 100644 (file)
@@ -25,11 +25,11 @@ func (l *dlogger) S(x string) *dlogger   { return l.s(x) }
 func (l *dlogger) PC(x uintptr) *dlogger { return l.pc(x) }
 
 func DumpDebugLog() string {
-       g := getg()
-       g.writebuf = make([]byte, 0, 1<<20)
+       gp := getg()
+       gp.writebuf = make([]byte, 0, 1<<20)
        printDebugLog()
-       buf := g.writebuf
-       g.writebuf = nil
+       buf := gp.writebuf
+       gp.writebuf = nil
 
        return string(buf)
 }
index e60bcedf147221e578a0d032b038dd48ad31ad96..ab0537d8b20f2b3b0bdc2dbefb5db579e65d342f 100644 (file)
@@ -460,17 +460,17 @@ func MapBucketsPointerIsNil(m map[int]int) bool {
 }
 
 func LockOSCounts() (external, internal uint32) {
-       g := getg()
-       if g.m.lockedExt+g.m.lockedInt == 0 {
-               if g.lockedm != 0 {
+       gp := getg()
+       if gp.m.lockedExt+gp.m.lockedInt == 0 {
+               if gp.lockedm != 0 {
                        panic("lockedm on non-locked goroutine")
                }
        } else {
-               if g.lockedm == 0 {
+               if gp.lockedm == 0 {
                        panic("nil lockedm on locked goroutine")
                }
        }
-       return g.m.lockedExt, g.m.lockedInt
+       return gp.m.lockedExt, gp.m.lockedInt
 }
 
 //go:noinline
index eb24fdb0e8f57b2c897112fa4293a17b538424f1..5866a4597b1c1f78b7a0a69bc713a909686ddd63 100644 (file)
@@ -1245,7 +1245,7 @@ func nextSample() uintptr {
        }
        if GOOS == "plan9" {
                // Plan 9 doesn't support floating point in note handler.
-               if g := getg(); g == g.m.gsignal {
+               if gp := getg(); gp == gp.m.gsignal {
                        return nextSampleNoFP()
                }
        }
index c4852165830a396c801b78dd425d83d10081149c..5e2aae1bd1616e312e3d61ccde0e89e28d0acf74 100644 (file)
@@ -31,8 +31,8 @@ const msanenabled = true
 //
 //go:nosplit
 func msanread(addr unsafe.Pointer, sz uintptr) {
-       g := getg()
-       if g == nil || g.m == nil || g == g.m.g0 || g == g.m.gsignal {
+       gp := getg()
+       if gp == nil || gp.m == nil || gp == gp.m.g0 || gp == gp.m.gsignal {
                return
        }
        domsanread(addr, sz)
index 7fbeb5a832b2849590b7f2bfa34412b7c46bb455..7ae0e8d3ece718753fe324677bc9a56123f3e021 100644 (file)
@@ -49,13 +49,13 @@ func osyield_no_g() {
 const _SIGSEGV = 0xb
 
 func sigpanic() {
-       g := getg()
+       gp := getg()
        if !canpanic() {
                throw("unexpected signal during runtime execution")
        }
 
        // js only invokes the exception handler for memory faults.
-       g.sig = _SIGSEGV
+       gp.sig = _SIGSEGV
        panicmem()
 }
 
index ab768825f3911cdc076793de0383144d5e43c6da..6f4578ff486eb760bc5312a28145ed7bf303e13f 100644 (file)
@@ -75,13 +75,13 @@ func os_sigpipe() {
 }
 
 func sigpanic() {
-       g := getg()
+       gp := getg()
        if !canpanic() {
                throw("unexpected signal during runtime execution")
        }
 
-       note := gostringnocopy((*byte)(unsafe.Pointer(g.m.notesig)))
-       switch g.sig {
+       note := gostringnocopy((*byte)(unsafe.Pointer(gp.m.notesig)))
+       switch gp.sig {
        case _SIGRFAULT, _SIGWFAULT:
                i := indexNoFloat(note, "addr=")
                if i >= 0 {
@@ -92,17 +92,17 @@ func sigpanic() {
                        panicmem()
                }
                addr := note[i:]
-               g.sigcode1 = uintptr(atolwhex(addr))
-               if g.sigcode1 < 0x1000 {
+               gp.sigcode1 = uintptr(atolwhex(addr))
+               if gp.sigcode1 < 0x1000 {
                        panicmem()
                }
-               if g.paniconfault {
-                       panicmemAddr(g.sigcode1)
+               if gp.paniconfault {
+                       panicmemAddr(gp.sigcode1)
                }
-               print("unexpected fault address ", hex(g.sigcode1), "\n")
+               print("unexpected fault address ", hex(gp.sigcode1), "\n")
                throw("fault")
        case _SIGTRAP:
-               if g.paniconfault {
+               if gp.paniconfault {
                        panicmem()
                }
                throw(note)
index b20cac8a8bec0c575537adc0ee2df98b7b4d9ff1..4a0287dcfdef6c6998be484a226d7e620307cbe0 100644 (file)
@@ -245,20 +245,20 @@ func winthrow(info *exceptionrecord, r *context, gp *g) {
 }
 
 func sigpanic() {
-       g := getg()
+       gp := getg()
        if !canpanic() {
                throw("unexpected signal during runtime execution")
        }
 
-       switch g.sig {
+       switch gp.sig {
        case _EXCEPTION_ACCESS_VIOLATION:
-               if g.sigcode1 < 0x1000 {
+               if gp.sigcode1 < 0x1000 {
                        panicmem()
                }
-               if g.paniconfault {
-                       panicmemAddr(g.sigcode1)
+               if gp.paniconfault {
+                       panicmemAddr(gp.sigcode1)
                }
-               print("unexpected fault address ", hex(g.sigcode1), "\n")
+               print("unexpected fault address ", hex(gp.sigcode1), "\n")
                throw("fault")
        case _EXCEPTION_INT_DIVIDE_BY_ZERO:
                panicdivide()