diff options
| author | Austin Clements <austin@google.com> | 2015-03-30 17:45:22 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2015-04-02 15:28:56 +0000 |
| commit | 822a24b602038a443fc2b4c30f472eb904c30e23 (patch) | |
| tree | 7feb52d6add057da203030b10873d593cfbcbda8 /src/runtime/hashmap.go | |
| parent | 6134caf1f965045bcc009c0bdb26031ce5583892 (diff) | |
| download | go-822a24b602038a443fc2b4c30f472eb904c30e23.tar.xz | |
runtime: remove checkgc code from hashmap
Currently hashmap is riddled with code that attempts to force a GC on
the next allocation if checkgc is set. This no longer works as
originally intended with the concurrent collector, and is apparently
no longer used anyway.
Remove checkgc.
Change-Id: Ia6c17c405fa8821dc2e6af28d506c1133ab1ca0c
Reviewed-on: https://go-review.googlesource.com/8355
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/hashmap.go')
| -rw-r--r-- | src/runtime/hashmap.go | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/src/runtime/hashmap.go b/src/runtime/hashmap.go index aaaef48381..9ca33992bb 100644 --- a/src/runtime/hashmap.go +++ b/src/runtime/hashmap.go @@ -96,9 +96,6 @@ const ( // sentinel bucket ID for iterator checks noCheck = 1<<(8*ptrSize) - 1 - - // trigger a garbage collection at every alloc called from this code - checkgc = false ) // A header for a Go map. @@ -246,16 +243,10 @@ func makemap(t *maptype, hint int64, h *hmap, bucket unsafe.Pointer) *hmap { // If hint is large zeroing this memory could take a while. buckets := bucket if B != 0 { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } buckets = newarray(t.bucket, uintptr(1)<<B) } // initialize Hmap - if checkgc { - memstats.next_gc = memstats.heap_alloc - } if h == nil { h = (*hmap)(newobject(t.hmap)) } @@ -430,9 +421,6 @@ func mapassign1(t *maptype, h *hmap, key unsafe.Pointer, val unsafe.Pointer) { hash := alg.hash(key, uintptr(h.hash0)) if h.buckets == nil { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } h.buckets = newarray(t.bucket, 1) } @@ -493,9 +481,6 @@ again: if inserti == nil { // all current buckets are full, allocate a new one. - if checkgc { - memstats.next_gc = memstats.heap_alloc - } newb := (*bmap)(newobject(t.bucket)) h.setoverflow(t, b, newb) inserti = &newb.tophash[0] @@ -505,17 +490,11 @@ again: // store new key/value at insert position if t.indirectkey { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } kmem := newobject(t.key) *(*unsafe.Pointer)(insertk) = kmem insertk = kmem } if t.indirectvalue { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } vmem := newobject(t.elem) *(*unsafe.Pointer)(insertv) = vmem insertv = vmem @@ -776,9 +755,6 @@ func hashGrow(t *maptype, h *hmap) { throw("evacuation not done in time") } oldbuckets := h.buckets - if checkgc { - memstats.next_gc = memstats.heap_alloc - } newbuckets := newarray(t.bucket, uintptr(1)<<(h.B+1)) flags := h.flags &^ (iterator | oldIterator) if h.flags&iterator != 0 { @@ -879,9 +855,6 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) { if (hash & newbit) == 0 { b.tophash[i] = evacuatedX if xi == bucketCnt { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } newx := (*bmap)(newobject(t.bucket)) h.setoverflow(t, x, newx) x = newx @@ -906,9 +879,6 @@ func evacuate(t *maptype, h *hmap, oldbucket uintptr) { } else { b.tophash[i] = evacuatedY if yi == bucketCnt { - if checkgc { - memstats.next_gc = memstats.heap_alloc - } newy := (*bmap)(newobject(t.bucket)) h.setoverflow(t, y, newy) y = newy |
