[Git][ghc/ghc][wip/coreField] Add the extensible data to the interface after running the last phase

Josh Meredith gitlab at gitlab.haskell.org
Wed Jun 17 16:28:52 UTC 2020



Josh Meredith pushed to branch wip/coreField at Glasgow Haskell Compiler / GHC


Commits:
42245318 by Josh Meredith at 2020-06-18T02:25:59+10:00
Add the extensible data to the interface after running the last phase

- - - - -


2 changed files:

- compiler/GHC/Iface/Make.hs
- compiler/GHC/IfaceToCore.hs


Changes:

=====================================
compiler/GHC/Iface/Make.hs
=====================================
@@ -61,7 +61,6 @@ import Util             hiding ( eqListBy )
 import FastString
 import Maybes
 import GHC.HsToCore.Docs
-import GHC.Iface.Binary
 
 import Data.Function
 import Data.List ( findIndex, mapAccumL, sortBy )
@@ -69,7 +68,6 @@ import Data.Ord
 import Data.IORef
 import GHC.Driver.Plugins
 
-import Control.Monad
 
 {-
 ************************************************************************
@@ -99,7 +97,9 @@ mkPartialIface hsc_env mod_details
               , mg_decl_docs    = decl_docs
               , mg_arg_docs     = arg_docs
               }
-  = withPlugins dflags (\p opts -> interfaceWriteAction p opts hsc_env mod_details guts) iface
+  = do iface' <- withPlugins dflags (\p opts -> interfaceWriteAction p opts hsc_env mod_details guts) iface
+       ext_fs <- readIORef $ hsc_extensible_fields hsc_env
+       return $ iface'{mi_ext_fields = ext_fs}
   -- | gopt Opt_WriteCoreField dflags = do
   --   fields <- writeFieldWith "ghc/core" write (mi_ext_fields iface)
   --   forM_ (mg_binds guts) go
@@ -787,6 +787,9 @@ toIfaceModGuts (ModGuts f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f
     f28
     f29
 
+isRealBinding :: Bind Id -> Bool
 isRealBinding (NonRec n _) = isExternalName (idName n)
+isRealBinding _ = True
 
+toIfaceBind' :: Bind Id -> (Bool, IfaceBinding)
 toIfaceBind' b = (isRealBinding b, toIfaceBind b)


=====================================
compiler/GHC/IfaceToCore.hs
=====================================
@@ -83,8 +83,6 @@ import qualified BooleanFormula as BF
 import Control.Monad
 import qualified Data.Map as Map
 
-import Data.IORef
-import GHC.Types.Name.Cache
 {-
 This module takes
 
@@ -1862,7 +1860,7 @@ tcIfaceBinding mod loc ibind = do
 
 tcIfaceBinding' :: Module -> SrcSpan -> (Bool, IfaceBinding) -> IfL (Bind Id)
 tcIfaceBinding' _   _    (_p, (IfaceRec _)) = panic "tcIfaceBinding: expected NonRec at top level"
-tcIfaceBinding' mod loc b@(p, IfaceNonRec (IfLetBndr fs ty info ji) rhs) = do
+tcIfaceBinding' _mod _loc _b@(_p, IfaceNonRec (IfLetBndr fs ty _info ji) rhs) = do
   name <- lookupIfaceTop (mkVarOccFS fs)
 
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/422453180c06d5dfbe8010f5c5a9749bfc6e4513

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/422453180c06d5dfbe8010f5c5a9749bfc6e4513
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/20200617/47614618/attachment-0001.html>


More information about the ghc-commits mailing list