• Simon Marlow's avatar
    Fix for CAF retention when dynamically loading & unloading code · 19ec6a84
    Simon Marlow authored
    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.
Linker.c 272 KB