mirror of
https://github.com/golang/go
synced 2024-11-12 09:20:22 -07:00
runtime: make garbage collector faster by deleting code again
Remove GC bitmap backward scanning. This was already done once in https://golang.org/cl/5530074/ Still makes GC a bit faster. On the garbage benchmark, before: gc-pause-one=237345195 gc-pause-total=4746903 cputime=32427775 time=32458208 after: gc-pause-one=235484019 gc-pause-total=4709680 cputime=31861965 time=31877772 Also prepares mgc0.c for future changes. R=golang-codereviews, khr, khr CC=golang-codereviews, rsc https://golang.org/cl/105380043
This commit is contained in:
parent
84a36434d9
commit
03f2189a1b
@ -270,7 +270,7 @@ static bool
|
||||
markonly(void *obj)
|
||||
{
|
||||
byte *p;
|
||||
uintptr *bitp, bits, shift, x, xbits, off, j;
|
||||
uintptr *bitp, bits, shift, x, xbits, off;
|
||||
MSpan *s;
|
||||
PageID k;
|
||||
|
||||
@ -298,18 +298,6 @@ markonly(void *obj)
|
||||
goto found;
|
||||
}
|
||||
|
||||
// Pointing just past the beginning?
|
||||
// Scan backward a little to find a block boundary.
|
||||
for(j=shift; j-->0; ) {
|
||||
if(((xbits>>j) & (bitAllocated|bitBlockBoundary)) != 0) {
|
||||
shift = j;
|
||||
bits = xbits>>shift;
|
||||
if(CollectStats)
|
||||
runtime·xadd64(&gcstats.markonly.foundword, 1);
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise consult span table to find beginning.
|
||||
// (Manually inlined copy of MHeap_LookupMaybe.)
|
||||
k = (uintptr)obj>>PageShift;
|
||||
@ -424,7 +412,7 @@ static void
|
||||
flushptrbuf(Scanbuf *sbuf)
|
||||
{
|
||||
byte *p, *arena_start, *obj;
|
||||
uintptr size, *bitp, bits, shift, j, x, xbits, off, nobj, ti, n;
|
||||
uintptr size, *bitp, bits, shift, x, xbits, off, nobj, ti, n;
|
||||
MSpan *s;
|
||||
PageID k;
|
||||
Obj *wp;
|
||||
@ -496,19 +484,6 @@ flushptrbuf(Scanbuf *sbuf)
|
||||
|
||||
ti = 0;
|
||||
|
||||
// Pointing just past the beginning?
|
||||
// Scan backward a little to find a block boundary.
|
||||
for(j=shift; j-->0; ) {
|
||||
if(((xbits>>j) & (bitAllocated|bitBlockBoundary)) != 0) {
|
||||
obj = (byte*)obj - (shift-j)*PtrSize;
|
||||
shift = j;
|
||||
bits = xbits>>shift;
|
||||
if(CollectStats)
|
||||
runtime·xadd64(&gcstats.flushptrbuf.foundword, 1);
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise consult span table to find beginning.
|
||||
// (Manually inlined copy of MHeap_LookupMaybe.)
|
||||
k = (uintptr)obj>>PageShift;
|
||||
|
Loading…
Reference in New Issue
Block a user