diff options
| author | Rick Hudson <rlh@golang.org> | 2014-11-20 12:08:13 -0500 |
|---|---|---|
| committer | Rick Hudson <rlh@golang.org> | 2014-11-20 12:08:13 -0500 |
| commit | 8cfb084534c764f02c8a3b5c72d2b164d22591fd (patch) | |
| tree | 1f351d2ccbe28ccc9434c3c667c6d0f6b624a596 /src/runtime/malloc.go | |
| parent | 3034be60d87cb927a6fcded5ffb6663ca5f93674 (diff) | |
| download | go-8cfb084534c764f02c8a3b5c72d2b164d22591fd.tar.xz | |
[dev.garbage] runtime: Turn concurrent GC on by default. Avoid write barriers for GC internal structures such as free lists.
LGTM=rsc
R=rsc
CC=golang-codereviews, rsc
https://golang.org/cl/179000043
Diffstat (limited to 'src/runtime/malloc.go')
| -rw-r--r-- | src/runtime/malloc.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index f90a8f84a3..86e20b2490 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -140,14 +140,14 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer { // Allocate a new maxTinySize block. s = c.alloc[tinySizeClass] v := s.freelist - if v == nil { + if v.ptr() == nil { systemstack(func() { mCache_Refill(c, tinySizeClass) }) s = c.alloc[tinySizeClass] v = s.freelist } - s.freelist = v.next + s.freelist = v.ptr().next s.ref++ //TODO: prefetch v.next x = unsafe.Pointer(v) @@ -170,19 +170,19 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer { size = uintptr(class_to_size[sizeclass]) s = c.alloc[sizeclass] v := s.freelist - if v == nil { + if v.ptr() == nil { systemstack(func() { mCache_Refill(c, int32(sizeclass)) }) s = c.alloc[sizeclass] v = s.freelist } - s.freelist = v.next + s.freelist = v.ptr().next s.ref++ //TODO: prefetch x = unsafe.Pointer(v) if flags&flagNoZero == 0 { - v.next = nil + v.ptr().next = 0 if size > 2*ptrSize && ((*[2]uintptr)(x))[1] != 0 { memclr(unsafe.Pointer(v), size) } @@ -341,7 +341,7 @@ marked: } } - if memstats.heap_alloc >= memstats.next_gc { + if memstats.heap_alloc >= memstats.next_gc/2 { gogc(0) } @@ -475,7 +475,7 @@ func gogc(force int32) { systemstack(stoptheworld) systemstack(finishsweep_m) // finish sweep before we start concurrent scan. - if false { // To turn on concurrent scan and mark set to true... + if true { // To turn on concurrent scan and mark set to true... systemstack(starttheworld) // Do a concurrent heap scan before we stop the world. systemstack(gcscan_m) |
