diff options
| author | Peter Collingbourne <pcc@google.com> | 2014-08-07 09:00:02 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-08-07 09:00:02 -0400 |
| commit | e03bce158fba5f13dd7f2f0a86a40eb14958300b (patch) | |
| tree | 4cd6d9b5a645be10fe84807e8014ac54d4445d88 /src/pkg/runtime/malloc.c | |
| parent | 6cee4d3e8f52d4ab5ba2f97ca58f11d5e4c29fd4 (diff) | |
| download | go-e03bce158fba5f13dd7f2f0a86a40eb14958300b.tar.xz | |
cmd/cc, runtime: eliminate use of the unnamed substructure C extension
Eliminating use of this extension makes it easier to port the Go runtime
to other compilers. This CL also disables the extension in cc to prevent
accidental use.
LGTM=rsc, khr
R=rsc, aram, khr, dvyukov
CC=axwalk, golang-codereviews
https://golang.org/cl/106790044
Diffstat (limited to 'src/pkg/runtime/malloc.c')
| -rw-r--r-- | src/pkg/runtime/malloc.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pkg/runtime/malloc.c b/src/pkg/runtime/malloc.c index be3280e0f1..8b9447dad6 100644 --- a/src/pkg/runtime/malloc.c +++ b/src/pkg/runtime/malloc.c @@ -45,9 +45,9 @@ runtime·mlookup(void *v, byte **base, uintptr *size, MSpan **sp) g->m->mcache->local_nlookup++; if (sizeof(void*) == 4 && g->m->mcache->local_nlookup >= (1<<30)) { // purge cache stats to prevent overflow - runtime·lock(&runtime·mheap); + runtime·lock(&runtime·mheap.lock); runtime·purgecachedstats(g->m->mcache); - runtime·unlock(&runtime·mheap); + runtime·unlock(&runtime·mheap.lock); } s = runtime·MHeap_LookupMaybe(&runtime·mheap, v); @@ -341,7 +341,7 @@ runtime·MHeap_SysAlloc(MHeap *h, uintptr n) static struct { - Lock; + Lock lock; byte* pos; byte* end; } persistent; @@ -370,19 +370,19 @@ runtime·persistentalloc(uintptr size, uintptr align, uint64 *stat) align = 8; if(size >= PersistentAllocMaxBlock) return runtime·SysAlloc(size, stat); - runtime·lock(&persistent); + runtime·lock(&persistent.lock); persistent.pos = (byte*)ROUND((uintptr)persistent.pos, align); if(persistent.pos + size > persistent.end) { persistent.pos = runtime·SysAlloc(PersistentAllocChunk, &mstats.other_sys); if(persistent.pos == nil) { - runtime·unlock(&persistent); + runtime·unlock(&persistent.lock); runtime·throw("runtime: cannot allocate memory"); } persistent.end = persistent.pos + PersistentAllocChunk; } p = persistent.pos; persistent.pos += size; - runtime·unlock(&persistent); + runtime·unlock(&persistent.lock); if(stat != &mstats.other_sys) { // reaccount the allocation against provided stat runtime·xadd64(stat, size); |
