mirror of
https://github.com/golang/go
synced 2024-10-02 22:25:08 +00:00
runtime: trivial replacements of g in remaining files
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>
This commit is contained in:
parent
c647264619
commit
29b9a328d2
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue