]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: delete unnecessary confusing code
authorDmitriy Vyukov <dvyukov@google.com>
Thu, 3 Jul 2014 18:58:42 +0000 (22:58 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Thu, 3 Jul 2014 18:58:42 +0000 (22:58 +0400)
The code in GC that handles gp->gobuf.ctxt is wrong,
because it does not mark the ctxt object itself,
if just queues the ctxt object for scanning.
So the ctxt object can be collected as garbage.
However, Gobuf.ctxt is void*, so it's always marked and
scanned through G.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, khr, rsc
https://golang.org/cl/105490044

src/pkg/runtime/mgc0.c
src/pkg/runtime/runtime.h

index 4ad8f3b08f4b4b83310f20c213e464573de29851..059417209d599ae8316e116f5388c735a0291388 100644 (file)
@@ -1615,8 +1615,6 @@ addstackroots(G *gp, Workbuf **wbufp)
        int32 n;
        Stktop *stk;
        uintptr sp, guard;
-       void *base;
-       uintptr size;
 
        switch(gp->status){
        default:
@@ -1652,9 +1650,6 @@ addstackroots(G *gp, Workbuf **wbufp)
                sp = gp->sched.sp;
                stk = (Stktop*)gp->stackbase;
                guard = gp->stackguard;
-               // For function about to start, context argument is a root too.
-               if(gp->sched.ctxt != 0 && runtime·mlookup(gp->sched.ctxt, &base, &size, nil))
-                       enqueue1(wbufp, (Obj){base, size, 0});
        }
        if(ScanStackByFrames) {
                USED(sp);
index 0f630abbf20ebf38302330ec25c05b619a638137..2fab69b3a2bb0ed5efbd7bdd44d8055d8ec792f1 100644 (file)
@@ -213,7 +213,7 @@ struct      Gobuf
        uintptr sp;
        uintptr pc;
        G*      g;
-       void*   ctxt;
+       void*   ctxt; // this has to be a pointer so that GC scans it
        uintreg ret;
        uintptr lr;
 };