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

Side by Side Diff: src/pkg/runtime/mgc0.h

Issue 112570044: code review 112570044: cmd/gc, runtime: treat slices and strings like pointers... (Closed)
Patch Set: diff -r 6d5c17d94e9ddcd8ca450ac62f84cf9ddb436b65 https://code.google.com/p/go/ Created 10 years, 7 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/malloc.h ('k') | src/pkg/runtime/mgc0.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 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 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 // Garbage collector (GC) 5 // Garbage collector (GC)
6 6
7 enum { 7 enum {
8 ScanStackByFrames = 1, 8 ScanStackByFrames = 1,
9 9
10 // Four bits per word (see #defines below). 10 // Four bits per word (see #defines below).
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 BitsPerPointer = 2, 43 BitsPerPointer = 2,
44 BitsMask = (1<<BitsPerPointer)-1, 44 BitsMask = (1<<BitsPerPointer)-1,
45 PointersPerByte = 8/BitsPerPointer, 45 PointersPerByte = 8/BitsPerPointer,
46 46
47 BitsDead = 0, 47 BitsDead = 0,
48 BitsScalar = 1, 48 BitsScalar = 1,
49 BitsPointer = 2, 49 BitsPointer = 2,
50 BitsMultiWord = 3, 50 BitsMultiWord = 3,
51 // BitsMultiWord will be set for the first word of a multi-word item. 51 // BitsMultiWord will be set for the first word of a multi-word item.
52 // When it is set, one of the following will be set for the second word. 52 // When it is set, one of the following will be set for the second word.
53 » BitsString» = 0, 53 » // NOT USED ANYMORE: BitsString»= 0,
54 » BitsSlice» = 1, 54 » // NOT USED ANYMORE: BitsSlice» = 1,
55 BitsIface = 2, 55 BitsIface = 2,
56 BitsEface = 3, 56 BitsEface = 3,
57 57
58 // 64 bytes cover objects of size 1024/512 on 64/32 bits, respectively. 58 // 64 bytes cover objects of size 1024/512 on 64/32 bits, respectively.
59 MaxGCMask = 64, 59 MaxGCMask = 64,
60 }; 60 };
61 61
62 // Bits in per-word bitmap. 62 // Bits in per-word bitmap.
63 // #defines because we shift the values beyond 32 bits. 63 // #defines because we shift the values beyond 32 bits.
64 // 64 //
65 // Each word in the bitmap describes wordsPerBitmapWord words 65 // Each word in the bitmap describes wordsPerBitmapWord words
66 // of heap memory. There are 4 bitmap bits dedicated to each heap word, 66 // of heap memory. There are 4 bitmap bits dedicated to each heap word,
67 // so on a 64-bit system there is one bitmap word per 16 heap words. 67 // so on a 64-bit system there is one bitmap word per 16 heap words.
68 // 68 //
69 // The bitmap starts at mheap.arena_start and extends *backward* from 69 // The bitmap starts at mheap.arena_start and extends *backward* from
70 // there. On a 64-bit system the off'th word in the arena is tracked by 70 // there. On a 64-bit system the off'th word in the arena is tracked by
71 // the off/16+1'th word before mheap.arena_start. (On a 32-bit system, 71 // the off/16+1'th word before mheap.arena_start. (On a 32-bit system,
72 // the only difference is that the divisor is 8.) 72 // the only difference is that the divisor is 8.)
73 73
74 #define bitBoundary ((uintptr)1) // boundary of an object 74 #define bitBoundary ((uintptr)1) // boundary of an object
75 #define bitMarked ((uintptr)2) // marked object 75 #define bitMarked ((uintptr)2) // marked object
76 76
77 #define bitMask ((uintptr)bitBoundary|bitMarked) 77 #define bitMask ((uintptr)bitBoundary|bitMarked)
78 #define bitPtrMask ((uintptr)BitsMask<<2) 78 #define bitPtrMask ((uintptr)BitsMask<<2)
OLDNEW
« no previous file with comments | « src/pkg/runtime/malloc.h ('k') | src/pkg/runtime/mgc0.c » ('j') | no next file with comments »

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