aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/proc.c
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2013-08-05 23:33:50 +0400
committerDmitriy Vyukov <dvyukov@google.com>2013-08-05 23:33:50 +0400
commitf38ff9e5ea24d1ea27928cfdc35c4679abe4673f (patch)
tree0d587f2450617c81dd323f60e789660b68e76a5a /src/pkg/runtime/proc.c
parent7963ba6a4a7a9ab701cfac0e4f006d0a59c1b65e (diff)
downloadgo-f38ff9e5ea24d1ea27928cfdc35c4679abe4673f.tar.xz
undo CL 12250043 / e911f94c4902
Break all 386 builders. ««« original CL description runtime: use gcpc/gcsp during traceback of goroutines in syscalls gcpc/gcsp are used by GC in similar situation. gcpc/gcsp are also more stable than gp->sched, because gp->sched is mutated by entersyscall/exitsyscall in morestack and mcall. So it has higher chances of being inconsistent. Also, rename gcpc/gcsp to syscallpc/syscallsp. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/12250043 »»» R=rsc CC=golang-dev https://golang.org/cl/12424045
Diffstat (limited to 'src/pkg/runtime/proc.c')
-rw-r--r--src/pkg/runtime/proc.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 725a49668b..cff30c8ffa 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -1358,6 +1358,8 @@ goexit0(G *gp)
static void
save(void *pc, uintptr sp)
{
+ g->gcpc = (uintptr)pc;
+ g->gcsp = sp;
g->sched.pc = (uintptr)pc;
g->sched.sp = sp;
g->sched.lr = 0;
@@ -1385,16 +1387,15 @@ void
if(m->profilehz > 0)
runtime·setprof(false);
- // Leave SP around for GC and traceback.
+ // Leave SP around for gc and traceback.
save(runtime·getcallerpc(&dummy), runtime·getcallersp(&dummy));
- g->syscallsp = g->sched.sp;
- g->syscallpc = g->sched.pc;
- g->syscallstack = g->stackbase;
- g->syscallguard = g->stackguard;
+
+ g->gcstack = g->stackbase;
+ g->gcguard = g->stackguard;
g->status = Gsyscall;
- if(g->syscallsp < g->syscallguard-StackGuard || g->syscallstack < g->syscallsp) {
+ if(g->gcsp < g->gcguard-StackGuard || g->gcstack < g->gcsp) {
// runtime·printf("entersyscall inconsistent %p [%p,%p]\n",
- // g->syscallsp, g->syscallguard-StackGuard, g->syscallstack);
+ // g->gcsp, g->gcguard-StackGuard, g->gcstack);
runtime·throw("entersyscall");
}
@@ -1441,16 +1442,16 @@ void
if(m->profilehz > 0)
runtime·setprof(false);
- // Leave SP around for GC and traceback.
+ // Leave SP around for gc and traceback.
save(runtime·getcallerpc(&dummy), runtime·getcallersp(&dummy));
- g->syscallsp = g->sched.sp;
- g->syscallpc = g->sched.pc;
- g->syscallstack = g->stackbase;
- g->syscallguard = g->stackguard;
+ g->gcsp = g->sched.sp;
+ g->gcpc = g->sched.pc;
+ g->gcstack = g->stackbase;
+ g->gcguard = g->stackguard;
g->status = Gsyscall;
- if(g->syscallsp < g->syscallguard-StackGuard || g->syscallstack < g->syscallsp) {
- // runtime·printf("entersyscall inconsistent %p [%p,%p]\n",
- // g->syscallsp, g->syscallguard-StackGuard, g->syscallstack);
+ if(g->gcsp < g->gcguard-StackGuard || g->gcstack < g->gcsp) {
+ // runtime·printf("entersyscallblock inconsistent %p [%p,%p]\n",
+ // g->gcsp, g->gcguard-StackGuard, g->gcstack);
runtime·throw("entersyscallblock");
}
@@ -1489,8 +1490,8 @@ runtime·exitsyscall(void)
g->status = Grunning;
// Garbage collector isn't running (since we are),
// so okay to clear gcstack and gcsp.
- g->syscallstack = (uintptr)nil;
- g->syscallsp = (uintptr)nil;
+ g->gcstack = (uintptr)nil;
+ g->gcsp = (uintptr)nil;
m->locks--;
if(g->preempt) {
// restore the preemption request in case we've cleared it in newstack
@@ -1513,8 +1514,8 @@ runtime·exitsyscall(void)
// Must wait until now because until gosched returns
// we don't know for sure that the garbage collector
// is not running.
- g->syscallstack = (uintptr)nil;
- g->syscallsp = (uintptr)nil;
+ g->gcstack = (uintptr)nil;
+ g->gcsp = (uintptr)nil;
}
#pragma textflag 7