Commit 03f2189a authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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
parent 84a36434
...@@ -270,7 +270,7 @@ static bool ...@@ -270,7 +270,7 @@ static bool
markonly(void *obj) markonly(void *obj)
{ {
byte *p; byte *p;
uintptr *bitp, bits, shift, x, xbits, off, j; uintptr *bitp, bits, shift, x, xbits, off;
MSpan *s; MSpan *s;
PageID k; PageID k;
...@@ -298,18 +298,6 @@ markonly(void *obj) ...@@ -298,18 +298,6 @@ markonly(void *obj)
goto found; 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. // Otherwise consult span table to find beginning.
// (Manually inlined copy of MHeap_LookupMaybe.) // (Manually inlined copy of MHeap_LookupMaybe.)
k = (uintptr)obj>>PageShift; k = (uintptr)obj>>PageShift;
...@@ -424,7 +412,7 @@ static void ...@@ -424,7 +412,7 @@ static void
flushptrbuf(Scanbuf *sbuf) flushptrbuf(Scanbuf *sbuf)
{ {
byte *p, *arena_start, *obj; 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; MSpan *s;
PageID k; PageID k;
Obj *wp; Obj *wp;
...@@ -496,19 +484,6 @@ flushptrbuf(Scanbuf *sbuf) ...@@ -496,19 +484,6 @@ flushptrbuf(Scanbuf *sbuf)
ti = 0; 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. // Otherwise consult span table to find beginning.
// (Manually inlined copy of MHeap_LookupMaybe.) // (Manually inlined copy of MHeap_LookupMaybe.)
k = (uintptr)obj>>PageShift; k = (uintptr)obj>>PageShift;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment