]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: don't use ... formal argument to deferreturn.
authorKeith Randall <khr@golang.org>
Mon, 2 Dec 2013 21:07:15 +0000 (13:07 -0800)
committerKeith Randall <khr@golang.org>
Mon, 2 Dec 2013 21:07:15 +0000 (13:07 -0800)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/28860043

src/cmd/gc/pgen.c
src/pkg/runtime/panic.c

index 2850af6bb04c26a701b71af2e70e214baf15b7c5..2d364529e0467c4280f87520d6a4f297c4c51f35 100644 (file)
@@ -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();
index 8227a444d30db3575e14dd5447421f620902d741..b60547ea10dec2786943938dc93dd2f25162c1eb 100644 (file)
@@ -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;