Rodrigo Mesquita pushed to branch wip/spj-reinstallable-base2 at Glasgow Haskell Compiler / GHC
Commits:
-
45b96f37
by Rodrigo Mesquita at 2026-05-19T15:57:31+01:00
4 changed files:
- compiler/GHC/Builtin/KnownKeys.hs
- compiler/GHC/Builtin/WiredIn/Types.hs
- compiler/GHC/Driver/Plugins.hs
- compiler/GHC/Runtime/Loader.hs
Changes:
| ... | ... | @@ -248,10 +248,6 @@ knownKeyTable |
| 248 | 248 | -- Unsafe coercion proofs
|
| 249 | 249 | , (mkVarOcc "unsafeCoerce#", unsafeCoercePrimIdKey)
|
| 250 | 250 | |
| 251 | - -- Plugins
|
|
| 252 | - , (mkTcOcc "Plugin", pluginTyConKey)
|
|
| 253 | - , (mkTcOcc "FrontendPlugin", frontendPluginTyConKey)
|
|
| 254 | - |
|
| 255 | 251 | -- Base strings Strings
|
| 256 | 252 | , (mkVarOcc "unpackCString#", unpackCStringIdKey)
|
| 257 | 253 | , (mkVarOcc "unpackCStringUtf8#", unpackCStringUtf8IdKey)
|
| ... | ... | @@ -165,7 +165,10 @@ module GHC.Builtin.WiredIn.Types ( |
| 165 | 165 | naturalNSDataCon, naturalNSDataConName,
|
| 166 | 166 | naturalNBDataCon, naturalNBDataConName,
|
| 167 | 167 | |
| 168 | - pretendNameIsInScope,
|
|
| 168 | + -- * GHC
|
|
| 169 | + pluginTyConName, frontendPluginTyConName,
|
|
| 170 | + |
|
| 171 | + pretendNameIsInScope,
|
|
| 169 | 172 | ) where
|
| 170 | 173 | |
| 171 | 174 | import GHC.Prelude
|
| ... | ... | @@ -229,6 +232,7 @@ import Numeric ( showInt ) |
| 229 | 232 | |
| 230 | 233 | import Data.Word (Word8)
|
| 231 | 234 | import Control.Applicative ((<|>))
|
| 235 | +import GHC.Types.SrcLoc (noSrcSpan)
|
|
| 232 | 236 | |
| 233 | 237 | alpha_tyvar :: [TyVar]
|
| 234 | 238 | alpha_tyvar = [alphaTyVar]
|
| ... | ... | @@ -2886,6 +2890,18 @@ naturalNSDataCon = pcDataCon naturalNSDataConName [] [wordPrimTy] naturalTyCon |
| 2886 | 2890 | naturalNBDataCon :: DataCon
|
| 2887 | 2891 | naturalNBDataCon = pcDataCon naturalNBDataConName [] [byteArrayPrimTy] naturalTyCon
|
| 2888 | 2892 | |
| 2893 | +---------------------------------------
|
|
| 2894 | +-- ghc
|
|
| 2895 | +---------------------------------------
|
|
| 2896 | + |
|
| 2897 | +pLUGINS :: Module
|
|
| 2898 | +pLUGINS = mkThisGhcModule (fsLit "GHC.Driver.Plugins")
|
|
| 2899 | + |
|
| 2900 | +pluginTyConName :: Name
|
|
| 2901 | +pluginTyConName = mkKnownKeyName pluginTyConKey pLUGINS (mkOccName tcName "Plugin") noSrcSpan
|
|
| 2902 | + |
|
| 2903 | +frontendPluginTyConName :: Name
|
|
| 2904 | +frontendPluginTyConName = mkKnownKeyName frontendPluginTyConKey pLUGINS (mkOccName tcName "FrontendPlugin") noSrcSpan
|
|
| 2889 | 2905 | |
| 2890 | 2906 | {-
|
| 2891 | 2907 | ************************************************************************
|
| ... | ... | @@ -5,13 +5,6 @@ |
| 5 | 5 | {-# LANGUAGE UnboxedTuples #-}
|
| 6 | 6 | #endif
|
| 7 | 7 | |
| 8 | -#if __GLASGOW_HASKELL__ > 1000
|
|
| 9 | -{-# OPTIONS_GHC -fdefines-known-key-names #-}
|
|
| 10 | - -- 'Plugin' and 'FrontendPlugin' are known-key names
|
|
| 11 | - -- (they have a fixed known unique) (from GHC 10.2)
|
|
| 12 | - -- See Note [Overview of known entities] in GHC.Builtin
|
|
| 13 | -#endif
|
|
| 14 | - |
|
| 15 | 8 | -- | Definitions for writing /plugins/ for GHC. Plugins can hook into
|
| 16 | 9 | -- several areas of the compiler. See the 'Plugin' type. These plugins
|
| 17 | 10 | -- include type-checker plugins, source plugins, and core-to-core plugins.
|
| ... | ... | @@ -37,7 +37,6 @@ import GHC.Rename.Names ( gresFromAvails ) |
| 37 | 37 | |
| 38 | 38 | import GHC.Tc.Utils.Monad ( initTcInteractive, initIfaceTcRn )
|
| 39 | 39 | import GHC.Iface.Load ( loadPluginInterface, cannotFindModule )
|
| 40 | -import GHC.Builtin.KnownKeys ( pluginTyConKey, frontendPluginTyConKey )
|
|
| 41 | 40 | |
| 42 | 41 | import GHC.Driver.Env
|
| 43 | 42 | import GHCi.RemoteTypes ( HValue )
|
| ... | ... | @@ -47,7 +46,7 @@ import GHC.Core.TyCon ( TyCon(tyConName) ) |
| 47 | 46 | |
| 48 | 47 | |
| 49 | 48 | import GHC.Types.SrcLoc ( noSrcSpan )
|
| 50 | -import GHC.Types.Name ( Name, nameModule, nameModule_maybe, KnownKey, mkKnownKeyName, mkTcOcc )
|
|
| 49 | +import GHC.Types.Name ( Name, nameModule, nameModule_maybe )
|
|
| 51 | 50 | import GHC.Types.Id ( idType )
|
| 52 | 51 | import GHC.Types.PkgQual
|
| 53 | 52 | import GHC.Types.TyThing
|
| ... | ... | @@ -75,7 +74,7 @@ import GHC.Linker.Types |
| 75 | 74 | import Data.List (unzip4)
|
| 76 | 75 | import GHC.Iface.Errors.Ppr
|
| 77 | 76 | import GHC.Driver.Monad
|
| 78 | -import GHC.Builtin.Modules
|
|
| 77 | +import GHC.Builtin.WiredIn.Types (pluginTyConName, frontendPluginTyConName)
|
|
| 79 | 78 | |
| 80 | 79 | {- Note [Timing of plugin initialization]
|
| 81 | 80 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ... | ... | @@ -171,13 +170,11 @@ loadPlugins hsc_env |
| 171 | 170 | where
|
| 172 | 171 | options = [ option | (opt_mod_nm, option) <- pluginModNameOpts dflags
|
| 173 | 172 | , opt_mod_nm == mod_nm ]
|
| 174 | - pluginTyConName = mkKnownKeyGhcPluginsName (mkTcOcc "Plugin") pluginTyConKey
|
|
| 175 | 173 | loadPlugin = loadPlugin' (mkVarOccFS (fsLit "plugin")) pluginTyConName hsc_env
|
| 176 | 174 | |
| 177 | 175 | loadFrontendPlugin :: HscEnv -> ModuleName -> IO (FrontendPlugin, [LinkableUsage], PkgsLoaded)
|
| 178 | 176 | loadFrontendPlugin hsc_env mod_name = do
|
| 179 | 177 | checkExternalInterpreter hsc_env
|
| 180 | - let frontendPluginTyConName = mkKnownKeyGhcPluginsName (mkTcOcc "FrontendPlugin") frontendPluginTyConKey
|
|
| 181 | 178 | (plugin, _iface, links, pkgs)
|
| 182 | 179 | <- loadPlugin' (mkVarOccFS (fsLit "frontendPlugin")) frontendPluginTyConName
|
| 183 | 180 | hsc_env mod_name
|
| ... | ... | @@ -190,10 +187,6 @@ checkExternalInterpreter hsc_env = case interpInstance <$> hsc_interp hsc_env of |
| 190 | 187 | -> throwIO (InstallationError "Plugins require -fno-external-interpreter")
|
| 191 | 188 | _ -> pure ()
|
| 192 | 189 | |
| 193 | -mkKnownKeyGhcPluginsName :: OccName -> KnownKey -> Name
|
|
| 194 | -mkKnownKeyGhcPluginsName occ kk =
|
|
| 195 | - mkKnownKeyName kk (mkThisGhcModule (fsLit "GHC.Driver.Plugins")) occ noSrcSpan
|
|
| 196 | - |
|
| 197 | 190 | loadPlugin' :: OccName -> Name -> HscEnv -> ModuleName -> IO (a, ModIface, [LinkableUsage], PkgsLoaded)
|
| 198 | 191 | loadPlugin' occ_name plugin_name hsc_env mod_name
|
| 199 | 192 | = do { let plugin_rdr_name = mkRdrQual mod_name occ_name
|