Commit de316388 authored by Keith Randall's avatar Keith Randall

runtime: garbage collector runs on g0 now.

No need to change to Grunnable state.
Add some more checks for Grunning state.

R=golang-dev, rsc, khr, dvyukov
CC=golang-dev
https://golang.org/cl/10186045
parent 39613054
...@@ -1541,8 +1541,10 @@ addroots(void) ...@@ -1541,8 +1541,10 @@ addroots(void)
case Gdead: case Gdead:
break; break;
case Grunning: case Grunning:
if(gp != g) if(gp != m->curg)
runtime·throw("mark - world not stopped"); runtime·throw("mark - world not stopped");
if(g != m->g0)
runtime·throw("gc not on g0");
addstackroots(gp); addstackroots(gp);
break; break;
case Grunnable: case Grunnable:
...@@ -2035,9 +2037,7 @@ runtime·gc(int32 force) ...@@ -2035,9 +2037,7 @@ runtime·gc(int32 force)
static void static void
mgc(G *gp) mgc(G *gp)
{ {
gp->status = Grunnable;
gc(gp->param); gc(gp->param);
gp->status = Grunning;
gp->param = nil; gp->param = nil;
runtime·gogo(&gp->sched); runtime·gogo(&gp->sched);
} }
......
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