aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.goc
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2013-12-18 17:13:59 -0800
committerKeith Randall <khr@golang.org>2013-12-18 17:13:59 -0800
commit2d20c0d6257f5dfc57bb8a78f4e2824803bd6d0e (patch)
tree223ddbecf5057fdd17b2a6b61877ee8e47b04c93 /src/pkg/runtime/malloc.goc
parent7eb45d3c4a0956fc2207001360472ad048e544bc (diff)
downloadgo-2d20c0d6257f5dfc57bb8a78f4e2824803bd6d0e.tar.xz
runtime: mark objects in free lists as allocated and unscannable.
On the plus side, we don't need to change the bits when mallocing pointerless objects. On the other hand, we need to mark objects in the free lists during GC. But the free lists are small at GC time, so it should be a net win. benchmark old ns/op new ns/op delta BenchmarkMalloc8 40 33 -17.65% BenchmarkMalloc16 45 38 -15.72% BenchmarkMallocTypeInfo8 58 59 +0.85% BenchmarkMallocTypeInfo16 63 64 +1.10% R=golang-dev, rsc, dvyukov CC=cshapiro, golang-dev https://golang.org/cl/41040043
Diffstat (limited to 'src/pkg/runtime/malloc.goc')
-rw-r--r--src/pkg/runtime/malloc.goc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc
index b81fc398f0..eb044384b5 100644
--- a/src/pkg/runtime/malloc.goc
+++ b/src/pkg/runtime/malloc.goc
@@ -97,8 +97,10 @@ runtime·mallocgc(uintptr size, uintptr typ, uint32 flag)
runtime·markspan(v, 0, 0, true);
}
- if(!(flag & FlagNoGC))
- runtime·markallocated(v, size, (flag&FlagNoScan) != 0);
+ if(flag & FlagNoGC)
+ runtime·marknogc(v);
+ else if(!(flag & FlagNoScan))
+ runtime·markscan(v);
if(DebugTypeAtBlockEnd)
*(uintptr*)((uintptr)v+size-sizeof(uintptr)) = typ;