aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/panic.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-06-12 08:49:38 -0400
committerRuss Cox <rsc@golang.org>2013-06-12 08:49:38 -0400
commite58f798c0c97c252e0b800a4223d20790ef6b166 (patch)
tree0a5611f4e3ea22708feef51a33c8862bf0e773e7 /src/pkg/runtime/panic.c
parent7ea75a5f188ff23fee5130199e89408c52ee59d1 (diff)
downloadgo-e58f798c0c97c252e0b800a4223d20790ef6b166.tar.xz
runtime: adjust traceback / garbage collector boundary
The garbage collection routine addframeroots is duplicating logic in the traceback routine that calls it, sometimes correctly, sometimes incorrectly, sometimes incompletely. Pass necessary information to addframeroots instead of deriving it anew. Should make addframeroots significantly more robust. It's certainly smaller. Also try to standardize on uintptr for saved pc, sp values. Will make CL 10036044 trivial. R=golang-dev, dave, dvyukov CC=golang-dev https://golang.org/cl/10169045
Diffstat (limited to 'src/pkg/runtime/panic.c')
-rw-r--r--src/pkg/runtime/panic.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c
index 18e4779540..b7075995f9 100644
--- a/src/pkg/runtime/panic.c
+++ b/src/pkg/runtime/panic.c
@@ -214,7 +214,7 @@ runtime·panic(Eface e)
p = runtime·mal(sizeof *p);
p->arg = e;
p->link = g->panic;
- p->stackbase = (byte*)g->stackbase;
+ p->stackbase = g->stackbase;
g->panic = p;
for(;;) {
@@ -254,11 +254,11 @@ static void
recovery(G *gp)
{
void *argp;
- void *pc;
+ uintptr pc;
// Info about defer passed in G struct.
argp = (void*)gp->sigcode0;
- pc = (void*)gp->sigcode1;
+ pc = (uintptr)gp->sigcode1;
// Unwind to the stack frame with d's arguments in it.
runtime·unwindstack(gp, argp);
@@ -292,12 +292,12 @@ runtime·unwindstack(G *gp, byte *sp)
if(g == gp)
runtime·throw("unwindstack on self");
- while((top = (Stktop*)gp->stackbase) != nil && top->stackbase != nil) {
+ while((top = (Stktop*)gp->stackbase) != 0 && top->stackbase != 0) {
stk = (byte*)gp->stackguard - StackGuard;
if(stk <= sp && sp < (byte*)gp->stackbase)
break;
- gp->stackbase = (uintptr)top->stackbase;
- gp->stackguard = (uintptr)top->stackguard;
+ gp->stackbase = top->stackbase;
+ gp->stackguard = top->stackguard;
gp->stackguard0 = gp->stackguard;
if(top->free != 0)
runtime·stackfree(stk, top->free);
@@ -413,7 +413,7 @@ runtime·dopanic(int32 unused)
if(g != m->g0) {
runtime·printf("\n");
runtime·goroutineheader(g);
- runtime·traceback(runtime·getcallerpc(&unused), runtime·getcallersp(&unused), 0, g);
+ runtime·traceback((uintptr)runtime·getcallerpc(&unused), (uintptr)runtime·getcallersp(&unused), 0, g);
}
if(!didothers) {
didothers = true;