stack overflow debugging and fix.

* in 6l, -K already meant check for stack underflow.
    add -KK to mean double-check stack overflows
    even in nosplit functions.

  * comment out print locks; they deadlock too easily
     but are still useful to put back for special occasions.

  * let runcgo assembly switch to scheduler stack
    without involving scheduler directly.  because runcgo
    gets called from matchmg, it is too hard to keep it
    from being called on other stacks.

R=r
DELTA=94  (65 added, 18 deleted, 11 changed)
OCL=35591
CL=35604
This commit is contained in:
Russ Cox 2009-10-12 10:26:38 -07:00
parent fd76b4f385
commit add89dd1ba
7 changed files with 77 additions and 30 deletions

View file

@ -95,7 +95,7 @@ schedinit(void)
{
int32 n;
byte *p;
allm = m;
mallocinit();
@ -452,15 +452,6 @@ scheduler(void)
lock(&sched);
if(gosave(&m->sched) != 0){
gp = m->curg;
if(gp->status == Gcgocall){
// Runtime call into external code (FFI).
// When running with FFI, the scheduler stack is a
// native pthread stack, so it suffices to switch to the
// scheduler stack and make the call.
runcgo(gp->cgofn, gp->cgoarg);
gp->status = Grunning;
gogo(&gp->sched, 1);
}
// Jumped here via gosave/gogo, so didn't
// execute lock(&sched) above.