diff options
| author | Rick Hudson <rlh@golang.org> | 2016-03-14 12:02:02 -0400 |
|---|---|---|
| committer | Rick Hudson <rlh@golang.org> | 2016-04-27 21:54:59 +0000 |
| commit | f8d0d4fd59b6cb6f875eac7753f036b10a28f995 (patch) | |
| tree | 800bbd89e2777867363a2ee542f2802a45e64edf /src/runtime/malloc.go | |
| parent | 8dda1c4c08adf8b2107dec1c0d70d24443269ccd (diff) | |
| download | go-f8d0d4fd59b6cb6f875eac7753f036b10a28f995.tar.xz | |
[dev.garbage] runtime: cleanup and optimize span.base()
Prior to this CL the base of a span was calculated in various
places using shifts or calls to base(). This CL now
always calls base() which has been optimized to calculate the
base of the span when the span is initialized and store that
value in the span structure.
Change-Id: I661f2bfa21e3748a249cdf049ef9062db6e78100
Reviewed-on: https://go-review.googlesource.com/20703
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/malloc.go')
| -rw-r--r-- | src/runtime/malloc.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 2da13f2073..31335dae80 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -711,7 +711,7 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer { s = largeAlloc(size, flags) }) s.freeindex = 1 - x = unsafe.Pointer(uintptr(s.start << pageShift)) + x = unsafe.Pointer(s.base()) size = s.elemsize } @@ -833,7 +833,7 @@ func largeAlloc(size uintptr, flag uint32) *mspan { if s == nil { throw("out of memory") } - s.limit = uintptr(s.start)<<_PageShift + size + s.limit = s.base() + size heapBitsForSpan(s.base()).initSpan(s) return s } |
