mirror of
https://github.com/golang/go
synced 2024-09-05 16:04:50 +00:00
runtime: fix bad status throw
when garbage collector sees recovering goroutine Fixes #711. R=r CC=golang-dev https://golang.org/cl/869045
This commit is contained in:
parent
2f0cae46d8
commit
72157c300b
|
@ -135,6 +135,7 @@ mark(void)
|
||||||
case Grunnable:
|
case Grunnable:
|
||||||
case Gsyscall:
|
case Gsyscall:
|
||||||
case Gwaiting:
|
case Gwaiting:
|
||||||
|
case Grecovery:
|
||||||
scanstack(gp);
|
scanstack(gp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,8 +461,6 @@ scheduler(void)
|
||||||
|
|
||||||
// unwind to the stack frame with d->sp in it.
|
// unwind to the stack frame with d->sp in it.
|
||||||
unwindstack(gp, d->sp);
|
unwindstack(gp, d->sp);
|
||||||
if(d->sp < gp->stackguard || gp->stackbase < d->sp)
|
|
||||||
throw("bad stack in recovery");
|
|
||||||
|
|
||||||
// make the deferproc for this d return again,
|
// make the deferproc for this d return again,
|
||||||
// this time returning 1. function will jump to
|
// this time returning 1. function will jump to
|
||||||
|
@ -930,6 +928,11 @@ unwindstack(G *gp, byte *sp)
|
||||||
gp->stackguard = top->stackguard;
|
gp->stackguard = top->stackguard;
|
||||||
free(stk);
|
free(stk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(sp != nil && (sp < gp->stackguard - StackGuard || gp->stackbase < sp)) {
|
||||||
|
printf("recover: %p not in [%p, %p]\n", sp, gp->stackguard - StackGuard, gp->stackbase);
|
||||||
|
throw("bad unwindstack");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -92,6 +92,10 @@ extern register M* m;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
// G status
|
// G status
|
||||||
|
//
|
||||||
|
// If you add to this list, add to the list
|
||||||
|
// of "okay during garbage collection" status
|
||||||
|
// in mgc0.c too.
|
||||||
Gidle,
|
Gidle,
|
||||||
Grunnable,
|
Grunnable,
|
||||||
Grunning,
|
Grunning,
|
||||||
|
|
Loading…
Reference in a new issue