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

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

Issue 134200044: code review 134200044: runtime: convert traceback*.c to Go (Closed)
Left Patch Set: diff -r 6aabcc1ffb70dbe0cca91f8f46176a26012ba2e9 https://code.google.com/p/go/ Created 10 years, 6 months ago
Right Patch Set: diff -r df0572446e37549332e1d1154955409e2cff6008 https://code.google.com/p/go/ Created 10 years, 6 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/heapdump.c ('k') | src/pkg/runtime/mprof.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 // Garbage collector (GC). 5 // Garbage collector (GC).
6 // 6 //
7 // GC is: 7 // GC is:
8 // - mark&sweep 8 // - mark&sweep
9 // - mostly precise (with the exception of some C-allocated objects, assembly fr ames/arguments, etc) 9 // - mostly precise (with the exception of some C-allocated objects, assembly fr ames/arguments, etc)
10 // - parallel (up to MaxGcproc threads) 10 // - parallel (up to MaxGcproc threads)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 RootFinalizers = 2, 74 RootFinalizers = 2,
75 RootSpans = 3, 75 RootSpans = 3,
76 RootFlushCaches = 4, 76 RootFlushCaches = 4,
77 RootCount = 5, 77 RootCount = 5,
78 }; 78 };
79 79
80 #define ScanConservatively ((byte*)1) 80 #define ScanConservatively ((byte*)1)
81 81
82 // Initialized from $GOGC. GOGC=off means no gc. 82 // Initialized from $GOGC. GOGC=off means no gc.
83 extern int32 runtime·gcpercent; 83 extern int32 runtime·gcpercent;
84
85 static FuncVal* poolcleanup;
86
87 void
88 sync·runtime_registerPoolCleanup(FuncVal *f)
89 {
90 poolcleanup = f;
91 }
92
93 void
94 runtime·clearpools(void)
95 {
96 P *p, **pp;
97 MCache *c;
98 int32 i;
99
100 // clear sync.Pool's
101 if(poolcleanup != nil)
102 reflect·call(poolcleanup, nil, 0, 0);
103
104 for(pp=runtime·allp; p=*pp; pp++) {
105 // clear tinyalloc pool
106 c = p->mcache;
107 if(c != nil) {
108 c->tiny = nil;
109 c->tinysize = 0;
110 c->sudogcache = nil;
111 }
112 // clear defer pools
113 for(i=0; i<nelem(p->deferpool); i++)
114 p->deferpool[i] = nil;
115 }
116 }
117 84
118 // Holding worldsema grants an M the right to try to stop the world. 85 // Holding worldsema grants an M the right to try to stop the world.
119 // The procedure is: 86 // The procedure is:
120 // 87 //
121 // runtime·semacquire(&runtime·worldsema); 88 // runtime·semacquire(&runtime·worldsema);
122 // m->gcing = 1; 89 // m->gcing = 1;
123 // runtime·stoptheworld(); 90 // runtime·stoptheworld();
124 // 91 //
125 // ... do stuff ... 92 // ... do stuff ...
126 // 93 //
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 1863
1897 void runtime·gc_unixnanotime(int64 *now); 1864 void runtime·gc_unixnanotime(int64 *now);
1898 1865
1899 int64 runtime·unixnanotime(void) 1866 int64 runtime·unixnanotime(void)
1900 { 1867 {
1901 int64 now; 1868 int64 now;
1902 1869
1903 runtime·gc_unixnanotime(&now); 1870 runtime·gc_unixnanotime(&now);
1904 return now; 1871 return now;
1905 } 1872 }
LEFTRIGHT

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