From 348087877cc02948d062bc770a4f4d67b2819797 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9my=20Oudompheng?= Date: Wed, 30 May 2012 08:04:11 +0200 Subject: [PATCH] runtime: do not unset the special bit after finalization. A block with finalizer might also be profiled. The special bit is needed to unregister the block from the profile. It will be unset only when the block is freed. Fixes #3668. R=golang-dev, rsc CC=golang-dev, remy https://golang.org/cl/6249066 --- src/pkg/runtime/mfinal.c | 3 +-- src/pkg/runtime/mgc0.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pkg/runtime/mfinal.c b/src/pkg/runtime/mfinal.c index c6f2b54219..1fa5ea401d 100644 --- a/src/pkg/runtime/mfinal.c +++ b/src/pkg/runtime/mfinal.c @@ -150,8 +150,7 @@ runtime·addfinalizer(void *p, void (*f)(void*), int32 nret) tab = TAB(p); runtime·lock(tab); if(f == nil) { - if(lookfintab(tab, p, true, nil)) - runtime·setblockspecial(p, false); + lookfintab(tab, p, true, nil); runtime·unlock(tab); return true; } diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index d718b5aea9..5fde535a5e 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -1042,7 +1042,6 @@ runfinq(void) framecap = framesz; } *(void**)frame = f->arg; - runtime·setblockspecial(f->arg, false); reflect·call((byte*)f->fn, frame, sizeof(uintptr) + f->nret); f->fn = nil; f->arg = nil; -- 2.48.1