diff options
author | Takano Akio <aljee@hyper.cx> | 2013-04-18 18:30:23 +0900 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2013-06-15 16:23:09 +0100 |
commit | d61c623ed6b2d352474a7497a65015dbf6a72e12 (patch) | |
tree | 13132eb4473fb8594bd72e168f918ea79a0c9da6 /rts/StgMiscClosures.cmm | |
parent | 5d9e686c30a00be08a04d9fd1c860994153a1f7a (diff) | |
download | haskell-d61c623ed6b2d352474a7497a65015dbf6a72e12.tar.gz |
Allow multiple C finalizers to be attached to a Weak#
The commit replaces mkWeakForeignEnv# with addCFinalizerToWeak#.
This new primop mutates an existing Weak# object and adds a new
C finalizer to it.
This change removes an invariant in MarkWeak.c, namely that the relative
order of Weak# objects in the list needs to be preserved across GC. This
makes it easier to split the list into per-generation structures.
The patch also removes a race condition between two threads calling
finalizeWeak# on the same WEAK object at that same time.
Diffstat (limited to 'rts/StgMiscClosures.cmm')
-rw-r--r-- | rts/StgMiscClosures.cmm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/rts/StgMiscClosures.cmm b/rts/StgMiscClosures.cmm index 28a41ad681..9484031832 100644 --- a/rts/StgMiscClosures.cmm +++ b/rts/StgMiscClosures.cmm @@ -439,6 +439,15 @@ INFO_TABLE_CONSTR(stg_DEAD_WEAK,0,5,0,CONSTR,"DEAD_WEAK","DEAD_WEAK") { foreign "C" barf("DEAD_WEAK object entered!") never returns; } /* ---------------------------------------------------------------------------- + C finalizer lists + + Singly linked lists that chain multiple C finalizers on a weak pointer. + ------------------------------------------------------------------------- */ + +INFO_TABLE_CONSTR(stg_C_FINALIZER_LIST,1,4,0,CONSTR,"C_FINALIZER_LIST","C_FINALIZER_LIST") +{ foreign "C" barf("C_FINALIZER_LIST object entered!") never returns; } + +/* ---------------------------------------------------------------------------- NO_FINALIZER This is a static nullary constructor (like []) that we use to mark an empty |