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

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 ...@@ -44,10 +44,12 @@ import FastString
import DynFlags import DynFlags
import Platform import Platform
import Config import Config
import Encoding
import OrdList import OrdList
import Pair import Pair
import Util import Util
import Data.IORef
import Data.Maybe import Data.Maybe
import Data.List import Data.List
\end{code} \end{code}
...@@ -211,11 +213,19 @@ dsFCall fn_id co fcall mDeclHeader = do ...@@ -211,11 +213,19 @@ dsFCall fn_id co fcall mDeclHeader = do
(fcall', cDoc) <- (fcall', cDoc) <-
case fcall of case fcall of
CCall (CCallSpec (StaticTarget cName mPackageId isFun) CApiConv safety) -> CCall (CCallSpec (StaticTarget cName mPackageId isFun) CApiConv safety) ->
do fcall_uniq <- newUnique do let wrapperRef = nextWrapperNum dflags
let wrapperName = mkFastString "ghc_wrapper_" `appendFS` wrapperNum <- liftIO $ readIORef wrapperRef
mkFastString (showPpr dflags fcall_uniq) `appendFS` liftIO $ writeIORef wrapperRef (wrapperNum + 1)
mkFastString "_" `appendFS` thisMod <- getModuleDs
cName 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) fcall' = CCall (CCallSpec (StaticTarget wrapperName mPackageId True) CApiConv safety)
c = includes c = includes
$$ fun_proto <+> braces (cRet <> semi) $$ fun_proto <+> braces (cRet <> semi)
......
...@@ -690,7 +690,9 @@ data DynFlags = DynFlags { ...@@ -690,7 +690,9 @@ data DynFlags = DynFlags {
interactivePrint :: Maybe String, interactivePrint :: Maybe String,
llvmVersion :: IORef (Int) llvmVersion :: IORef (Int),
nextWrapperNum :: IORef Int
} }
class HasDynFlags m where class HasDynFlags m where
...@@ -1111,12 +1113,14 @@ initDynFlags dflags = do ...@@ -1111,12 +1113,14 @@ initDynFlags dflags = do
refFilesToNotIntermediateClean <- newIORef [] refFilesToNotIntermediateClean <- newIORef []
refGeneratedDumps <- newIORef Set.empty refGeneratedDumps <- newIORef Set.empty
refLlvmVersion <- newIORef 28 refLlvmVersion <- newIORef 28
wrapperNum <- newIORef 0
return dflags{ return dflags{
filesToClean = refFilesToClean, filesToClean = refFilesToClean,
dirsToClean = refDirsToClean, dirsToClean = refDirsToClean,
filesToNotIntermediateClean = refFilesToNotIntermediateClean, filesToNotIntermediateClean = refFilesToNotIntermediateClean,
generatedDumps = refGeneratedDumps, generatedDumps = refGeneratedDumps,
llvmVersion = refLlvmVersion llvmVersion = refLlvmVersion,
nextWrapperNum = wrapperNum
} }
-- | The normal 'DynFlags'. Note that they is not suitable for use in this form -- | The normal 'DynFlags'. Note that they is not suitable for use in this form
...@@ -1239,7 +1243,8 @@ defaultDynFlags mySettings = ...@@ -1239,7 +1243,8 @@ defaultDynFlags mySettings =
traceLevel = 1, traceLevel = 1,
profAuto = NoProfAuto, profAuto = NoProfAuto,
llvmVersion = panic "defaultDynFlags: No llvmVersion", llvmVersion = panic "defaultDynFlags: No llvmVersion",
interactivePrint = Nothing interactivePrint = Nothing,
nextWrapperNum = panic "defaultDynFlags: No nextWrapperNum"
} }
defaultWays :: Settings -> [Way] 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