[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: rts: free error message before returning
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Apr 9 18:35:01 UTC 2024
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
f1e9a03b by Rodrigo Mesquita at 2024-04-09T14:34:54-04:00
rts: free error message before returning
Fixes a memory leak in rts/linker/PEi386.c
- - - - -
288cd038 by Alexis King at 2024-04-09T14:34:54-04:00
linker: Avoid linear search when looking up Haskell symbols via dlsym
See the primary Note [Looking up symbols in the relevant objects] for a
more in-depth explanation.
When dynamically loading a Haskell symbol (typical when running a splice or
GHCi expression), before this commit we would search for the symbol in
all dynamic libraries that were loaded. However, this could be very
inefficient when too many packages are loaded (which can happen if there are
many package dependencies) because the time to lookup the would be
linear in the number of packages loaded.
This commit drastically improves symbol loading performance by
introducing a mapping from units to the handles of corresponding loaded
dlls. These handles are returned by dlopen when we load a dll, and can
then be used to look up in a specific dynamic library.
Looking up a given Name is now much more precise because we can get
lookup its unit in the mapping and lookup the symbol solely in the
handles of the dynamic libraries loaded for that unit.
In one measurement, the wait time before the expression was executed
went from +-38 seconds down to +-2s.
This commit also includes Note [Symbols may not be found in pkgs_loaded],
explaining the fallback to the old behaviour in case no dll can be found
in the unit mapping for a given Name.
Fixes #23415
Co-authored-by: Rodrigo Mesquita (@alt-romes)
- - - - -
85564765 by Rodrigo Mesquita at 2024-04-09T14:34:54-04:00
rts: Make addDLL a wrapper around loadNativeObj
Rewrite the implementation of `addDLL` as a wrapper around the more
principled `loadNativeObj` rts linker function. The latter should be
preferred while the former is preserved for backwards compatibility.
`loadNativeObj` was previously only available on ELF platforms, so this
commit further refactors the rts linker to transform loadNativeObj_ELF
into loadNativeObj_POSIX, which is available in ELF and MachO platforms.
The refactor made it possible to remove the `dl_mutex` mutex in favour
of always using `linker_mutex` (rather than a combination of both).
Lastly, we implement `loadNativeObj` for Windows too.
- - - - -
8afb3ded by Rodrigo Mesquita at 2024-04-09T14:34:54-04:00
Use symbol cache in internal interpreter too
This commit makes the symbol cache that was used by the external
interpreter available for the internal interpreter too.
This follows from the analysis in #23415 that suggests the internal
interpreter could benefit from this cache too, and that there is no good
reason not to have the cache for it too. It also makes it a bit more
uniform to have the symbol cache range over both the internal and
external interpreter.
This commit also refactors the cache into a function which is used by
both `lookupSymbol` and also by `lookupSymbolInDLL`, extending the
caching logic to `lookupSymbolInDLL` too.
- - - - -
f62f869c by Ben Gamari at 2024-04-09T14:34:54-04:00
testsuite: Add test for lookupSymbolInNativeObj
- - - - -
7867e9c3 by Zejun Wu at 2024-04-09T14:34:56-04:00
Make renamer to be more flexible with parens in the LHS of the rules
We used to reject LHS like `(f a) b` in RULES and requires it to be written as
`f a b`. It will be handy to allow both as the expression may be more
readable with extra parens in some cases when infix operator is involved.
Espceially when TemplateHaskell is used, extra parens may be added out of
user's control and result in "valid" rules being rejected and there
are not always ways to workaround it.
Fixes #24621
- - - - -
30 changed files:
- compiler/GHC.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Plugins.hs
- compiler/GHC/Linker/Loader.hs
- compiler/GHC/Linker/MacOS.hs
- compiler/GHC/Linker/Types.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Runtime/Interpreter.hs
- compiler/GHC/Runtime/Interpreter/JS.hs
- compiler/GHC/Runtime/Interpreter/Types.hs
- libraries/ghci/GHCi/Message.hs
- libraries/ghci/GHCi/ObjLink.hs
- libraries/ghci/GHCi/Run.hs
- rts/Linker.c
- rts/LinkerInternals.h
- rts/RtsSymbols.c
- rts/include/rts/Linker.h
- rts/linker/Elf.c
- rts/linker/Elf.h
- + rts/linker/LoadNativeObjPosix.c
- + rts/linker/LoadNativeObjPosix.h
- rts/linker/PEi386.c
- rts/linker/PEi386.h
- rts/rts.cabal
- testsuite/tests/ghci/linking/dyn/T3372.hs
- + testsuite/tests/rename/should_compile/T24621.hs
- testsuite/tests/rename/should_compile/all.T
- testsuite/tests/rts/linker/T2615.hs
- + testsuite/tests/rts/linker/lookupSymbolInNativeObj/Makefile
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5587bb5d8a28c19f08a7439d155212cf82702aeb...7867e9c33e842466230461c47ed6a634194bf80e
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/5587bb5d8a28c19f08a7439d155212cf82702aeb...7867e9c33e842466230461c47ed6a634194bf80e
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/20240409/250aa956/attachment-0001.html>
More information about the ghc-commits
mailing list