mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +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
9 changed files with 40 additions and 40 deletions
|
|
@ -32,14 +32,14 @@ func cgoCheckWriteBarrier(dst *uintptr, src uintptr) {
|
||||||
|
|
||||||
// If we are running on the system stack then dst might be an
|
// If we are running on the system stack then dst might be an
|
||||||
// address on the stack, which is OK.
|
// address on the stack, which is OK.
|
||||||
g := getg()
|
gp := getg()
|
||||||
if g == g.m.g0 || g == g.m.gsignal {
|
if gp == gp.m.g0 || gp == gp.m.gsignal {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocating memory can write to various mfixalloc structs
|
// Allocating memory can write to various mfixalloc structs
|
||||||
// that look like they are non-Go memory.
|
// that look like they are non-Go memory.
|
||||||
if g.m.mallocing != 0 {
|
if gp.m.mallocing != 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,13 +85,13 @@ func debug_modinfo() string {
|
||||||
//go:linkname mayMoreStackPreempt
|
//go:linkname mayMoreStackPreempt
|
||||||
func mayMoreStackPreempt() {
|
func mayMoreStackPreempt() {
|
||||||
// Don't do anything on the g0 or gsignal stack.
|
// Don't do anything on the g0 or gsignal stack.
|
||||||
g := getg()
|
gp := getg()
|
||||||
if g == g.m.g0 || g == g.m.gsignal {
|
if gp == gp.m.g0 || gp == gp.m.gsignal {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Force a preemption, unless the stack is already poisoned.
|
// Force a preemption, unless the stack is already poisoned.
|
||||||
if g.stackguard0 < stackPoisonMin {
|
if gp.stackguard0 < stackPoisonMin {
|
||||||
g.stackguard0 = stackPreempt
|
gp.stackguard0 = stackPreempt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,12 +104,12 @@ func mayMoreStackPreempt() {
|
||||||
//go:linkname mayMoreStackMove
|
//go:linkname mayMoreStackMove
|
||||||
func mayMoreStackMove() {
|
func mayMoreStackMove() {
|
||||||
// Don't do anything on the g0 or gsignal stack.
|
// Don't do anything on the g0 or gsignal stack.
|
||||||
g := getg()
|
gp := getg()
|
||||||
if g == g.m.g0 || g == g.m.gsignal {
|
if gp == gp.m.g0 || gp == gp.m.gsignal {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Force stack movement, unless the stack is already poisoned.
|
// Force stack movement, unless the stack is already poisoned.
|
||||||
if g.stackguard0 < stackPoisonMin {
|
if gp.stackguard0 < stackPoisonMin {
|
||||||
g.stackguard0 = stackForceMove
|
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 (l *dlogger) PC(x uintptr) *dlogger { return l.pc(x) }
|
||||||
|
|
||||||
func DumpDebugLog() string {
|
func DumpDebugLog() string {
|
||||||
g := getg()
|
gp := getg()
|
||||||
g.writebuf = make([]byte, 0, 1<<20)
|
gp.writebuf = make([]byte, 0, 1<<20)
|
||||||
printDebugLog()
|
printDebugLog()
|
||||||
buf := g.writebuf
|
buf := gp.writebuf
|
||||||
g.writebuf = nil
|
gp.writebuf = nil
|
||||||
|
|
||||||
return string(buf)
|
return string(buf)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -460,17 +460,17 @@ func MapBucketsPointerIsNil(m map[int]int) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func LockOSCounts() (external, internal uint32) {
|
func LockOSCounts() (external, internal uint32) {
|
||||||
g := getg()
|
gp := getg()
|
||||||
if g.m.lockedExt+g.m.lockedInt == 0 {
|
if gp.m.lockedExt+gp.m.lockedInt == 0 {
|
||||||
if g.lockedm != 0 {
|
if gp.lockedm != 0 {
|
||||||
panic("lockedm on non-locked goroutine")
|
panic("lockedm on non-locked goroutine")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if g.lockedm == 0 {
|
if gp.lockedm == 0 {
|
||||||
panic("nil lockedm on locked goroutine")
|
panic("nil lockedm on locked goroutine")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return g.m.lockedExt, g.m.lockedInt
|
return gp.m.lockedExt, gp.m.lockedInt
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:noinline
|
//go:noinline
|
||||||
|
|
|
||||||
|
|
@ -1245,7 +1245,7 @@ func nextSample() uintptr {
|
||||||
}
|
}
|
||||||
if GOOS == "plan9" {
|
if GOOS == "plan9" {
|
||||||
// Plan 9 doesn't support floating point in note handler.
|
// 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()
|
return nextSampleNoFP()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ const msanenabled = true
|
||||||
//
|
//
|
||||||
//go:nosplit
|
//go:nosplit
|
||||||
func msanread(addr unsafe.Pointer, sz uintptr) {
|
func msanread(addr unsafe.Pointer, sz uintptr) {
|
||||||
g := getg()
|
gp := getg()
|
||||||
if g == nil || g.m == nil || g == g.m.g0 || g == g.m.gsignal {
|
if gp == nil || gp.m == nil || gp == gp.m.g0 || gp == gp.m.gsignal {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
domsanread(addr, sz)
|
domsanread(addr, sz)
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,13 @@ func osyield_no_g() {
|
||||||
const _SIGSEGV = 0xb
|
const _SIGSEGV = 0xb
|
||||||
|
|
||||||
func sigpanic() {
|
func sigpanic() {
|
||||||
g := getg()
|
gp := getg()
|
||||||
if !canpanic() {
|
if !canpanic() {
|
||||||
throw("unexpected signal during runtime execution")
|
throw("unexpected signal during runtime execution")
|
||||||
}
|
}
|
||||||
|
|
||||||
// js only invokes the exception handler for memory faults.
|
// js only invokes the exception handler for memory faults.
|
||||||
g.sig = _SIGSEGV
|
gp.sig = _SIGSEGV
|
||||||
panicmem()
|
panicmem()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,13 @@ func os_sigpipe() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func sigpanic() {
|
func sigpanic() {
|
||||||
g := getg()
|
gp := getg()
|
||||||
if !canpanic() {
|
if !canpanic() {
|
||||||
throw("unexpected signal during runtime execution")
|
throw("unexpected signal during runtime execution")
|
||||||
}
|
}
|
||||||
|
|
||||||
note := gostringnocopy((*byte)(unsafe.Pointer(g.m.notesig)))
|
note := gostringnocopy((*byte)(unsafe.Pointer(gp.m.notesig)))
|
||||||
switch g.sig {
|
switch gp.sig {
|
||||||
case _SIGRFAULT, _SIGWFAULT:
|
case _SIGRFAULT, _SIGWFAULT:
|
||||||
i := indexNoFloat(note, "addr=")
|
i := indexNoFloat(note, "addr=")
|
||||||
if i >= 0 {
|
if i >= 0 {
|
||||||
|
|
@ -92,17 +92,17 @@ func sigpanic() {
|
||||||
panicmem()
|
panicmem()
|
||||||
}
|
}
|
||||||
addr := note[i:]
|
addr := note[i:]
|
||||||
g.sigcode1 = uintptr(atolwhex(addr))
|
gp.sigcode1 = uintptr(atolwhex(addr))
|
||||||
if g.sigcode1 < 0x1000 {
|
if gp.sigcode1 < 0x1000 {
|
||||||
panicmem()
|
panicmem()
|
||||||
}
|
}
|
||||||
if g.paniconfault {
|
if gp.paniconfault {
|
||||||
panicmemAddr(g.sigcode1)
|
panicmemAddr(gp.sigcode1)
|
||||||
}
|
}
|
||||||
print("unexpected fault address ", hex(g.sigcode1), "\n")
|
print("unexpected fault address ", hex(gp.sigcode1), "\n")
|
||||||
throw("fault")
|
throw("fault")
|
||||||
case _SIGTRAP:
|
case _SIGTRAP:
|
||||||
if g.paniconfault {
|
if gp.paniconfault {
|
||||||
panicmem()
|
panicmem()
|
||||||
}
|
}
|
||||||
throw(note)
|
throw(note)
|
||||||
|
|
|
||||||
|
|
@ -245,20 +245,20 @@ func winthrow(info *exceptionrecord, r *context, gp *g) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func sigpanic() {
|
func sigpanic() {
|
||||||
g := getg()
|
gp := getg()
|
||||||
if !canpanic() {
|
if !canpanic() {
|
||||||
throw("unexpected signal during runtime execution")
|
throw("unexpected signal during runtime execution")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch g.sig {
|
switch gp.sig {
|
||||||
case _EXCEPTION_ACCESS_VIOLATION:
|
case _EXCEPTION_ACCESS_VIOLATION:
|
||||||
if g.sigcode1 < 0x1000 {
|
if gp.sigcode1 < 0x1000 {
|
||||||
panicmem()
|
panicmem()
|
||||||
}
|
}
|
||||||
if g.paniconfault {
|
if gp.paniconfault {
|
||||||
panicmemAddr(g.sigcode1)
|
panicmemAddr(gp.sigcode1)
|
||||||
}
|
}
|
||||||
print("unexpected fault address ", hex(g.sigcode1), "\n")
|
print("unexpected fault address ", hex(gp.sigcode1), "\n")
|
||||||
throw("fault")
|
throw("fault")
|
||||||
case _EXCEPTION_INT_DIVIDE_BY_ZERO:
|
case _EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||||
panicdivide()
|
panicdivide()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue