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

Side by Side Diff: src/pkg/runtime/mheap.c

Issue 5279048: code review 5279048: runtime: faster and more scalable GC (Closed)
Patch Set: diff -r da9e7548e6ef https://go.googlecode.com/hg/ Created 13 years, 4 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/runtime/mgc0.c ('k') | src/pkg/runtime/proc.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Page heap. 5 // Page heap.
6 // 6 //
7 // See malloc.h for overview. 7 // See malloc.h for overview.
8 // 8 //
9 // When a MSpan is in the heap free list, state == MSpanFree 9 // When a MSpan is in the heap free list, state == MSpanFree
10 // and heapmap(s->start) == span, heapmap(s->start+s->npages-1) == span. 10 // and heapmap(s->start) == span, heapmap(s->start+s->npages-1) == span.
(...skipping 12 matching lines...) Expand all
23 static MSpan *BestFit(MSpan*, uintptr, MSpan*); 23 static MSpan *BestFit(MSpan*, uintptr, MSpan*);
24 24
25 static void 25 static void
26 RecordSpan(void *vh, byte *p) 26 RecordSpan(void *vh, byte *p)
27 { 27 {
28 MHeap *h; 28 MHeap *h;
29 MSpan *s; 29 MSpan *s;
30 30
31 h = vh; 31 h = vh;
32 s = (MSpan*)p; 32 s = (MSpan*)p;
33 » s->allnext = h->allspans; 33 » //s->allnext = h->allspans;
34 » h->allspans = s; 34 » //h->allspans = s;
35 » if(h->nspan == nelem(h->allspans))
36 » » runtime·throw("span overflow");
37 » h->allspans[h->nspan] = s;
38 » h->nspan++;
35 } 39 }
36 40
37 // Initialize the heap; fetch memory using alloc. 41 // Initialize the heap; fetch memory using alloc.
38 void 42 void
39 runtime·MHeap_Init(MHeap *h, void *(*alloc)(uintptr)) 43 runtime·MHeap_Init(MHeap *h, void *(*alloc)(uintptr))
40 { 44 {
41 uint32 i; 45 uint32 i;
42 46
43 runtime·FixAlloc_Init(&h->spanalloc, sizeof(MSpan), alloc, RecordSpan, h ); 47 runtime·FixAlloc_Init(&h->spanalloc, sizeof(MSpan), alloc, RecordSpan, h );
44 runtime·FixAlloc_Init(&h->cachealloc, sizeof(MCache), alloc, nil, nil); 48 runtime·FixAlloc_Init(&h->cachealloc, sizeof(MCache), alloc, nil, nil);
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 runtime·printf("failed MSpanList_Insert %p %p %p\n", span, span- >next, span->prev); 372 runtime·printf("failed MSpanList_Insert %p %p %p\n", span, span- >next, span->prev);
369 runtime·throw("MSpanList_Insert"); 373 runtime·throw("MSpanList_Insert");
370 } 374 }
371 span->next = list->next; 375 span->next = list->next;
372 span->prev = list; 376 span->prev = list;
373 span->next->prev = span; 377 span->next->prev = span;
374 span->prev->next = span; 378 span->prev->next = span;
375 } 379 }
376 380
377 381
OLDNEW
« no previous file with comments | « src/pkg/runtime/mgc0.c ('k') | src/pkg/runtime/proc.c » ('j') | no next file with comments »

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