Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
6770663f
Commit
6770663f
authored
Jun 15, 2013
by
ian@well-typed.com
Browse files
Check for a weak pointer being dead before we do any allocation for it
parent
d61c623e
Changes
1
Hide whitespace changes
Inline
Side-by-side
rts/PrimOps.cmm
View file @
6770663f
...
...
@@ -404,6 +404,14 @@ stg_addCFinalizzerToWeakzh ( W_ fptr, // finalizer
{
W_
c
,
info
;
(
"
ptr
"
info
)
=
ccall
lockClosure
(
w
"
ptr
"
);
if
(
info
==
stg_DEAD_WEAK_info
)
{
// Already dead.
unlockClosure
(
w
,
info
);
return
(
0
);
}
ALLOC_PRIM
(
SIZEOF_StgCFinalizerList
)
c
=
Hp
-
SIZEOF_StgCFinalizerList
+
WDS
(
1
);
...
...
@@ -414,14 +422,6 @@ stg_addCFinalizzerToWeakzh ( W_ fptr, // finalizer
StgCFinalizerList_eptr
(
c
)
=
eptr
;
StgCFinalizerList_flag
(
c
)
=
flag
;
(
"
ptr
"
info
)
=
ccall
lockClosure
(
w
"
ptr
"
);
if
(
info
==
stg_DEAD_WEAK_info
)
{
// Already dead.
unlockClosure
(
w
,
info
);
return
(
0
);
}
StgCFinalizerList_link
(
c
)
=
StgWeak_cfinalizers
(
w
);
StgWeak_cfinalizers
(
w
)
=
c
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment