aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack1.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-12-05 11:40:41 -0500
committerRuss Cox <rsc@golang.org>2014-12-05 11:40:41 -0500
commit444839014bce7046165358bb6e920ad35c3463c2 (patch)
tree3c4de4622d441b5d5bc9caf67a5b5014abc46676 /src/runtime/stack1.go
parentb8540fc28867623b23c23e97108a6e975e8a49e7 (diff)
parent829b286f2c5dc450394c526cd91ba8c8bea9bac8 (diff)
downloadgo-444839014bce7046165358bb6e920ad35c3463c2.tar.xz
[dev.garbage] all: merge dev.cc (81884b89bd88) into dev.garbage
TBR=rlh CC=golang-codereviews https://golang.org/cl/181100044
Diffstat (limited to 'src/runtime/stack1.go')
-rw-r--r--src/runtime/stack1.go14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/runtime/stack1.go b/src/runtime/stack1.go
index c14347dbdf..28000864d6 100644
--- a/src/runtime/stack1.go
+++ b/src/runtime/stack1.go
@@ -718,9 +718,7 @@ func newstack() {
gothrow("stack overflow")
}
- oldstatus := readgstatus(gp)
- oldstatus &^= _Gscan
- casgstatus(gp, oldstatus, _Gcopystack) // oldstatus is Gwaiting or Grunnable
+ casgstatus(gp, _Gwaiting, _Gcopystack)
// The concurrent GC will not scan the stack while we are doing the copy since
// the gp is in a Gcopystack status.
@@ -789,15 +787,7 @@ func shrinkstack(gp *g) {
print("shrinking stack ", oldsize, "->", newsize, "\n")
}
- // This is being done in a Gscan state and was initiated by the GC so no need to move to
- // the Gcopystate.
- // The world is stopped, so the goroutine must be Gwaiting or Grunnable,
- // and what it is is not changing underfoot.
- oldstatus := readgstatus(gp) &^ _Gscan
- if oldstatus != _Gwaiting && oldstatus != _Grunnable {
- gothrow("status is not Gwaiting or Grunnable")
- }
- casgstatus(gp, oldstatus, _Gcopystack)
+ oldstatus := casgcopystack(gp)
copystack(gp, newsize)
casgstatus(gp, _Gcopystack, oldstatus)
}