aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/stack.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-03-16 14:46:53 -0400
committerAustin Clements <austin@google.com>2017-04-13 18:20:35 +0000
commit407c56ae9f40d3a83ba4e259c67ccbb58d2485b0 (patch)
tree35963c69984756b7188fe468d2040524cd540889 /src/runtime/stack.go
parentab9db51e1cf651c0d6d5b56dfd0d9d452f176726 (diff)
downloadgo-407c56ae9f40d3a83ba4e259c67ccbb58d2485b0.tar.xz
runtime: generalize {alloc,free}Stack to {alloc,free}Manual
We're going to start using manually-managed spans for GC workbufs, so rename the allocate/free methods and pass in a pointer to the stats to use instead of using the stack stats directly. For #19325. Change-Id: I37df0147ae5a8e1f3cb37d59c8e57a1fcc6f2980 Reviewed-on: https://go-review.googlesource.com/38576 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/stack.go')
-rw-r--r--src/runtime/stack.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index 9e00edde61..562427a6a2 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -186,7 +186,7 @@ func stackpoolalloc(order uint8) gclinkptr {
s := list.first
if s == nil {
// no free stacks. Allocate another span worth.
- s = mheap_.allocStack(_StackCacheSize >> _PageShift)
+ s = mheap_.allocManual(_StackCacheSize>>_PageShift, &memstats.stacks_inuse)
if s == nil {
throw("out of memory")
}
@@ -248,7 +248,7 @@ func stackpoolfree(x gclinkptr, order uint8) {
// By not freeing, we prevent step #4 until GC is done.
stackpool[order].remove(s)
s.manualFreeList = 0
- mheap_.freeStack(s)
+ mheap_.freeManual(s, &memstats.stacks_inuse)
}
}
@@ -390,7 +390,7 @@ func stackalloc(n uint32) stack {
if s == nil {
// Allocate a new stack from the heap.
- s = mheap_.allocStack(npage)
+ s = mheap_.allocManual(npage, &memstats.stacks_inuse)
if s == nil {
throw("out of memory")
}
@@ -472,7 +472,7 @@ func stackfree(stk stack) {
if gcphase == _GCoff {
// Free the stack immediately if we're
// sweeping.
- mheap_.freeStack(s)
+ mheap_.freeManual(s, &memstats.stacks_inuse)
} else {
// If the GC is running, we can't return a
// stack span to the heap because it could be
@@ -1166,7 +1166,7 @@ func freeStackSpans() {
if s.allocCount == 0 {
list.remove(s)
s.manualFreeList = 0
- mheap_.freeStack(s)
+ mheap_.freeManual(s, &memstats.stacks_inuse)
}
s = next
}
@@ -1180,7 +1180,7 @@ func freeStackSpans() {
for s := stackLarge.free[i].first; s != nil; {
next := s.next
stackLarge.free[i].remove(s)
- mheap_.freeStack(s)
+ mheap_.freeManual(s, &memstats.stacks_inuse)
s = next
}
}