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

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

Issue 5279048: code review 5279048: runtime: faster and more scalable GC (Closed)
Left Patch Set: diff -r 80e9ed9f7989 https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Right Patch Set: diff -r f44057cc01b2 https://go.googlecode.com/hg/ Created 12 years, 11 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/malloc.h ('k') | src/pkg/runtime/mcentral.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 // Per-thread (in Go, per-M) malloc cache for small objects. 5 // Per-thread (in Go, per-M) malloc cache for small objects.
6 // 6 //
7 // See malloc.h for an overview. 7 // See malloc.h for an overview.
8 8
9 #include "runtime.h" 9 #include "runtime.h"
10 #include "arch_GOARCH.h" 10 #include "arch_GOARCH.h"
(...skipping 25 matching lines...) Expand all
36 l->nlistmin = l->nlist; 36 l->nlistmin = l->nlist;
37 c->size -= size; 37 c->size -= size;
38 38
39 // v is zeroed except for the link pointer 39 // v is zeroed except for the link pointer
40 // that we used above; zero that. 40 // that we used above; zero that.
41 v->next = nil; 41 v->next = nil;
42 if(zeroed) { 42 if(zeroed) {
43 // block is zeroed iff second word is zero ... 43 // block is zeroed iff second word is zero ...
44 if(size > sizeof(uintptr) && ((uintptr*)v)[1] != 0) 44 if(size > sizeof(uintptr) && ((uintptr*)v)[1] != 0)
45 runtime·memclr((byte*)v, size); 45 runtime·memclr((byte*)v, size);
46 else {
47 // ... except for the link pointer
48 // that we used above; zero that.
49 v->next = nil;
50 }
51 } 46 }
52 c->local_cachealloc += size; 47 c->local_cachealloc += size;
53 c->local_objects++; 48 c->local_objects++;
54 return v; 49 return v;
55 } 50 }
56 51
57 // Take n elements off l and return them to the central free list. 52 // Take n elements off l and return them to the central free list.
58 static void 53 static void
59 ReleaseN(MCache *c, MCacheList *l, int32 n, int32 sizeclass) 54 ReleaseN(MCache *c, MCacheList *l, int32 n, int32 sizeclass)
60 { 55 {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 { 120 {
126 int32 i; 121 int32 i;
127 MCacheList *l; 122 MCacheList *l;
128 123
129 for(i=0; i<NumSizeClasses; i++) { 124 for(i=0; i<NumSizeClasses; i++) {
130 l = &c->list[i]; 125 l = &c->list[i];
131 ReleaseN(c, l, l->nlist, i); 126 ReleaseN(c, l, l->nlist, i);
132 l->nlistmin = 0; 127 l->nlistmin = 0;
133 } 128 }
134 } 129 }
LEFTRIGHT

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