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 make Plugin/FrontendPlugin wired in - - - - - 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: ===================================== compiler/GHC/Builtin/KnownKeys.hs ===================================== @@ -248,10 +248,6 @@ knownKeyTable -- Unsafe coercion proofs , (mkVarOcc "unsafeCoerce#", unsafeCoercePrimIdKey) - -- Plugins - , (mkTcOcc "Plugin", pluginTyConKey) - , (mkTcOcc "FrontendPlugin", frontendPluginTyConKey) - -- Base strings Strings , (mkVarOcc "unpackCString#", unpackCStringIdKey) , (mkVarOcc "unpackCStringUtf8#", unpackCStringUtf8IdKey) ===================================== compiler/GHC/Builtin/WiredIn/Types.hs ===================================== @@ -165,7 +165,10 @@ module GHC.Builtin.WiredIn.Types ( naturalNSDataCon, naturalNSDataConName, naturalNBDataCon, naturalNBDataConName, - pretendNameIsInScope, + -- * GHC + pluginTyConName, frontendPluginTyConName, + + pretendNameIsInScope, ) where import GHC.Prelude @@ -229,6 +232,7 @@ import Numeric ( showInt ) import Data.Word (Word8) import Control.Applicative ((<|>)) +import GHC.Types.SrcLoc (noSrcSpan) alpha_tyvar :: [TyVar] alpha_tyvar = [alphaTyVar] @@ -2886,6 +2890,18 @@ naturalNSDataCon = pcDataCon naturalNSDataConName [] [wordPrimTy] naturalTyCon naturalNBDataCon :: DataCon naturalNBDataCon = pcDataCon naturalNBDataConName [] [byteArrayPrimTy] naturalTyCon +--------------------------------------- +-- ghc +--------------------------------------- + +pLUGINS :: Module +pLUGINS = mkThisGhcModule (fsLit "GHC.Driver.Plugins") + +pluginTyConName :: Name +pluginTyConName = mkKnownKeyName pluginTyConKey pLUGINS (mkOccName tcName "Plugin") noSrcSpan + +frontendPluginTyConName :: Name +frontendPluginTyConName = mkKnownKeyName frontendPluginTyConKey pLUGINS (mkOccName tcName "FrontendPlugin") noSrcSpan {- ************************************************************************ ===================================== compiler/GHC/Driver/Plugins.hs ===================================== @@ -5,13 +5,6 @@ {-# LANGUAGE UnboxedTuples #-} #endif -#if __GLASGOW_HASKELL__ > 1000 -{-# OPTIONS_GHC -fdefines-known-key-names #-} - -- 'Plugin' and 'FrontendPlugin' are known-key names - -- (they have a fixed known unique) (from GHC 10.2) - -- See Note [Overview of known entities] in GHC.Builtin -#endif - -- | Definitions for writing /plugins/ for GHC. Plugins can hook into -- several areas of the compiler. See the 'Plugin' type. These plugins -- include type-checker plugins, source plugins, and core-to-core plugins. ===================================== compiler/GHC/Runtime/Loader.hs ===================================== @@ -37,7 +37,6 @@ import GHC.Rename.Names ( gresFromAvails ) import GHC.Tc.Utils.Monad ( initTcInteractive, initIfaceTcRn ) import GHC.Iface.Load ( loadPluginInterface, cannotFindModule ) -import GHC.Builtin.KnownKeys ( pluginTyConKey, frontendPluginTyConKey ) import GHC.Driver.Env import GHCi.RemoteTypes ( HValue ) @@ -47,7 +46,7 @@ import GHC.Core.TyCon ( TyCon(tyConName) ) import GHC.Types.SrcLoc ( noSrcSpan ) -import GHC.Types.Name ( Name, nameModule, nameModule_maybe, KnownKey, mkKnownKeyName, mkTcOcc ) +import GHC.Types.Name ( Name, nameModule, nameModule_maybe ) import GHC.Types.Id ( idType ) import GHC.Types.PkgQual import GHC.Types.TyThing @@ -75,7 +74,7 @@ import GHC.Linker.Types import Data.List (unzip4) import GHC.Iface.Errors.Ppr import GHC.Driver.Monad -import GHC.Builtin.Modules +import GHC.Builtin.WiredIn.Types (pluginTyConName, frontendPluginTyConName) {- Note [Timing of plugin initialization] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -171,13 +170,11 @@ loadPlugins hsc_env where options = [ option | (opt_mod_nm, option) <- pluginModNameOpts dflags , opt_mod_nm == mod_nm ] - pluginTyConName = mkKnownKeyGhcPluginsName (mkTcOcc "Plugin") pluginTyConKey loadPlugin = loadPlugin' (mkVarOccFS (fsLit "plugin")) pluginTyConName hsc_env loadFrontendPlugin :: HscEnv -> ModuleName -> IO (FrontendPlugin, [LinkableUsage], PkgsLoaded) loadFrontendPlugin hsc_env mod_name = do checkExternalInterpreter hsc_env - let frontendPluginTyConName = mkKnownKeyGhcPluginsName (mkTcOcc "FrontendPlugin") frontendPluginTyConKey (plugin, _iface, links, pkgs) <- loadPlugin' (mkVarOccFS (fsLit "frontendPlugin")) frontendPluginTyConName hsc_env mod_name @@ -190,10 +187,6 @@ checkExternalInterpreter hsc_env = case interpInstance <$> hsc_interp hsc_env of -> throwIO (InstallationError "Plugins require -fno-external-interpreter") _ -> pure () -mkKnownKeyGhcPluginsName :: OccName -> KnownKey -> Name -mkKnownKeyGhcPluginsName occ kk = - mkKnownKeyName kk (mkThisGhcModule (fsLit "GHC.Driver.Plugins")) occ noSrcSpan - loadPlugin' :: OccName -> Name -> HscEnv -> ModuleName -> IO (a, ModIface, [LinkableUsage], PkgsLoaded) loadPlugin' occ_name plugin_name hsc_env mod_name = do { let plugin_rdr_name = mkRdrQual mod_name occ_name View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/45b96f372b91e45ed64037493dcd9f39... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/45b96f372b91e45ed64037493dcd9f39... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Rodrigo Mesquita (@alt-romes)