diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2013-07-26 21:17:24 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2013-07-26 21:17:24 +0400 |
| commit | f8a850b250655bd26f5da4cfe7299b4a32be28fa (patch) | |
| tree | 8337d4705585d9f8391110098d1d57816ab4d9cf /src/pkg/runtime/malloc.h | |
| parent | a0f74093b2f3aa0d8d2b69c881a75f40d296355f (diff) | |
| download | go-f8a850b250655bd26f5da4cfe7299b4a32be28fa.tar.xz | |
runtime: refactor mallocgc
Make it accept type, combine flags.
Several reasons for the change:
1. mallocgc and settype must be atomic wrt GC
2. settype is called from only one place now
3. it will help performance (eventually settype
functionality must be combined with markallocated)
4. flags are easier to read now (no mallocgc(sz, 0, 1, 0) anymore)
R=golang-dev, iant, nightlyone, rsc, dave, khr, bradfitz, r
CC=golang-dev
https://golang.org/cl/10136043
Diffstat (limited to 'src/pkg/runtime/malloc.h')
| -rw-r--r-- | src/pkg/runtime/malloc.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h index 94907b1b0e..1ad65c0286 100644 --- a/src/pkg/runtime/malloc.h +++ b/src/pkg/runtime/malloc.h @@ -442,7 +442,7 @@ void runtime·MHeap_MapBits(MHeap *h); void runtime·MHeap_MapSpans(MHeap *h); void runtime·MHeap_Scavenger(void); -void* runtime·mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed); +void* runtime·mallocgc(uintptr size, uintptr typ, uint32 flag); void* runtime·persistentalloc(uintptr size, uintptr align); int32 runtime·mlookup(void *v, byte **base, uintptr *size, MSpan **s); void runtime·gc(int32 force); @@ -459,7 +459,6 @@ void runtime·purgecachedstats(MCache*); void* runtime·cnew(Type*); void* runtime·cnewarray(Type*, intgo); -void runtime·settype(void*, uintptr); void runtime·settype_flush(M*, bool); void runtime·settype_sysfree(MSpan*); uintptr runtime·gettype(void*); @@ -467,9 +466,11 @@ uintptr runtime·gettype(void*); enum { // flags to malloc - FlagNoPointers = 1<<0, // no pointers here - FlagNoProfiling = 1<<1, // must not profile - FlagNoGC = 1<<2, // must not free or scan for pointers + FlagNoPointers = 1<<0, // no pointers here + FlagNoProfiling = 1<<1, // must not profile + FlagNoGC = 1<<2, // must not free or scan for pointers + FlagNoZero = 1<<3, // don't zero memory + FlagNoInvokeGC = 1<<4, // don't invoke GC }; void runtime·MProf_Malloc(void*, uintptr); |
