From: Keith Randall Date: Mon, 2 Dec 2013 21:07:15 +0000 (-0800) Subject: runtime: don't use ... formal argument to deferreturn. X-Git-Tag: go1.3beta1~1324 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=c792bde9eff10869a503910f9c14ea24047ecafa;p=gostls13.git runtime: don't use ... formal argument to deferreturn. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/28860043 --- diff --git a/src/cmd/gc/pgen.c b/src/cmd/gc/pgen.c index 2850af6bb0..2d364529e0 100644 --- a/src/cmd/gc/pgen.c +++ b/src/cmd/gc/pgen.c @@ -168,8 +168,13 @@ compile(Node *fn) if(retpc) patch(retpc, pc); ginit(); - if(hasdefer) + if(hasdefer) { ginscall(deferreturn, 0); + // deferreturn pretends to have one uintptr argument. + // Reserve space for it so stack scanner is happy. + if(maxarg < widthptr) + maxarg = widthptr; + } if(curfn->exit) genlist(curfn->exit); gclean(); diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c index 8227a444d3..b60547ea10 100644 --- a/src/pkg/runtime/panic.c +++ b/src/pkg/runtime/panic.c @@ -157,14 +157,12 @@ runtime·deferproc(int32 siz, FuncVal *fn, ...) // is called again and again until there are no more deferred functions. // Cannot split the stack because we reuse the caller's frame to // call the deferred function. -// -// The ... in the prototype keeps the compiler from declaring -// an argument frame size. deferreturn is a very special function, -// and if the runtime ever asks for its frame size, that means -// the traceback routines are probably broken. + +// The single argument isn't actually used - it just has its address +// taken so it can be matched against pending defers. #pragma textflag NOSPLIT void -runtime·deferreturn(uintptr arg0, ...) +runtime·deferreturn(uintptr arg0) { Defer *d; byte *argp;