saving of sp was too far away from use in scanstack;
the stack had changed since the sp was saved.
R=r
DELTA=9 (4 added, 2 deleted, 3 changed)
OCL=32232
CL=32237
for(n=0; n<100; n++) {
if(pc == (uint64)sys·lessstack) {
// pop to earlier stack block
+ // printf("-- stack jump %p => %p\n", sp, stk->gobuf.sp);
pc = (uintptr)stk->gobuf.pc;
sp = stk->gobuf.sp;
stk = (Stktop*)stk->stackbase;
}
static void
-scanstack(G *g)
+scanstack(G *gp)
{
Stktop *stk;
byte *sp;
- sp = g->sched.sp;
- stk = (Stktop*)g->stackbase;
+ if(gp == g)
+ sp = (byte*)&gp;
+ else
+ sp = gp->sched.sp;
+ stk = (Stktop*)gp->stackbase;
while(stk) {
scanblock(0, sp, (byte*)stk - sp);
sp = stk->gobuf.sp;
//printf("gc...\n");
m->gcing = 1;
semacquire(&gcsema);
- gosave(&g->sched); // update g's stack pointer for scanstack
stoptheworld();
if(mheap.Lock.key != 0)
throw("mheap locked during gc");
mstats.next_gc = mstats.inuse_pages+mstats.inuse_pages*gcpercent/100;
}
starttheworld();
- gosave(&g->sched); // update g's stack pointer for debugging
semrelease(&gcsema);
m->gcing = 0;
}