[Git][ghc/ghc][wip/facebook/ghc-8.8-unloading] 5 commits: Revert "Add loadNativeObj and unloadNativeObj"

Ben Gamari gitlab at gitlab.haskell.org
Tue Nov 24 16:22:12 UTC 2020



Ben Gamari pushed to branch wip/facebook/ghc-8.8-unloading at Glasgow Haskell Compiler / GHC


Commits:
b8a23380 by Ben Gamari at 2020-11-24T16:21:44+00:00
Revert "Add loadNativeObj and unloadNativeObj"

This reverts commit b6482d18f78fc52de3321c03ab20cb84f0253016.

- - - - -
fe92ef34 by Ben Gamari at 2020-11-24T16:21:48+00:00
rts: Refactor foreign export tracking

This avoids calling `libc` in the initializers which are responsible for
registering foreign exports. We believe this should avoid the corruption
observed in #18548.

See Note [Tracking foreign exports] in rts/ForeignExports.c for an
overview of the new scheme.

(cherry picked from commit c492134912e5270180881b7345ee86dc32756bdd)
(cherry picked from commit ed57c3a9eb9286faa222f98e484a9ef3432b2025)

- - - - -
d79732be by Ben Gamari at 2020-11-24T16:21:48+00:00
rts: Refactor unloading of foreign export StablePtrs

Previously we would allocate a linked list cell for each foreign export.
Now we can avoid this by taking advantage of the fact that they are
already broken into groups.

(cherry picked from commit 40dc91069d15bfc1d81f1722b39e06cac8fdddd1)
(cherry picked from commit 65be3832f3aa48bbde896ee846c18fcba1f16b42)

- - - - -
8ded6f17 by Ömer Sinan Ağacan at 2020-11-24T16:21:48+00:00
Fix and enable object unloading in GHCi

Fixes #16525 by tracking dependencies between object file symbols and
marking symbol liveness during garbage collection

See Note [Object unloading] in CheckUnload.c for details.

(cherry picked from commit c34a4b98b1f09ea3096d39a839a86f2d7185c796)
(cherry picked from commit a4153029347c48be38bace114438b72475e2c40f)

- - - - -
958aba5a by Ray Shih at 2020-11-24T16:21:48+00:00
Add loadNativeObj and unloadNativeObj

(This change is originally written by niteria)

This adds two functions:
* `loadNativeObj`
* `unloadNativeObj`
and implements them for Linux.

They are useful if you want to load a shared object with Haskell code
using the system linker and have GHC call dlclose() after the
code is no longer referenced from the heap.

Using the system linker allows you to load the shared object
above outside the low-mem region. It also loads the DWARF sections
in a way that `perf` understands.

`dl_iterate_phdr` is what makes this implementation Linux specific.

(cherry picked from commit 2782487f5f6ad9df4dc8725226a47f07fec77f9f)

- - - - -


30 changed files:

- compiler/deSugar/DsForeign.hs
- compiler/ghci/Linker.hs
- includes/Rts.h
- + includes/rts/ForeignExports.h
- includes/rts/storage/GC.h
- rts/CheckUnload.c
- rts/CheckUnload.h
- + rts/ForeignExports.c
- + rts/ForeignExports.h
- rts/Hash.c
- rts/Hash.h
- rts/Linker.c
- rts/LinkerInternals.h
- rts/RtsStartup.c
- rts/RtsSymbols.c
- rts/linker/Elf.c
- rts/linker/LoadArchive.c
- rts/linker/MachO.c
- rts/linker/PEi386.c
- rts/linker/elf_got.c
- rts/rts.cabal.in
- rts/sm/Evac.c
- rts/sm/GC.c
- rts/sm/GC.h
- rts/sm/Storage.c
- testsuite/tests/ghci/T16525a/T16525a.script
- testsuite/tests/ghci/T16525a/T16525a.stdout
- testsuite/tests/ghci/T16525a/all.T
- + testsuite/tests/ghci/T16525b/A.hs
- + testsuite/tests/ghci/T16525b/B.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0ac691710c8131767b940f0e36b171312dd1ba9e...958aba5ae6b579646c3c8055b1c9d3c17c3bbb03

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/0ac691710c8131767b940f0e36b171312dd1ba9e...958aba5ae6b579646c3c8055b1c9d3c17c3bbb03
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201124/337d8881/attachment-0001.html>


More information about the ghc-commits mailing list