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

Side by Side Diff: src/pkg/runtime/malloc_defs.go

Issue 4047047: code review 4047047: runtime: automaticaly generated Go declarations for C v... (Closed)
Patch Set: code review 4047047: runtime: automaticaly generated Go declarations for C v... Created 14 years, 1 month 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.goc ('k') | src/pkg/runtime/mheapmap32_defs.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2010 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Go definitions of internal structures. Master is malloc.h
6
7 package runtime
8
9 import "unsafe"
10
11 const (
12 pageShift = 12
13 pageSize = 1 << pageShift
14 pageMask = pageSize - 1
15 )
16
17 type pageID uintptr
18
19 const (
20 numSizeClasses = 67
21 maxSmallSize = 32 << 10
22 fixAllocChunk = 128 << 10
23 maxMCacheListLen = 256
24 maxMCacheSize = 2 << 20
25 maxMHeapList = 1 << 8 // 1 << (20 - pageShift)
26 heapAllocChunk = 1 << 20
27 )
28
29 type mLink struct {
30 next *mLink
31 }
32
33 type fixAlloc struct {
34 size uintptr
35 alloc func(uintptr)
36 first func(unsafe.Pointer, *byte)
37 arg unsafe.Pointer
38 list *mLink
39 chunk *byte
40 nchunk uint32
41 inuse uintptr
42 sys uintptr
43 }
44
45
46 // MStats? used to be in extern.go
47
48 type mCacheList struct {
49 list *mLink
50 nlist uint32
51 nlistmin uint32
52 }
53
54 type mCache struct {
55 list [numSizeClasses]mCacheList
56 size uint64
57 local_alloc int64
58 local_objects int64
59 next_sample int32
60 }
61
62 type mSpan struct {
63 next *mSpan
64 prev *mSpan
65 allnext *mSpan
66 start pageID
67 npages uintptr
68 freelist *mLink
69 ref uint32
70 sizeclass uint32
71 state uint32
72 // union {
73 gcref *uint32 // sizeclass > 0
74 // gcref0 uint32; // sizeclass == 0
75 // }
76 }
77
78 type mCentral struct {
79 lock
80 sizeclass int32
81 nonempty mSpan
82 empty mSpan
83 nfree int32
84 }
85
86 type mHeap struct {
87 lock
88 free [maxMHeapList]mSpan
89 large mSpan
90 allspans *mSpan
91 map_ mHeapMap
92 min *byte
93 max *byte
94 closure_min *byte
95 closure_max *byte
96
97 central [numSizeClasses]struct {
98 pad [64]byte
99 // union: mCentral
100 }
101
102 spanalloc fixAlloc
103 cachealloc fixAlloc
104 }
105
106 const (
107 refFree = iota
108 refStack
109 refNone
110 refSome
111 refcountOverhead = 4
112 refNoPointers = 0x80000000
113 refHasFinalizer = 0x40000000
114 refProfiled = 0x20000000
115 refNoProfiling = 0x10000000
116 refFlags = 0xFFFF0000
117 )
118
119 const (
120 mProf_None = iota
121 mProf_Sample
122 mProf_All
123 )
124
125 type finalizer struct {
126 next *finalizer
127 fn func(unsafe.Pointer)
128 arg unsafe.Pointer
129 nret int32
130 }
OLDNEW
« no previous file with comments | « src/pkg/runtime/malloc.goc ('k') | src/pkg/runtime/mheapmap32_defs.go » ('j') | no next file with comments »

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