aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2016-04-29 12:09:36 -0400
committerRick Hudson <rlh@golang.org>2016-04-29 16:47:11 +0000
commite9eaa181fcadc2162baa62ccd8bfeb610acfdd55 (patch)
tree28ee244eff4327d434911a6d789864679b410033 /src/runtime
parentb3579c095e00f89d8c92c2aa4fb4af222a96f429 (diff)
downloadgo-e9eaa181fcadc2162baa62ccd8bfeb610acfdd55.tar.xz
[dev.garbage] runtime: simplify nextFreeFast so it is inlined
nextFreeFast is currently not inlined by the compiler due to its size and complexity. This CL simplifies nextFreeFast by letting the slow path handle (nextFree) handle a corner cases. Change-Id: Ia9c5d1a7912bcb4bec072f5fd240f0e0bafb20e4 Reviewed-on: https://go-review.googlesource.com/22598 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/malloc.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 438cd06161..c9cc82192d 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -495,14 +495,11 @@ func nextFreeFast(s *mspan) gclinkptr {
if theBit < 64 {
result := s.freeindex + uintptr(theBit)
if result < s.nelems {
- s.allocCache >>= (theBit + 1)
freeidx := result + 1
if freeidx%64 == 0 && freeidx != s.nelems {
- // We just incremented s.freeindex so it isn't 0
- // so we are moving to the next aCache.
- whichByte := freeidx / 8
- s.refillAllocCache(whichByte)
+ return 0
}
+ s.allocCache >>= (theBit + 1)
s.freeindex = freeidx
v := gclinkptr(result*s.elemsize + s.base())
s.allocCount++