diff options
author | Russ Cox <rsc@golang.org> | 2010-03-26 14:15:30 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-03-26 14:15:30 -0700 |
commit | c6221cc53e654c4e030ee09cce92c1520bf097f5 (patch) | |
tree | 286db01b6d244d9f2733251fcfbe2412ca44bb09 /src/pkg/runtime/malloc.h | |
parent | ff95626036bb6ce991fca21ea69f1a00b77958a4 (diff) | |
download | golang-c6221cc53e654c4e030ee09cce92c1520bf097f5.tar.gz |
runtime: run all finalizers in a single goroutine.
eliminate second pass of mark+sweep
by scanning finalizer table specially.
R=r
CC=golang-dev
http://codereview.appspot.com/782041
Diffstat (limited to 'src/pkg/runtime/malloc.h')
-rw-r--r-- | src/pkg/runtime/malloc.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h index 67e7d42eb..621394bda 100644 --- a/src/pkg/runtime/malloc.h +++ b/src/pkg/runtime/malloc.h @@ -330,8 +330,6 @@ void* SysAlloc(uintptr); void SysUnused(void*, uintptr); void SysFree(void*, uintptr); -void* getfinalizer(void*, bool, int32*); - enum { RefcountOverhead = 4, // one uint32 per object @@ -340,7 +338,6 @@ enum RefStack, // stack segment - don't free and don't scan for pointers RefNone, // no references RefSome, // some references - RefFinalize, // ready to be finalized RefNoPointers = 0x80000000U, // flag - no pointers here RefHasFinalizer = 0x40000000U, // flag - has finalizer RefProfiled = 0x20000000U, // flag - is in profiling table @@ -359,3 +356,14 @@ enum { MProf_All = 2, }; extern int32 malloc_profile; + +typedef struct Finalizer Finalizer; +struct Finalizer +{ + Finalizer *next; // for use by caller of getfinalizer + void (*fn)(void*); + void *arg; + int32 nret; +}; + +Finalizer* getfinalizer(void*, bool); |