Moduleghc-10.0.0.20260917GHC2024
GHC.Linker.Types
- 22 types
- 40 values
- Packageghc-10.0.0.20260917
- Exports62
- LanguageGHC2024
- LicenceBSD-3-Clause
- SourceTypes.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)
Bytecode Loader State
32 declarationsThe BytecodeLoaderState captures all the information about bytecode loaded
into the interpreter.
It is separated into two parts. One for bytecode objects loaded by the home package and
one for bytecode objects loaded from bytecode libraries for external packages.
Much like the HPT/EPS split, the home package state can be unloaded by calling unload.
Constructors
BytecodeLoaderStatehomePackage_loaded :: BytecodeStateInformation about bytecode objects from the home package we have loaded into the interpreter.
externalPackage_loaded :: BytecodeStateInformation about bytecode objects from external packages we have loaded into the interpreter.
Constructors
BytecodeStatebco_linker_env :: !LinkerEnvCurrent global mapping from Names to their true values
bco_linked_breaks :: !LinkedBreaksMapping from loaded modules to their breakpoint arrays
Only update the home package bytecode state.
Only update the external package bytecode state.
Find a name loaded from bytecode
Look up a break array in the bytecode loader state.
Look up an info table in the bytecode loader state.
Look up an address in the bytecode loader state.
Look up a cost centre stack in the bytecode loader state.
type BytecodeLoaderStateModifier = BytecodeLoaderState -> (BytecodeState -> BytecodeState) -> BytecodeLoaderStatetype BytecodeLoaderStateTraverser (m :: Type -> Type) = BytecodeLoaderState -> (BytecodeState -> m BytecodeState) -> m BytecodeLoaderStateEffectfully update the home package bytecode state.
Effectfully update the external package bytecode state.
Information about loaded bytecode
Constructors
LinkerEnvclosure_env :: !ClosureEnvCurrent global mapping from closure Names to their true values
itbl_env :: !ItblEnvThe current global mapping from RdrNames of DataCons to info table addresses. When a new LinkablePart is linked into the running image, or an existing module in the image is replaced, the itbl_env must be updated appropriately.
addr_env :: !AddrEnvLike closure_env and itbl_env, but for top-level
Addr#literals, see Note [Generating code for top-level string literal bindings] in GHC.StgToByteCode.
BreakArrays and CCSs are allocated per-module at link-time.
Specifically, a module's BreakArray is allocated either: - When a BCO for that module is linked - When :break is used on a given module *before* the BCO has been linked.
We keep this structure in the LoaderState
Constructors
LinkedBreaksbreakarray_env :: !ModuleEnv (ForeignRef BreakArray)Each Modules remote pointer of BreakArray.
ccs_env :: !ModuleEnv (Array BreakTickIndex (RemotePtr CostCentre))Each Modules array of remote pointers of CostCentre. Untouched when not profiling.
Union of LinkableSets.
In case of conflict, keep the most recent Linkable (as per linkableTime)
An entry to be inserted into a module's static pointer table. See Note [Grand plan for static forms] in GHC.Iface.Tidy.StaticPtrTable.
Constructors
Instances2Outputable, Binary
Outputable SptEntryDefined in ghc-10.0.0.20260917 · GHC.Types.SptEntryBinary SptEntryDefined in ghc-10.0.0.20260917 · GHC.Types.SptEntry
Instances1Outputable
Outputable LibrarySpecDefined in ghc-10.0.0.20260917 · GHC.Linker.Types
Constructors
LoadedPkgInfoloaded_pkg_uid :: !UnitIdloaded_pkg_hs_objs :: ![LibrarySpec]loaded_pkg_non_hs_objs :: ![LibrarySpec]loaded_pkg_hs_dlls :: ![RemotePtr LoadedDLL]See Note [Looking up symbols in the relevant objects]
loaded_pkg_trans_deps :: UniqDSet UnitId
Instances1Outputable
Outputable LoadedPkgInfoDefined in ghc-10.0.0.20260917 · GHC.Linker.Types
Linkable
27 declarationsInformation we can use to dynamically link modules into the compiler
Constructors
LinkablelinkableTime :: !UTCTimeTime at which this linkable was built (i.e. when the bytecodes were produced, or the mod date on the files)
linkableModule :: !ModuleThe linkable module itself
linkableParts :: partsFiles and chunks of code to link.
Instances4Functor, Foldable, Traversable, Outputable
Functor LinkableWithDefined in ghc-10.0.0.20260917 · GHC.Linker.TypesFoldable LinkableWithDefined in ghc-10.0.0.20260917 · GHC.Linker.TypesTraversable LinkableWithDefined in ghc-10.0.0.20260917 · GHC.Linker.TypesOutputable a => Outputable (LinkableWith a)Defined in ghc-10.0.0.20260917 · GHC.Linker.Types
Objects which have yet to be linked by the compiler
Constructors
DotO ObjFile LinkableObjectSortDotA FilePathStatic archive file (.a)
DotDLL FilePathDynamically linked library file (.so, .dll, .dylib)
DotGBC ModuleByteCodeA byte-code object, lives only in memory.
Instances1Outputable
Outputable LinkablePartDefined in ghc-10.0.0.20260917 · GHC.Linker.Types
Classify the provenance of .o products.
Constructors
ModuleObjectThe object is the final product for a module. When linking splices, its file extension will be adapted to the interpreter's way if needed.
ForeignObjectThe object was created from generated code for foreign stubs or foreign sources added by the user. Its file extension must be preserved, since there are no objects for alternative ways available.
Return true if the linkable only consists of native code (no BCO)
List the native objects (.o) of a linkable
List the native libraries (.so/.dll) of a linkable
List the paths of the native objects and libraries (.o.so.dll)
List the BCOs parts of a linkable.
This excludes the CoreBindings parts
Retrieve the compiled byte-code from the linkable part.
Contrary to linkableBCOs, this includes byte-code from LazyBCOs.
List the native linkable parts (.o.so.dll) of a linkable
Split linkable parts into (native code parts, BCOs parts)
Get the FilePath of linkable part (if applicable)
Is the part a native object or library? (.o.so.dll)
Is the part a native library? (.so/.dll)
Transform the LinkablePart list in this Linkable to contain only byte code If no LinkablePart remains, return Nothing.
Transform the LinkablePart list in this Linkable to contain only
object code files (.o, .a, .so) without BCOs.
If no LinkablePart remains, return Nothing.
Split the LinkablePart lists in each Linkable into only object code files (.o, .a, .so) and only byte code, and return two lists containing the nonempty Linkables for each.
Turn a Linkable into a LinkableUsage. This stores much less information than Linkable and allows us to free the fields of the Linkable.
Each LinkablePartUsage is fully evaluated to avoid retaining any reference to the original LinkablePart.
The in-memory representation of a bytecode object These are stored on-disk as .gbc files.
Constructors
ModuleByteCodegbc_module :: Modulegbc_compiled_byte_code :: CompiledByteCodegbc_foreign_files :: [FilePath]Path to object files
gbc_hash :: !Fingerprint
Instances1Outputable
Outputable ModuleByteCodeDefined in ghc-10.0.0.20260917 · GHC.Linker.Types