aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/stack.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/stack.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/stack.c')
-rw-r--r--src/pkg/runtime/stack.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c
index a033d6b012..68477ad8da 100644
--- a/src/pkg/runtime/stack.c
+++ b/src/pkg/runtime/stack.c
@@ -155,8 +155,8 @@ runtime·oldstack(void)
USED(goid);
label = top->gobuf;
- 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(old, top->free);
@@ -176,7 +176,8 @@ runtime·newstack(void)
{
int32 framesize, minalloc, argsize;
Stktop *top;
- byte *stk, *sp;
+ byte *stk;
+ uintptr sp;
uintptr *src, *dst, *dstend;
G *gp;
Gobuf label;
@@ -234,14 +235,14 @@ runtime·newstack(void)
framesize, argsize, m->morepc, m->moreargp, m->morebuf.pc, m->morebuf.sp, top, gp->stackbase);
}
- top->stackbase = (byte*)gp->stackbase;
- top->stackguard = (byte*)gp->stackguard;
+ top->stackbase = gp->stackbase;
+ top->stackguard = gp->stackguard;
top->gobuf = m->morebuf;
top->argp = m->moreargp;
top->argsize = argsize;
top->free = free;
m->moreargp = nil;
- m->morebuf.pc = nil;
+ m->morebuf.pc = (uintptr)nil;
m->morebuf.sp = (uintptr)nil;
// copy flag from panic
@@ -252,7 +253,7 @@ runtime·newstack(void)
gp->stackguard = (uintptr)stk + StackGuard;
gp->stackguard0 = gp->stackguard;
- sp = (byte*)top;
+ sp = (uintptr)top;
if(argsize > 0) {
sp -= argsize;
dst = (uintptr*)sp;
@@ -269,8 +270,8 @@ runtime·newstack(void)
// Continue as if lessstack had just called m->morepc
// (the PC that decided to grow the stack).
- label.sp = (uintptr)sp;
- label.pc = (byte*)runtime·lessstack;
+ label.sp = sp;
+ label.pc = (uintptr)runtime·lessstack;
label.g = m->curg;
if(reflectcall)
runtime·gogocallfn(&label, (FuncVal*)m->morepc);