aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-08-24 12:04:51 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-08-24 12:04:51 +0400
commitb91223edd19590b4ac79ae14b66b8d5a80825e36 (patch)
treea04c5c94dfa6788c40beb2217512c2db5dc76df0 /src/pkg/runtime
parent651d0cf204da51eddec88c32c039d750ef7edbbd (diff)
downloadgo-b91223edd19590b4ac79ae14b66b8d5a80825e36.tar.xz
runtime: cache unrolled GC bitmask
Cache unrolled GC bitmask for types up to 64/32K on 64/32-bit systems, this corresponds to up to 4K cached bitmask. Perf builders say that 2% of time is spent in unrollgcproginplace_m/unrollgcprog1 on http benchmark: http://goperfd.appspot.com/log/f42045f45bf61a0da53b724a7c8567824a0ad6c9 LGTM=rsc R=golang-codereviews, rsc CC=golang-codereviews, khr, rlh https://golang.org/cl/122680043
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/malloc.go2
-rw-r--r--src/pkg/runtime/mgc0.h3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/pkg/runtime/malloc.go b/src/pkg/runtime/malloc.go
index 578fbd1c2d..ffe571a18a 100644
--- a/src/pkg/runtime/malloc.go
+++ b/src/pkg/runtime/malloc.go
@@ -28,7 +28,7 @@ const (
bitsMask = 1<<bitsPerPointer - 1
pointersPerByte = 8 / bitsPerPointer
bitPtrMask = bitsMask << 2
- maxGCMask = 0 // disabled because wastes several bytes of memory
+ maxGCMask = 64
bitsDead = 0
bitsPointer = 2
diff --git a/src/pkg/runtime/mgc0.h b/src/pkg/runtime/mgc0.h
index 7449398b9f..a7292effd3 100644
--- a/src/pkg/runtime/mgc0.h
+++ b/src/pkg/runtime/mgc0.h
@@ -55,7 +55,8 @@ enum {
BitsIface = 2,
BitsEface = 3,
- MaxGCMask = 0, // disabled because wastes several bytes of memory
+ // 64 bytes cover objects of size 1024/512 on 64/32 bits, respectively.
+ MaxGCMask = 64,
};
// Bits in per-word bitmap.