]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: make garbage collector faster by deleting code again
authorDmitriy Vyukov <dvyukov@google.com>
Sat, 28 Jun 2014 01:19:02 +0000 (18:19 -0700)
committerDmitriy Vyukov <dvyukov@google.com>
Sat, 28 Jun 2014 01:19:02 +0000 (18:19 -0700)
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

src/pkg/runtime/mgc0.c

index 51c765eaacdbea239113770f0a679b3047563e6b..3eda4f4b9ea369f5935576dddd93abcc6f8ea73c 100644 (file)
@@ -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;