summaryrefslogtreecommitdiff
path: root/compiler/cmm/CLabel.hs
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-12-16 11:59:49 -0500
committerBen Gamari <ben@smart-cactus.org>2016-12-16 11:59:51 -0500
commit5bf344b7f4e1538fbc019896ae07ae3ec2a18207 (patch)
tree903812e301a1fafe8d3f75b8b6a5943f1019c48a /compiler/cmm/CLabel.hs
parentc889df86d7bc9eb4cd53e38c81feecaf5f932678 (diff)
downloadhaskell-5bf344b7f4e1538fbc019896ae07ae3ec2a18207.tar.gz
CLabel: Kill redundant UnitId argument from labelDynamic
It already has access to the current package's UnitId via the Module. Edward Yang pointed out that there is one wrinkle, however: the following invariant isn't true at all stages of compilation, if I am compiling the module (this_mod :: Module), then thisPackage dflags == moduleUnitId this_mod. Specifically, this is only true after desugaring; it may be broken when typechecking an indefinite signature. However, it's safe to assume this in the native codegen. I've updated Note to state this invariant more directly. Test Plan: Validate Reviewers: austin, ezyang, simonmar Reviewed By: ezyang, simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2863
Diffstat (limited to 'compiler/cmm/CLabel.hs')
-rw-r--r--compiler/cmm/CLabel.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index 811d8e908b..0f3410a66e 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -946,8 +946,8 @@ idInfoLabelType info =
-- @labelDynamic@ returns @True@ if the label is located
-- in a DLL, be it a data reference or not.
-labelDynamic :: DynFlags -> UnitId -> Module -> CLabel -> Bool
-labelDynamic dflags this_pkg this_mod lbl =
+labelDynamic :: DynFlags -> Module -> CLabel -> Bool
+labelDynamic dflags this_mod lbl =
case lbl of
-- is the RTS in a DLL or not?
RtsLabel _ -> (WayDyn `elem` ways dflags) && (this_pkg /= rtsUnitId)
@@ -989,7 +989,9 @@ labelDynamic dflags this_pkg this_mod lbl =
-- Note that DynamicLinkerLabels do NOT require dynamic linking themselves.
_ -> False
- where os = platformOS (targetPlatform dflags)
+ where
+ os = platformOS (targetPlatform dflags)
+ this_pkg = moduleUnitId this_mod
-----------------------------------------------------------------------------