[Git][ghc/ghc][master] Use UnitId in the backend instead of Unit
Marge Bot
gitlab at gitlab.haskell.org
Fri Oct 9 12:40:39 UTC 2020
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
386c2d7f by Sylvain Henry at 2020-10-09T08:40:33-04:00
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.
- - - - -
2 changed files:
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/StgToCmm/Foreign.hs
Changes:
=====================================
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)
-----------------------------------------------------------------------------
=====================================
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
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/386c2d7ff80843051ad15eab5de3766430ee98a5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/386c2d7ff80843051ad15eab5de3766430ee98a5
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/20201009/f7c7ec8f/attachment-0001.html>
More information about the ghc-commits
mailing list