summaryrefslogtreecommitdiff
path: root/compiler/deSugar
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-11-02 03:45:15 +0000
committerIan Lynagh <ian@well-typed.com>2012-11-02 15:26:06 +0000
commit095b9bf4ed418c43216cfca2ae271c143e555f1d (patch)
treee9a928fe2941f5a01759cc093ea91276961dcf13 /compiler/deSugar
parentd163845c7cade0892db4325e430a84a350ff147c (diff)
downloadhaskell-095b9bf4ed418c43216cfca2ae271c143e555f1d.tar.gz
Don't put uniqs in ghc wrapper function names; part of #4012
The wrapper functions can end up in interface files, and thus are part of the ABI hash. But uniqs easily change for no good reason when recompiling, which can lead to an ABI hash needlessly changing.
Diffstat (limited to 'compiler/deSugar')
-rw-r--r--compiler/deSugar/DsForeign.lhs20
1 files changed, 15 insertions, 5 deletions
diff --git a/compiler/deSugar/DsForeign.lhs b/compiler/deSugar/DsForeign.lhs
index 0cf4b97159..42aa740414 100644
--- a/compiler/deSugar/DsForeign.lhs
+++ b/compiler/deSugar/DsForeign.lhs
@@ -44,10 +44,12 @@ import FastString
import DynFlags
import Platform
import Config
+import Encoding
import OrdList
import Pair
import Util
+import Data.IORef
import Data.Maybe
import Data.List
\end{code}
@@ -211,11 +213,19 @@ dsFCall fn_id co fcall mDeclHeader = do
(fcall', cDoc) <-
case fcall of
CCall (CCallSpec (StaticTarget cName mPackageId isFun) CApiConv safety) ->
- do fcall_uniq <- newUnique
- let wrapperName = mkFastString "ghc_wrapper_" `appendFS`
- mkFastString (showPpr dflags fcall_uniq) `appendFS`
- mkFastString "_" `appendFS`
- cName
+ do let wrapperRef = nextWrapperNum dflags
+ wrapperNum <- liftIO $ readIORef wrapperRef
+ liftIO $ writeIORef wrapperRef (wrapperNum + 1)
+ thisMod <- getModuleDs
+ let pkg = packageIdString (modulePackageId thisMod)
+ mod = moduleNameString (moduleName thisMod)
+ wrapperNameComponents = ["ghc_wrapper",
+ show wrapperNum,
+ pkg, mod,
+ unpackFS cName]
+ wrapperName = mkFastString
+ $ zEncodeString
+ $ intercalate ":" wrapperNameComponents
fcall' = CCall (CCallSpec (StaticTarget wrapperName mPackageId True) CApiConv safety)
c = includes
$$ fun_proto <+> braces (cRet <> semi)