summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorTakano Akio <aljee@hyper.cx>2013-04-18 18:30:23 +0900
committerIan Lynagh <ian@well-typed.com>2013-06-15 16:23:09 +0100
commitd61c623ed6b2d352474a7497a65015dbf6a72e12 (patch)
tree13132eb4473fb8594bd72e168f918ea79a0c9da6 /utils
parent5d9e686c30a00be08a04d9fd1c860994153a1f7a (diff)
downloadhaskell-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 'utils')
-rw-r--r--utils/deriveConstants/DeriveConstants.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/utils/deriveConstants/DeriveConstants.hs b/utils/deriveConstants/DeriveConstants.hs
index 78233a5b98..c731b9ea72 100644
--- a/utils/deriveConstants/DeriveConstants.hs
+++ b/utils/deriveConstants/DeriveConstants.hs
@@ -469,10 +469,14 @@ wanteds = concat
,closureField C "StgWeak" "key"
,closureField C "StgWeak" "value"
,closureField C "StgWeak" "finalizer"
- ,closureField C "StgWeak" "cfinalizer"
-
- ,closureSize C "StgDeadWeak"
- ,closureField C "StgDeadWeak" "link"
+ ,closureField C "StgWeak" "cfinalizers"
+
+ ,closureSize C "StgCFinalizerList"
+ ,closureField C "StgCFinalizerList" "link"
+ ,closureField C "StgCFinalizerList" "fptr"
+ ,closureField C "StgCFinalizerList" "ptr"
+ ,closureField C "StgCFinalizerList" "eptr"
+ ,closureField C "StgCFinalizerList" "flag"
,closureSize C "StgMVar"
,closureField C "StgMVar" "head"