WIP: Fix object unloading in GHCi
Fixes #16525 (closed)
Previously when checking for unloading object code we would skip pointers in the payload, which causes missing references to closures in dynamically loaded code. We now check all pointers in closure payloads.
This basically implements yet another heap traversal -- very similar to the ones we have in Scav.c
and NonMovingMark.c
. Unfortunately we don't have a generic traversal code parametric over how to visit a payload location, so I had to duplicate code ... Would be good to eliminate this somehow.
Other changes:
- Enables unloading in
GHC.Runtime.Linker.unload
- Adds a regression test. The test looks very similar to T16525a, but it actually triggers a segfault in GHC HEAD while T16525a doesn't.
- Removes an incorrect
memset()
inLinker.c
in debug builds.