summaryrefslogtreecommitdiff
path: root/rts/Linker.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2015-06-08 11:54:51 +0100
committerSimon Marlow <marlowsd@gmail.com>2015-06-08 11:59:22 +0100
commit19ec6a84d6344c2808d0d41da11956689a0e4ae9 (patch)
treee83ad4f659c4f6323b91d6e562bd1cdf7bacf765 /rts/Linker.c
parent89223ce1340654455a9f3aa9cbf25f30884227fd (diff)
downloadhaskell-19ec6a84d6344c2808d0d41da11956689a0e4ae9.tar.gz
Fix for CAF retention when dynamically loading & unloading code
In a situaion where we have some statically-linked code and we want to load and unload a series of objects, we need the CAFs in the statically-linked code to be retained indefinitely, while the CAFs in the dynamically-linked code should be GC'd as normal, so that we can detect when the code is unloadable. This was wrong before - we GC'd CAFs in the static code, leading to a crash in the rare case where we use a CAF, GC it, and then load a new object that uses it again. I also did some tidy up: RtsConfig now has a field keep_cafs to indicate whether we want CAFs to be retained in static code.
Diffstat (limited to 'rts/Linker.c')
-rw-r--r--rts/Linker.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 9d3ca1243e..bbf75bfd79 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -1512,7 +1512,7 @@ RTS_LIBFFI_SYMBOLS
#define SymE_NeedsDataProto(vvv) SymE_HasDataProto(vvv)
// SymI_HasProto_redirect allows us to redirect references to one symbol to
-// another symbol. See newCAF/newDynCAF for an example.
+// another symbol. See newCAF/newRetainedCAF/newGCdCAF for an example.
#define SymI_HasProto_redirect(vvv,xxx) \
{ MAYBE_LEADING_UNDERSCORE_STR(#vvv), \
(void*)(&(xxx)) },
@@ -1692,10 +1692,10 @@ initLinker_ (int retain_cafs)
barf("ghciInsertSymbolTable failed");
}
- // Redurect newCAF to newDynCAF if retain_cafs is true.
+ // Redurect newCAF to newRetainedCAF if retain_cafs is true.
if (! ghciInsertSymbolTable(WSTR("(GHCi built-in symbols)"), symhash,
MAYBE_LEADING_UNDERSCORE_STR("newCAF"),
- retain_cafs ? newDynCAF : newCAF,
+ retain_cafs ? newRetainedCAF : newGCdCAF,
HS_BOOL_FALSE, NULL)) {
barf("ghciInsertSymbolTable failed");
}