]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: work around 5c bug in GC code.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Thu, 10 Jan 2013 23:59:44 +0000 (00:59 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Thu, 10 Jan 2013 23:59:44 +0000 (00:59 +0100)
5c miscompiles *p++ = struct_literal.

R=dave, golang-dev
CC=golang-dev
https://golang.org/cl/7065069

src/pkg/runtime/mgc0.c

index b612e6216a00c0964321e1a0e2385671aef6b56c..e39e10f93ccc75cb6a0bca4ec58dd2cd49b1d47c 100644 (file)
@@ -338,7 +338,8 @@ flushptrbuf(PtrTarget *ptrbuf, PtrTarget **ptrbufpos, Obj **_wp, Workbuf **_wbuf
                        if((bits & (bitAllocated|bitMarked)) != bitAllocated)
                                continue;
 
-                       *bitbufpos++ = (BitTarget){obj, ti, bitp, shift};
+                       *bitbufpos = (BitTarget){obj, ti, bitp, shift};
+                       bitbufpos++;
                }
 
                runtime·lock(&lock);
@@ -541,7 +542,8 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
                        
                        // iface->tab
                        if((void*)iface->tab >= arena_start && (void*)iface->tab < arena_used) {
-                               *ptrbufpos++ = (PtrTarget){iface->tab, (uintptr)itabtype->gc};
+                               *ptrbufpos = (PtrTarget){iface->tab, (uintptr)itabtype->gc};
+                               ptrbufpos++;
                                if(ptrbufpos == ptrbuf_end)
                                        flushptrbuf(ptrbuf, &ptrbufpos, &wp, &wbuf, &nobj, bitbuf);
                        }
@@ -568,7 +570,8 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
                                stack_top.b += PtrSize;
                                obj = *(byte**)i;
                                if(obj >= arena_start && obj < arena_used) {
-                                       *ptrbufpos++ = (PtrTarget){obj, 0};
+                                       *ptrbufpos = (PtrTarget){obj, 0};
+                                       ptrbufpos++;
                                        if(ptrbufpos == ptrbuf_end)
                                                flushptrbuf(ptrbuf, &ptrbufpos, &wp, &wbuf, &nobj, bitbuf);
                                }
@@ -654,7 +657,8 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
                }
 
                if(obj >= arena_start && obj < arena_used) {
-                       *ptrbufpos++ = (PtrTarget){obj, objti};
+                       *ptrbufpos = (PtrTarget){obj, objti};
+                       ptrbufpos++;
                        if(ptrbufpos == ptrbuf_end)
                                flushptrbuf(ptrbuf, &ptrbufpos, &wp, &wbuf, &nobj, bitbuf);
                }