aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-07-03 22:58:42 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-07-03 22:58:42 +0400
commitd3be3daafef4b614fc676c807956047976848c7e (patch)
tree5b4d096a0d74c67da43a94a65f7614b0425fc774 /src/pkg/runtime
parent2ec3a0a72fbe2cdd4affc67383ae67c503e7469b (diff)
downloadgo-d3be3daafef4b614fc676c807956047976848c7e.tar.xz
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
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/mgc0.c5
-rw-r--r--src/pkg/runtime/runtime.h2
2 files changed, 1 insertions, 6 deletions
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c
index 4ad8f3b08f..059417209d 100644
--- a/src/pkg/runtime/mgc0.c
+++ b/src/pkg/runtime/mgc0.c
@@ -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);
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h
index 0f630abbf2..2fab69b3a2 100644
--- a/src/pkg/runtime/runtime.h
+++ b/src/pkg/runtime/runtime.h
@@ -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;
};