diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-06-22 18:08:54 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-10-09 08:40:33 -0400 |
commit | 386c2d7ff80843051ad15eab5de3766430ee98a5 (patch) | |
tree | 38e2943504dbf02f8551a870e1a8a965b8ae5632 | |
parent | e91ddddd714b22df2569681fb033fbb151ec7e6b (diff) | |
download | haskell-386c2d7ff80843051ad15eab5de3766430ee98a5.tar.gz |
Use UnitId in the backend instead of Unit
In Cmm we can only have real units identified with an UnitId. Other
units (on-the-fly instantiated units and holes) are only used in
type-checking backpack sessions that don't produce Cmm.
-rw-r--r-- | compiler/GHC/Cmm/CLabel.hs | 12 | ||||
-rw-r--r-- | compiler/GHC/StgToCmm/Foreign.hs | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/compiler/GHC/Cmm/CLabel.hs b/compiler/GHC/Cmm/CLabel.hs index fe133316d9..9a65369246 100644 --- a/compiler/GHC/Cmm/CLabel.hs +++ b/compiler/GHC/Cmm/CLabel.hs @@ -387,7 +387,7 @@ instance Ord CLabel where data ForeignLabelSource -- | Label is in a named package - = ForeignLabelInPackage Unit + = ForeignLabelInPackage UnitId -- | Label is in some external, system package that doesn't also -- contain compiled Haskell code, and is not associated with any .hi files. @@ -1087,15 +1087,15 @@ labelDynamic config this_mod lbl = case lbl of -- is the RTS in a DLL or not? RtsLabel _ -> - externalDynamicRefs && (this_pkg /= rtsUnit) + externalDynamicRefs && (this_unit /= rtsUnitId) IdLabel n _ _ -> externalDynamicRefs && isDynLinkName platform this_mod n -- When compiling in the "dyn" way, each package is to be linked into -- its own shared library. - CmmLabel pkg _ _ _ - | os == OSMinGW32 -> externalDynamicRefs && (toUnitId this_pkg /= pkg) + CmmLabel lbl_unit _ _ _ + | os == OSMinGW32 -> externalDynamicRefs && (this_unit /= lbl_unit) | otherwise -> externalDynamicRefs LocalBlockLabel _ -> False @@ -1114,7 +1114,7 @@ labelDynamic config this_mod lbl = -- When compiling in the "dyn" way, each package is to be -- linked into its own DLL. ForeignLabelInPackage pkgId -> - externalDynamicRefs && (this_pkg /= pkgId) + externalDynamicRefs && (this_unit /= pkgId) else -- On Mac OS X and on ELF platforms, false positives are OK, -- so we claim that all foreign imports come from dynamic @@ -1136,7 +1136,7 @@ labelDynamic config this_mod lbl = externalDynamicRefs = ncgExternalDynamicRefs config platform = ncgPlatform config os = platformOS platform - this_pkg = moduleUnit this_mod + this_unit = toUnitId (moduleUnit this_mod) ----------------------------------------------------------------------------- diff --git a/compiler/GHC/StgToCmm/Foreign.hs b/compiler/GHC/StgToCmm/Foreign.hs index 9c7866efae..9bae125ce5 100644 --- a/compiler/GHC/StgToCmm/Foreign.hs +++ b/compiler/GHC/StgToCmm/Foreign.hs @@ -47,6 +47,7 @@ import GHC.Data.Maybe import GHC.Utils.Panic import GHC.Types.Unique.Supply import GHC.Types.Basic +import GHC.Unit.Types import GHC.Core.TyCo.Rep import GHC.Builtin.Types.Prim @@ -91,7 +92,7 @@ cgForeignCall (CCall (CCallSpec target cconv safety)) typ stg_args res_ty -> let labelSource = case mPkgId of Nothing -> ForeignLabelInThisPackage - Just pkgId -> ForeignLabelInPackage pkgId + Just pkgId -> ForeignLabelInPackage (toUnitId pkgId) size = call_size cmm_args in ( unzip cmm_args , CmmLit (CmmLabel |