From: Dmitriy Vyukov Date: Sat, 28 Jun 2014 01:19:02 +0000 (-0700) Subject: runtime: make garbage collector faster by deleting code again X-Git-Tag: go1.4beta1~1205 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=03f2189a1b20a5140191d51fc660422bc172f2b5;p=gostls13.git 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 --- diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index 51c765eaac..3eda4f4b9e 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -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;