aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-07-22 01:56:01 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-07-22 01:56:01 +0400
commit92c54e4a73cab47b53472d49479364f1378bbff7 (patch)
treea931a7efa0c445d40c83d546f390f1e278fbf5cd /src/pkg
parent8e0e09ae7db8f0498d8aab1d15b21c53d6dd9556 (diff)
downloadgo-92c54e4a73cab47b53472d49479364f1378bbff7.tar.xz
runtime: simplify code
LGTM=khr R=golang-codereviews, dave, khr CC=golang-codereviews, rsc https://golang.org/cl/116950043
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/runtime/mgc0.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c
index 2d478acdc4..79eaca61cb 100644
--- a/src/pkg/runtime/mgc0.c
+++ b/src/pkg/runtime/mgc0.c
@@ -219,10 +219,6 @@ static struct {
volatile uint32 ndone;
Note alldone;
ParFor *markfor;
-
- Lock;
- byte *chunk;
- uintptr nchunk;
} work;
enum {
@@ -1310,20 +1306,8 @@ getempty(Workbuf *b)
if(b != nil)
runtime·lfstackpush(&work.full, &b->node);
b = (Workbuf*)runtime·lfstackpop(&work.empty);
- if(b == nil) {
- // Need to allocate.
- runtime·lock(&work);
- if(work.nchunk < sizeof *b) {
- work.nchunk = 1<<20;
- work.chunk = runtime·SysAlloc(work.nchunk, &mstats.gc_sys);
- if(work.chunk == nil)
- runtime·throw("runtime: cannot allocate memory");
- }
- b = (Workbuf*)work.chunk;
- work.chunk += sizeof *b;
- work.nchunk -= sizeof *b;
- runtime·unlock(&work);
- }
+ if(b == nil)
+ b = runtime·persistentalloc(sizeof(*b), CacheLineSize, &mstats.gc_sys);
b->nobj = 0;
return b;
}