]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: tweak addfinroots to preserve original pointer
authorRuss Cox <rsc@golang.org>
Thu, 14 Feb 2013 03:31:45 +0000 (22:31 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 14 Feb 2013 03:31:45 +0000 (22:31 -0500)
Use local variable so that stack trace will show value of v.

Fixes #4790.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/7300106

src/pkg/runtime/mgc0.c

index 031a63c4898b86111df86d6a7b415f08e6abbdb6..c9295bbc27c9b7fe3b783fb04220ba88f8226633 100644 (file)
@@ -1255,13 +1255,14 @@ static void
 addfinroots(void *v)
 {
        uintptr size;
+       void *base;
 
        size = 0;
-       if(!runtime·mlookup(v, &v, &size, nil) || !runtime·blockspecial(v))
+       if(!runtime·mlookup(v, &base, &size, nil) || !runtime·blockspecial(base))
                runtime·throw("mark - finalizer inconsistency");
 
        // do not mark the finalizer block itself.  just mark the things it points at.
-       addroot((Obj){v, size, 0});
+       addroot((Obj){base, size, 0});
 }
 
 static void