[commit: ghc] wip/T14626: WIP: only alias exported symbols when defined in the same module (03e0cc8)

git at git.haskell.org git at git.haskell.org
Thu Feb 8 14:56:46 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/T14626
Link       : http://ghc.haskell.org/trac/ghc/changeset/03e0cc8284b4d9287efa3888fe6b9c0023c3526c/ghc

>---------------------------------------------------------------

commit 03e0cc8284b4d9287efa3888fe6b9c0023c3526c
Author: Gabor Greif <ggreif at gmail.com>
Date:   Thu Feb 8 11:32:43 2018 +0100

    WIP: only alias exported symbols when defined in the same module


>---------------------------------------------------------------

03e0cc8284b4d9287efa3888fe6b9c0023c3526c
 compiler/nativeGen/X86/Ppr.hs | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs
index 95c4728..0089a9b 100644
--- a/compiler/nativeGen/X86/Ppr.hs
+++ b/compiler/nativeGen/X86/Ppr.hs
@@ -45,6 +45,7 @@ import Unique           ( pprUniqueAlways )
 import Platform
 import FastString
 import Outputable
+import Name             ( nameModule_maybe, isExternalName, isInternalName )
 
 import Data.Word
 
@@ -143,6 +144,25 @@ pprBasicBlock info_env (BasicBlock blockid instrs)
       (l at LOCATION{} : _) -> pprInstr l
       _other             -> empty
 
+
+aliasToLocalOrIntoThisModule :: CLabel -> CLabel -> Bool
+aliasToLocalOrIntoThisModule alias lab
+ | Just nam <- hasHaskellName lab
+ , isStaticClosureLabel lab
+ , isExternalName nam
+ , Just mod <- nameModule_maybe nam
+ , Just anam <- hasHaskellName alias
+ , Just thismod <- nameModule_maybe anam
+ = thismod == mod
+
+aliasToLocalOrIntoThisModule _ lab
+ | Just nam <- hasHaskellName lab
+ , isInternalName nam
+ = True
+
+aliasToLocalOrIntoThisModule _ _ = True
+
+
 pprDatas :: (Alignment, CmmStatics) -> SDoc
 
 pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, _, _])
@@ -151,7 +171,10 @@ pprDatas (_, Statics alias [CmmStaticLit lit@(CmmLabel lbl), CmmStaticLit ind, _
         labelInd (CmmLabel l) = Just l
         labelInd _ = Nothing
   , Just ind' <- labelInd ind
-  , let equate = pprGloblDecl alias $$ text ".equiv" <+> ppr alias <> comma <> ppr (CmmLabel ind')
+  , aliasToLocalOrIntoThisModule alias ind'
+  , let equate = pprGloblDecl alias
+                 $$ pprTypeAndSizeDecl alias -- NOT NEEDED!
+                 $$ text ".equiv" <+> ppr alias <> comma <> ppr (CmmLabel ind')
   = pprTrace "IndStaticInfo: pprDatas" (ppr alias <+> ppr lit <+> ppr ind') equate
 
 pprDatas (align, (Statics lbl dats))



More information about the ghc-commits mailing list