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

Delta Between Two Patch Sets: src/pkg/runtime/mgc0.h

Issue 160200044: [dev.power64] code review 160200044: build: merge default into dev.power64 (Closed)
Left Patch Set: Created 10 years, 4 months ago
Right Patch Set: diff -r be0c14f62257b42485019e9e1db23cf40d2e249f https://code.google.com/p/go Created 10 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:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/memmove_plan9_amd64.s ('k') | src/pkg/runtime/mgc0.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 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 // TODO(rsc): Half the code in the garbage collector 10 // TODO(rsc): Half the code in the garbage collector
11 // now accesses the bitmap as an array of bytes 11 // now accesses the bitmap as an array of bytes
12 // instead of as an array of uintptrs.· 12 // instead of as an array of uintptrs.·
13 // This is tricky to do correctly in a portable fashion. 13 // This is tricky to do correctly in a portable fashion.
14 // (It breaks on big-endian systems.) 14 // (It breaks on big-endian systems.)
15 // Should we just make the bitmap a byte array? 15 // Should we just make the bitmap a byte array?
16 16
17 // Four bits per word (see #defines below). 17 // Four bits per word (see #defines below).
18 wordsPerBitmapWord = sizeof(void*)*8/4,
19 gcBits = 4, 18 gcBits = 4,
19 wordsPerBitmapByte = 8/gcBits,
20 20
21 // GC type info programs. 21 // GC type info programs.
22 // The programs allow to store type info required for GC in a compact fo rm. 22 // The programs allow to store type info required for GC in a compact fo rm.
23 // Most importantly arrays take O(1) space instead of O(n). 23 // Most importantly arrays take O(1) space instead of O(n).
24 // The program grammar is: 24 // The program grammar is:
25 // 25 //
26 // Program = {Block} "insEnd" 26 // Program = {Block} "insEnd"
27 // Block = Data | Array 27 // Block = Data | Array
28 // Data = "insData" DataSize DataBlock 28 // Data = "insData" DataSize DataBlock
29 // DataSize = int // size of the DataBlock in bit pairs, 1 byte 29 // DataSize = int // size of the DataBlock in bit pairs, 1 byte
(...skipping 20 matching lines...) Expand all
50 BitsPerPointer = 2, 50 BitsPerPointer = 2,
51 BitsMask = (1<<BitsPerPointer)-1, 51 BitsMask = (1<<BitsPerPointer)-1,
52 PointersPerByte = 8/BitsPerPointer, 52 PointersPerByte = 8/BitsPerPointer,
53 53
54 BitsDead = 0, 54 BitsDead = 0,
55 BitsScalar = 1, 55 BitsScalar = 1,
56 BitsPointer = 2, 56 BitsPointer = 2,
57 BitsMultiWord = 3, 57 BitsMultiWord = 3,
58 // BitsMultiWord will be set for the first word of a multi-word item. 58 // BitsMultiWord will be set for the first word of a multi-word item.
59 // When it is set, one of the following will be set for the second word. 59 // When it is set, one of the following will be set for the second word.
60 » BitsString» = 0, 60 » // NOT USED ANYMORE: BitsString»= 0,
61 » BitsSlice» = 1, 61 » // NOT USED ANYMORE: BitsSlice» = 1,
62 BitsIface = 2, 62 BitsIface = 2,
63 BitsEface = 3, 63 BitsEface = 3,
64 64
65 » MaxGCMask» = 0,» // disabled because wastes several bytes of memo ry 65 » // 64 bytes cover objects of size 1024/512 on 64/32 bits, respectively.
66 » MaxGCMask» = 64,
66 }; 67 };
67 68
68 // Bits in per-word bitmap. 69 // Bits in per-word bitmap.
69 // #defines because we shift the values beyond 32 bits. 70 // #defines because we shift the values beyond 32 bits.
70 // 71 //
71 // Each word in the bitmap describes wordsPerBitmapWord words 72 // Each word in the bitmap describes wordsPerBitmapWord words
72 // of heap memory. There are 4 bitmap bits dedicated to each heap word, 73 // of heap memory. There are 4 bitmap bits dedicated to each heap word,
73 // so on a 64-bit system there is one bitmap word per 16 heap words. 74 // so on a 64-bit system there is one bitmap word per 16 heap words.
74 // 75 //
75 // The bitmap starts at mheap.arena_start and extends *backward* from 76 // The bitmap starts at mheap.arena_start and extends *backward* from
76 // there. On a 64-bit system the off'th word in the arena is tracked by 77 // there. On a 64-bit system the off'th word in the arena is tracked by
77 // the off/16+1'th word before mheap.arena_start. (On a 32-bit system, 78 // the off/16+1'th word before mheap.arena_start. (On a 32-bit system,
78 // the only difference is that the divisor is 8.) 79 // the only difference is that the divisor is 8.)
79 80
80 #define bitMiddle» ((uintptr)0) // middle of an object 81 #define bitBoundary» ((uintptr)1) // boundary of an object
81 #define bitBoundary» ((uintptr)1) // boundary on a non-allocated object 82 #define bitMarked» ((uintptr)2) // marked object
82 #define bitAllocated» ((uintptr)2) // boundary on an allocated object
83 #define bitMarked» ((uintptr)3) // boundary on an allocated and marked obje ct
84 83
85 #define bitMask»» ((uintptr)bitMiddle|bitBoundary|bitAllocated|bitMarked) 84 #define bitMask»» ((uintptr)bitBoundary|bitMarked)
86 #define bitPtrMask ((uintptr)BitsMask<<2) 85 #define bitPtrMask ((uintptr)BitsMask<<2)
LEFTRIGHT

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