]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: mark strings without going through an intermediate buffer
authorJan Ziak <0xe2.0x9a.0x9b@gmail.com>
Thu, 21 Mar 2013 18:00:02 +0000 (19:00 +0100)
committerJan Ziak <0xe2.0x9a.0x9b@gmail.com>
Thu, 21 Mar 2013 18:00:02 +0000 (19:00 +0100)
R=rsc
CC=golang-dev
https://golang.org/cl/7949043

src/pkg/runtime/mgc0.c

index dd268fcda0f92cf57c51abd6768f550b089136bf..aa499f4762e2cf6c625d6f88ae10f85cf4699b67 100644 (file)
@@ -740,8 +740,9 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
 
                case GC_STRING:
                        obj = *(void**)(stack_top.b + pc[1]);
+                       markonly(obj);
                        pc += 2;
-                       break;
+                       continue;
 
                case GC_EFACE:
                        eface = (Eface*)(stack_top.b + pc[1]);
@@ -804,9 +805,9 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
                        break;
 
                case GC_DEFAULT_PTR:
-                       while((i = stack_top.b) <= end_b) {
+                       while(stack_top.b <= end_b) {
+                               obj = *(byte**)stack_top.b;
                                stack_top.b += PtrSize;
-                               obj = *(byte**)i;
                                if(obj >= arena_start && obj < arena_used) {
                                        *ptrbufpos++ = (PtrTarget){obj, 0};
                                        if(ptrbufpos == ptrbuf_end)