Commit 095b9bf4 authored by ian@well-typed.com's avatar ian@well-typed.com

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.
parent d163845c
......@@ -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)
......
......@@ -690,7 +690,9 @@ data DynFlags = DynFlags {
interactivePrint :: Maybe String,
llvmVersion :: IORef (Int)
llvmVersion :: IORef (Int),
nextWrapperNum :: IORef Int
}
class HasDynFlags m where
......@@ -1111,12 +1113,14 @@ initDynFlags dflags = do
refFilesToNotIntermediateClean <- newIORef []
refGeneratedDumps <- newIORef Set.empty
refLlvmVersion <- newIORef 28
wrapperNum <- newIORef 0
return dflags{
filesToClean = refFilesToClean,
dirsToClean = refDirsToClean,
filesToNotIntermediateClean = refFilesToNotIntermediateClean,
generatedDumps = refGeneratedDumps,
llvmVersion = refLlvmVersion
llvmVersion = refLlvmVersion,
nextWrapperNum = wrapperNum
}
-- | The normal 'DynFlags'. Note that they is not suitable for use in this form
......@@ -1239,7 +1243,8 @@ defaultDynFlags mySettings =
traceLevel = 1,
profAuto = NoProfAuto,
llvmVersion = panic "defaultDynFlags: No llvmVersion",
interactivePrint = Nothing
interactivePrint = Nothing,
nextWrapperNum = panic "defaultDynFlags: No nextWrapperNum"
}
defaultWays :: Settings -> [Way]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment