Moduleghc-10.0.0.20260917GHC2024
GHC.Linker.Loader
The loader
This module deals with the top-level issues of dynamic linking (loading), calling the object-code linker and the byte-code linker where necessary.
- 2 types
- 22 values
- Packageghc-10.0.0.20260917
- Exports24
- LanguageGHC2024
- LicenceBSD-3-Clause
- SourceLoader.hs
Constructors
LoaderStatebco_loader_state :: !BytecodeLoaderStateInformation about bytecode objects we have loaded into the interpreter.
bcos_loaded :: !LinkableSet LinkableUsageThe currently loaded interpreted modules (home package)
objs_loaded :: !LinkableSet LinkableUsageAnd the currently-loaded compiled modules (home package)
pkgs_loaded :: !PkgsLoadedThe currently-loaded packages; haskell libraries, system libraries, transitive dependencies
temp_sos :: ![(FilePath, String)]We need to remember the name of previous temporary DLL/.so libraries so we can link them (see #10322)
Initialise the dynamic linker. This entails
a) Calling the C initialisation procedure,
b) Loading any packages specified on the command line,
c) Loading any packages specified on the command line, now held in the
-l options in v_Opt_l,
d) Loading any .o/.dll files specified on the command line, now held
in ldInputs,
e) Loading any MacOS frameworks.
NOTE: This function is idempotent; if called more than once, it does nothing. This is useful in Template Haskell, where we call it before trying to link.
Display the loader state.
Load & Unload
6 declarationsLoad the dependencies of a linkable, and then load the linkable itself.
Load exactly the specified packages, and their dependents (unless of course they are already loaded). The dependents are loaded automatically, and it doesn't matter what order you specify the input packages.
Load the module containing the given Name and get its associated HValue.
Throws a ProgramError if loading fails or the name cannot be found.
Unloading old objects ready for a new compilation sweep. * compilation artifacts for home modules that we might be about to recompile are unloaded from the interpreter. * we also implicitly unload all temporary bindings at this point.
LoadedEnv
4 declarationsTemporarily extend the loaded env.
Have we already loaded a name into the interpreter?
Internals
8 declarationsGiven a list of InternalModBreaks collected from a list of CompiledByteCode, allocate the BreakArray used to trigger breakpoints.
rmDupLinkables :: LinkableSet LinkableUsageAlready loaded
-> [Linkable]New linkables
-> (LinkableSet LinkableUsage, [Linkable])
Create a shared library containing the given object files
loadMoreUnits :: HscEnv-> [UnitId]New packages to process (not yet in PkgsLoaded)
-> PkgsLoadedExisting loaded packages (used for memoization)
-> IO ([UnitInfo], PkgsLoaded)Reverse topologically-sorted new package infos + updated PkgsLoaded
Compute LoadedPkgInfo metadata (with transitive deps) for new packages,
without loading any native libraries. Used for recompilation-avoidance
tracking and as the first pass of loadPackages'.
The returned '[UnitInfo]' list is an accumulated *reverse* topologically sorted list of new packages. The returned PkgsLoaded is populated with placeholder LoadedPkgInfo for new packages (empty artifact fields, correct loaded_pkg_trans_deps).
Restrict a PkgsLoaded map to the packages directly needed and their full transitive closure (via loaded_pkg_trans_deps).