Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(818)

Delta Between Two Patch Sets: src/pkg/runtime/mcentral.c

Issue 5490053: code review 5490053: runtime: make more build-friendly (Closed)
Left Patch Set: diff -r 4bd43e05039c https://go.googlecode.com/hg/ Created 13 years, 3 months ago
Right Patch Set: diff -r 046739c8299b https://go.googlecode.com/hg/ Created 13 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/mcache.c ('k') | src/pkg/runtime/mem_darwin.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Central free lists. 5 // Central free lists.
6 // 6 //
7 // See malloc.h for an overview. 7 // See malloc.h for an overview.
8 // 8 //
9 // The MCentral doesn't actually contain the list of free objects; the MSpan doe s. 9 // The MCentral doesn't actually contain the list of free objects; the MSpan doe s.
10 // Each MCentral is two lists of MSpans: those with free objects (c->nonempty) 10 // Each MCentral is two lists of MSpans: those with free objects (c->nonempty)
11 // and those that are completely allocated (c->empty). 11 // and those that are completely allocated (c->empty).
12 // 12 //
13 // TODO(rsc): tcmalloc uses a "transfer cache" to split the list 13 // TODO(rsc): tcmalloc uses a "transfer cache" to split the list
14 // into sections of class_to_transfercount[sizeclass] objects 14 // into sections of class_to_transfercount[sizeclass] objects
15 // so that it is faster to move those lists between MCaches and MCentrals. 15 // so that it is faster to move those lists between MCaches and MCentrals.
16 16
17 #include "runtime.h" 17 #include "runtime.h"
18 #include "arch.h" 18 #include "arch_GOARCH.h"
19 #include "malloc.h" 19 #include "malloc.h"
20 20
21 static bool MCentral_Grow(MCentral *c); 21 static bool MCentral_Grow(MCentral *c);
22 static void* MCentral_Alloc(MCentral *c); 22 static void* MCentral_Alloc(MCentral *c);
23 static void MCentral_Free(MCentral *c, void *v); 23 static void MCentral_Free(MCentral *c, void *v);
24 24
25 // Initialize a single central free list. 25 // Initialize a single central free list.
26 void 26 void
27 runtime·MCentral_Init(MCentral *c, int32 sizeclass) 27 runtime·MCentral_Init(MCentral *c, int32 sizeclass)
28 { 28 {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 p += size; 192 p += size;
193 } 193 }
194 *tailp = nil; 194 *tailp = nil;
195 runtime·markspan((byte*)(s->start<<PageShift), size, n, size*n < (s->npa ges<<PageShift)); 195 runtime·markspan((byte*)(s->start<<PageShift), size, n, size*n < (s->npa ges<<PageShift));
196 196
197 runtime·lock(c); 197 runtime·lock(c);
198 c->nfree += n; 198 c->nfree += n;
199 runtime·MSpanList_Insert(&c->nonempty, s); 199 runtime·MSpanList_Insert(&c->nonempty, s);
200 return true; 200 return true;
201 } 201 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b