mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: remove old stack scanning code
This removes scang and preemptscan, since the stack scanning code now uses suspendG. For #10958, #24543. Change-Id: Ic868bf5d6dcce40662a82cb27bb996cb74d0720e Reviewed-on: https://go-review.googlesource.com/c/go/+/201138 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
3f834114ab
commit
1b79afe460
3 changed files with 1 additions and 142 deletions
|
|
@ -916,7 +916,7 @@ func round2(x int32) int32 {
|
|||
// Stack growth is multiplicative, for constant amortized cost.
|
||||
//
|
||||
// g->atomicstatus will be Grunning or Gscanrunning upon entry.
|
||||
// If the GC is trying to stop this g then it will set preemptscan to true.
|
||||
// If the scheduler is trying to stop this g, then it will set preemptStop.
|
||||
//
|
||||
// This must be nowritebarrierrec because it can be called as part of
|
||||
// stack growth from other nowritebarrierrec functions, but the
|
||||
|
|
@ -1022,34 +1022,7 @@ func newstack() {
|
|||
preemptPark(gp) // never returns
|
||||
}
|
||||
|
||||
// Synchronize with scang.
|
||||
casgstatus(gp, _Grunning, _Gwaiting)
|
||||
if gp.preemptscan {
|
||||
for !castogscanstatus(gp, _Gwaiting, _Gscanwaiting) {
|
||||
// Likely to be racing with the GC as
|
||||
// it sees a _Gwaiting and does the
|
||||
// stack scan. If so, gcworkdone will
|
||||
// be set and gcphasework will simply
|
||||
// return.
|
||||
}
|
||||
if !gp.gcscandone {
|
||||
// gcw is safe because we're on the
|
||||
// system stack.
|
||||
gcw := &gp.m.p.ptr().gcw
|
||||
scanstack(gp, gcw)
|
||||
gp.gcscandone = true
|
||||
}
|
||||
gp.preemptscan = false
|
||||
gp.preempt = false
|
||||
casfrom_Gscanstatus(gp, _Gscanwaiting, _Gwaiting)
|
||||
// This clears gcscanvalid.
|
||||
casgstatus(gp, _Gwaiting, _Grunning)
|
||||
gp.stackguard0 = gp.stack.lo + _StackGuard
|
||||
gogo(&gp.sched) // never return
|
||||
}
|
||||
|
||||
// Act like goroutine called runtime.Gosched.
|
||||
casgstatus(gp, _Gwaiting, _Grunning)
|
||||
gopreempt_m(gp) // never return
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue