]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: garbage collector runs on g0 now.
authorKeith Randall <khr@golang.org>
Fri, 14 Jun 2013 18:42:51 +0000 (11:42 -0700)
committerKeith Randall <khr@golang.org>
Fri, 14 Jun 2013 18:42:51 +0000 (11:42 -0700)
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

src/pkg/runtime/mgc0.c

index dc38e2aff5bd83bbdf341d21ef03be3c09d5dfdd..a55ee49c7777cdc82b9abefa740181b9258e5968 100644 (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);
 }