1
0
mirror of https://github.com/golang/go synced 2024-11-26 01:07:57 -07:00

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
This commit is contained in:
Keith Randall 2013-06-14 11:42:51 -07:00
parent 39613054af
commit de316388a7

View File

@ -1541,8 +1541,10 @@ addroots(void)
case Gdead:
break;
case Grunning:
if(gp != g)
if(gp != m->curg)
runtime·throw("mark - world not stopped");
if(g != m->g0)
runtime·throw("gc not on g0");
addstackroots(gp);
break;
case Grunnable:
@ -2035,9 +2037,7 @@ runtime·gc(int32 force)
static void
mgc(G *gp)
{
gp->status = Grunnable;
gc(gp->param);
gp->status = Grunning;
gp->param = nil;
runtime·gogo(&gp->sched);
}