diff options
| author | Austin Clements <austin@google.com> | 2016-06-17 09:33:33 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2017-04-28 22:50:39 +0000 |
| commit | 295d160e017edce29b3dccfa7bb7a9e5d9434b26 (patch) | |
| tree | d25bc95ced78b6cf43be61eb82458fb6a3ee69a9 /src | |
| parent | 8e25d4ccef45860186187d4ca7428052028abbb0 (diff) | |
| download | go-295d160e017edce29b3dccfa7bb7a9e5d9434b26.tar.xz | |
runtime: make _TinySizeClass an int8 to prevent use as spanClass
Currently _TinySizeClass is untyped, which means it can accidentally
be used as a spanClass (not that I would know this from experience or
anything). Make it an int8 to avoid this mix up.
This is a cherry-pick of dev.garbage commit 81b74bf9c5.
Change-Id: I1e69eccee436ea5aa45e9a9828a013e369e03f1a
Reviewed-on: https://go-review.googlesource.com/41254
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/runtime/malloc.go | 2 | ||||
| -rw-r--r-- | src/runtime/mheap.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index ea0d585ed9..3a533d9100 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -111,7 +111,7 @@ const ( // Tiny allocator parameters, see "Tiny allocator" comment in malloc.go. _TinySize = 16 - _TinySizeClass = 2 + _TinySizeClass = int8(2) _FixAllocChunk = 16 << 10 // Chunk size for FixAlloc _MaxMHeapList = 1 << (20 - _PageShift) // Maximum page length for fixed-size list in MHeap. diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index f237ec26aa..a61ea5420c 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -326,7 +326,7 @@ type spanClass uint8 const ( numSpanClasses = _NumSizeClasses << 1 - tinySpanClass = tinySizeClass<<1 | 1 + tinySpanClass = spanClass(tinySizeClass<<1 | 1) ) func makeSpanClass(sizeclass uint8, noscan bool) spanClass { |
