Commit d3be3daa authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: delete unnecessary confusing code

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
parent 2ec3a0a7
...@@ -1615,8 +1615,6 @@ addstackroots(G *gp, Workbuf **wbufp) ...@@ -1615,8 +1615,6 @@ addstackroots(G *gp, Workbuf **wbufp)
int32 n; int32 n;
Stktop *stk; Stktop *stk;
uintptr sp, guard; uintptr sp, guard;
void *base;
uintptr size;
switch(gp->status){ switch(gp->status){
default: default:
...@@ -1652,9 +1650,6 @@ addstackroots(G *gp, Workbuf **wbufp) ...@@ -1652,9 +1650,6 @@ addstackroots(G *gp, Workbuf **wbufp)
sp = gp->sched.sp; sp = gp->sched.sp;
stk = (Stktop*)gp->stackbase; stk = (Stktop*)gp->stackbase;
guard = gp->stackguard; 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) { if(ScanStackByFrames) {
USED(sp); USED(sp);
......
...@@ -213,7 +213,7 @@ struct Gobuf ...@@ -213,7 +213,7 @@ struct Gobuf
uintptr sp; uintptr sp;
uintptr pc; uintptr pc;
G* g; G* g;
void* ctxt; void* ctxt; // this has to be a pointer so that GC scans it
uintreg ret; uintreg ret;
uintptr lr; uintptr lr;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment