diff options
author | Simon Marlow <marlowsd@gmail.com> | 2009-08-02 21:32:04 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2009-08-02 21:32:04 +0000 |
commit | a2a67cd520b9841114d69a87a423dabcb3b4368e (patch) | |
tree | 3dc6bbf53dff5421c14fbeb2d812c1424f2718c0 /compiler | |
parent | 5d379cbe65e406d5c3a848fe7fcd090cafbfeb78 (diff) | |
download | haskell-a2a67cd520b9841114d69a87a423dabcb3b4368e.tar.gz |
RTS tidyup sweep, first phase
The first phase of this tidyup is focussed on the header files, and in
particular making sure we are exposinng publicly exactly what we need
to, and no more.
- Rts.h now includes everything that the RTS exposes publicly,
rather than a random subset of it.
- Most of the public header files have moved into subdirectories, and
many of them have been renamed. But clients should not need to
include any of the other headers directly, just #include the main
public headers: Rts.h, HsFFI.h, RtsAPI.h.
- All the headers needed for via-C compilation have moved into the
stg subdirectory, which is self-contained. Most of the headers for
the rest of the RTS APIs have moved into the rts subdirectory.
- I left MachDeps.h where it is, because it is so widely used in
Haskell code.
- I left a deprecated stub for RtsFlags.h in place. The flag
structures are now exposed by Rts.h.
- Various internal APIs are no longer exposed by public header files.
- Various bits of dead code and declarations have been removed
- More gcc warnings are turned on, and the RTS code is more
warning-clean.
- More source files #include "PosixSource.h", and hence only use
standard POSIX (1003.1c-1995) interfaces.
There is a lot more tidying up still to do, this is just the first
pass. I also intend to standardise the names for external RTS APIs
(e.g use the rts_ prefix consistently), and declare the internal APIs
as hidden for shared libraries.
Diffstat (limited to 'compiler')
29 files changed, 43 insertions, 39 deletions
diff --git a/compiler/cmm/CmmInfo.hs b/compiler/cmm/CmmInfo.hs index 734896adc8..c608372c64 100644 --- a/compiler/cmm/CmmInfo.hs +++ b/compiler/cmm/CmmInfo.hs @@ -58,7 +58,7 @@ cmmToRawCmm cmm = do -- <normal forward rest of StgInfoTable> -- <forward variable part> -- --- See includes/InfoTables.h +-- See includes/rts/storage/InfoTables.h -- -- For return-points these are as follows -- diff --git a/compiler/cmm/PprCmm.hs b/compiler/cmm/PprCmm.hs index 504098891a..9f622c0a64 100644 --- a/compiler/cmm/PprCmm.hs +++ b/compiler/cmm/PprCmm.hs @@ -56,7 +56,7 @@ import Data.Maybe -- Temp Jan08 import SMRep import ClosureInfo -#include "../includes/StgFun.h" +#include "../includes/rts/storage/FunTypes.h" pprCmms :: (Outputable info, Outputable g) => [GenCmm CmmStatic info g] -> SDoc diff --git a/compiler/codeGen/CgCallConv.hs b/compiler/codeGen/CgCallConv.hs index 5fa0a85dcf..351375d1e4 100644 --- a/compiler/codeGen/CgCallConv.hs +++ b/compiler/codeGen/CgCallConv.hs @@ -64,7 +64,7 @@ import Data.Bits ------------------------------------------------------------------------- -- bring in ARG_P, ARG_N, etc. -#include "../includes/StgFun.h" +#include "../includes/rts/storage/FunTypes.h" ------------------------- argDescrType :: ArgDescr -> StgHalfWord diff --git a/compiler/codeGen/CgProf.hs b/compiler/codeGen/CgProf.hs index 7750c0f08e..a3aa59b572 100644 --- a/compiler/codeGen/CgProf.hs +++ b/compiler/codeGen/CgProf.hs @@ -24,9 +24,9 @@ module CgProf ( ) where #include "HsVersions.h" -#include "MachDeps.h" +#include "../includes/MachDeps.h" -- For WORD_SIZE_IN_BITS only. -#include "../includes/Constants.h" +#include "../includes/rts/Constants.h" -- For LDV_CREATE_MASK, LDV_STATE_USE -- which are StgWords #include "../includes/DerivedConstants.h" diff --git a/compiler/codeGen/CgUtils.hs b/compiler/codeGen/CgUtils.hs index fad85f7e16..d1d81e5de4 100644 --- a/compiler/codeGen/CgUtils.hs +++ b/compiler/codeGen/CgUtils.hs @@ -50,7 +50,7 @@ module CgUtils ( ) where #include "HsVersions.h" -#include "../includes/MachRegs.h" +#include "../includes/stg/MachRegs.h" import BlockId import CgMonad diff --git a/compiler/codeGen/SMRep.lhs b/compiler/codeGen/SMRep.lhs index 32d9583800..1667af8637 100644 --- a/compiler/codeGen/SMRep.lhs +++ b/compiler/codeGen/SMRep.lhs @@ -246,7 +246,7 @@ data SMRep | BlackHoleRep data ClosureType -- Corresponds 1-1 with the varieties of closures - -- implemented by the RTS. Compare with ghc/includes/ClosureTypes.h + -- implemented by the RTS. Compare with includes/rts/storage/ClosureTypes.h = Constr | ConstrNoCaf | Fun @@ -284,7 +284,7 @@ isStaticRep BlackHoleRep = False \end{code} \begin{code} -#include "../includes/ClosureTypes.h" +#include "../includes/rts/storage/ClosureTypes.h" -- Defines CONSTR, CONSTR_1_0 etc -- krc: only called by tickyDynAlloc in CgTicky; return diff --git a/compiler/codeGen/StgCmmLayout.hs b/compiler/codeGen/StgCmmLayout.hs index 84d4ef0362..11a3257732 100644 --- a/compiler/codeGen/StgCmmLayout.hs +++ b/compiler/codeGen/StgCmmLayout.hs @@ -313,7 +313,7 @@ mkVirtHeapOffsets is_thunk things ------------------------------------------------------------------------- -- bring in ARG_P, ARG_N, etc. -#include "../includes/StgFun.h" +#include "../includes/rts/storage/FunTypes.h" ------------------------- -- argDescrType :: ArgDescr -> StgHalfWord diff --git a/compiler/codeGen/StgCmmProf.hs b/compiler/codeGen/StgCmmProf.hs index 6fb20f8f46..850356149c 100644 --- a/compiler/codeGen/StgCmmProf.hs +++ b/compiler/codeGen/StgCmmProf.hs @@ -25,9 +25,9 @@ module StgCmmProf ( ) where #include "HsVersions.h" -#include "MachDeps.h" +#include "../includes/MachDeps.h" -- For WORD_SIZE_IN_BITS only. -#include "../includes/Constants.h" +#include "../includes/rts/Constants.h" -- For LDV_CREATE_MASK, LDV_STATE_USE -- which are StgWords #include "../includes/DerivedConstants.h" diff --git a/compiler/codeGen/StgCmmUtils.hs b/compiler/codeGen/StgCmmUtils.hs index 357ca2c5b6..d2d7bb1e41 100644 --- a/compiler/codeGen/StgCmmUtils.hs +++ b/compiler/codeGen/StgCmmUtils.hs @@ -44,7 +44,7 @@ module StgCmmUtils ( ) where #include "HsVersions.h" -#include "MachRegs.h" +#include "../includes/stg/MachRegs.h" import StgCmmMonad import StgCmmClosure diff --git a/compiler/ghci/ByteCodeAsm.lhs b/compiler/ghci/ByteCodeAsm.lhs index e842bf75cf..030ef896e6 100644 --- a/compiler/ghci/ByteCodeAsm.lhs +++ b/compiler/ghci/ByteCodeAsm.lhs @@ -208,7 +208,7 @@ sizeSS16 :: SizedSeq a -> Word16 sizeSS16 (SizedSeq n _) = fromIntegral n -- Bring in all the bci_ bytecode constants. -#include "Bytecodes.h" +#include "rts/Bytecodes.h" largeArgInstr :: Word16 -> Word16 largeArgInstr bci = bci_FLAG_LARGE_ARGS .|. bci diff --git a/compiler/ghci/ByteCodeItbls.lhs b/compiler/ghci/ByteCodeItbls.lhs index 61644b2a81..696ed0f564 100644 --- a/compiler/ghci/ByteCodeItbls.lhs +++ b/compiler/ghci/ByteCodeItbls.lhs @@ -84,7 +84,7 @@ mkITbl tc dcs = tyConDataCons tc n = tyConFamilySize tc -#include "../includes/ClosureTypes.h" +#include "../includes/rts/storage/ClosureTypes.h" cONSTR :: Int -- Defined in ClosureTypes.h cONSTR = CONSTR @@ -151,7 +151,7 @@ ptrToInt (Ptr a#) = I# (addr2Int# a#) #if sparc_TARGET_ARCH -- After some consideration, we'll try this, where -- 0x55555555 stands in for the address to jump to. --- According to ghc/includes/MachRegs.h, %g3 is very +-- According to includes/rts/MachRegs.h, %g3 is very -- likely indeed to be baggable. -- -- 0000 07155555 sethi %hi(0x55555555), %g3 diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs index cc16047616..c0b9140525 100644 --- a/compiler/ghci/RtClosureInspect.hs +++ b/compiler/ghci/RtClosureInspect.hs @@ -165,7 +165,7 @@ data Closure = Closure { tipe :: ClosureType instance Outputable ClosureType where ppr = text . show -#include "../includes/ClosureTypes.h" +#include "../includes/rts/storage/ClosureTypes.h" aP_CODE, pAP_CODE :: Int aP_CODE = AP diff --git a/compiler/iface/BinIface.hs b/compiler/iface/BinIface.hs index 679494b0a5..15cefe8cdf 100644 --- a/compiler/iface/BinIface.hs +++ b/compiler/iface/BinIface.hs @@ -206,7 +206,7 @@ initBinMemSize :: Int initBinMemSize = 1024 * 1024 -- The *host* architecture version: -#include "MachDeps.h" +#include "../includes/MachDeps.h" binaryInterfaceMagic :: Word32 #if WORD_SIZE_IN_BITS == 32 diff --git a/compiler/main/Constants.lhs b/compiler/main/Constants.lhs index b809f5280b..106c9a78ca 100644 --- a/compiler/main/Constants.lhs +++ b/compiler/main/Constants.lhs @@ -14,8 +14,8 @@ import Data.Bits (shiftL) -- be in trouble. #include "HsVersions.h" -#include "../includes/MachRegs.h" -#include "../includes/Constants.h" +#include "../includes/stg/MachRegs.h" +#include "../includes/rts/Constants.h" #include "../includes/MachDeps.h" #include "../includes/DerivedConstants.h" diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 126b3a064a..b13661ed99 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -275,7 +275,7 @@ opt_Unregisterised = lookUp (fsLit "-funregisterised") -- Derived, not a real option. Determines whether we will be compiling -- info tables that reside just before the entry code, or with an -- indirection to the entry code. See TABLES_NEXT_TO_CODE in --- includes/InfoTables.h. +-- includes/rts/storage/InfoTables.h. tablesNextToCode :: Bool tablesNextToCode = not opt_Unregisterised && cGhcEnableTablesNextToCode == "YES" diff --git a/compiler/nativeGen/Alpha/Regs.hs b/compiler/nativeGen/Alpha/Regs.hs index 0a5c24e65a..2d85c5f141 100644 --- a/compiler/nativeGen/Alpha/Regs.hs +++ b/compiler/nativeGen/Alpha/Regs.hs @@ -21,7 +21,7 @@ where {- #include "nativeGen/NCG.h" #include "HsVersions.h" -#include "../includes/MachRegs.h" +#include "../includes/stg/MachRegs.h" import RegsBase diff --git a/compiler/nativeGen/PPC/CodeGen.hs b/compiler/nativeGen/PPC/CodeGen.hs index 8eb515e6bf..495296a6ec 100644 --- a/compiler/nativeGen/PPC/CodeGen.hs +++ b/compiler/nativeGen/PPC/CodeGen.hs @@ -22,7 +22,7 @@ where #include "HsVersions.h" #include "nativeGen/NCG.h" -#include "MachDeps.h" +#include "../includes/MachDeps.h" -- NCG stuff: import PPC.Instr diff --git a/compiler/nativeGen/PPC/Regs.hs b/compiler/nativeGen/PPC/Regs.hs index 467ea49786..18f06ed6ef 100644 --- a/compiler/nativeGen/PPC/Regs.hs +++ b/compiler/nativeGen/PPC/Regs.hs @@ -49,7 +49,7 @@ where #include "nativeGen/NCG.h" #include "HsVersions.h" -#include "../includes/MachRegs.h" +#include "../includes/stg/MachRegs.h" import Reg import RegClass diff --git a/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs b/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs index 5f3f0ac495..fd0faaee90 100644 --- a/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs +++ b/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs @@ -43,7 +43,7 @@ import FastTypes -- There is an allocatableRegsInClass :: RegClass -> Int, but doing the unboxing -- is too slow for us here. -- --- Look at includes/MachRegs.h to get these numbers. +-- Look at includes/stg/MachRegs.h to get these numbers. -- #if i386_TARGET_ARCH diff --git a/compiler/nativeGen/RegAlloc/Linear/Main.hs b/compiler/nativeGen/RegAlloc/Linear/Main.hs index 00e01d7ebc..7201207c79 100644 --- a/compiler/nativeGen/RegAlloc/Linear/Main.hs +++ b/compiler/nativeGen/RegAlloc/Linear/Main.hs @@ -115,7 +115,7 @@ import Data.Maybe import Data.List import Control.Monad -#include "../includes/MachRegs.h" +#include "../includes/stg/MachRegs.h" -- ----------------------------------------------------------------------------- diff --git a/compiler/nativeGen/SPARC/CodeGen.hs b/compiler/nativeGen/SPARC/CodeGen.hs index 39ab5ebdef..c430e18579 100644 --- a/compiler/nativeGen/SPARC/CodeGen.hs +++ b/compiler/nativeGen/SPARC/CodeGen.hs @@ -15,7 +15,7 @@ where #include "HsVersions.h" #include "nativeGen/NCG.h" -#include "MachDeps.h" +#include "../includes/MachDeps.h" -- NCG stuff: import SPARC.CodeGen.Sanity diff --git a/compiler/nativeGen/SPARC/RegPlate.hs b/compiler/nativeGen/SPARC/RegPlate.hs index 0301ab75c0..a0d0e4c88d 100644 --- a/compiler/nativeGen/SPARC/RegPlate.hs +++ b/compiler/nativeGen/SPARC/RegPlate.hs @@ -93,7 +93,7 @@ import FastBool #define f31 63 -#include "../includes/MachRegs.h" +#include "../includes/stg/MachRegs.h" -- | Check whether a machine register is free for allocation. freeReg :: RegNo -> FastBool diff --git a/compiler/nativeGen/SPARC/Regs.hs b/compiler/nativeGen/SPARC/Regs.hs index 1c41e888ae..8ad400f813 100644 --- a/compiler/nativeGen/SPARC/Regs.hs +++ b/compiler/nativeGen/SPARC/Regs.hs @@ -54,7 +54,7 @@ import FastBool prepared for any eventuality. The whole fp-register pairing thing on sparcs is a huge nuisance. See - fptools/ghc/includes/MachRegs.h for a description of what's going on + includes/stg/MachRegs.h for a description of what's going on here. -} @@ -290,11 +290,13 @@ regDotColor reg -- Hard coded freeReg / globalRegMaybe ----------------------------------------- -- This isn't being used at the moment because we're generating --- these functions from the information in includes/MachRegs.hs via RegPlate.hs +-- these functions from the information in +-- includes/stg/MachRegs.hs via RegPlate.hs -- | Check whether a machine register is free for allocation. --- This needs to match the info in includes/MachRegs.h otherwise modules --- compiled with the NCG won't be compatible with via-C ones. +-- This needs to match the info in includes/stg/MachRegs.h +-- otherwise modules compiled with the NCG won't be compatible +-- with via-C ones. -- {- freeReg :: RegNo -> FastBool diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs index 8a1c77e1df..2e72d16854 100644 --- a/compiler/nativeGen/X86/CodeGen.hs +++ b/compiler/nativeGen/X86/CodeGen.hs @@ -27,7 +27,7 @@ where #include "HsVersions.h" #include "nativeGen/NCG.h" -#include "MachDeps.h" +#include "../includes/MachDeps.h" -- NCG stuff: import X86.Instr diff --git a/compiler/nativeGen/X86/Ppr.hs b/compiler/nativeGen/X86/Ppr.hs index 398c480aaf..c0f465791c 100644 --- a/compiler/nativeGen/X86/Ppr.hs +++ b/compiler/nativeGen/X86/Ppr.hs @@ -466,7 +466,7 @@ pprDataItem lit -- all such offsets will fit into 32 bits, so we have to stick -- to 32-bit offset fields and modify the RTS appropriately -- - -- See Note [x86-64-relative] in includes/InfoTables.h + -- See Note [x86-64-relative] in includes/rts/storage/InfoTables.h -- ppr_item II64 x | isRelativeReloc x = diff --git a/compiler/nativeGen/X86/Regs.hs b/compiler/nativeGen/X86/Regs.hs index 3a1d93883d..64d835b2eb 100644 --- a/compiler/nativeGen/X86/Regs.hs +++ b/compiler/nativeGen/X86/Regs.hs @@ -54,7 +54,7 @@ where -- HACK: go for the max #endif -#include "../includes/MachRegs.h" +#include "../includes/stg/MachRegs.h" import Reg import RegClass diff --git a/compiler/parser/cutils.c b/compiler/parser/cutils.c index 4a7b7b3c68..157c90290d 100644 --- a/compiler/parser/cutils.c +++ b/compiler/parser/cutils.c @@ -4,7 +4,9 @@ places in the GHC library. */ #include "Rts.h" +#if __GLASGOW_HASKELL__ <= 610 #include "RtsFlags.h" +#endif #include "HsFFI.h" @@ -20,19 +22,19 @@ and causes gcc to require too many registers on x84 */ HsInt -ghc_strlen( HsAddr a ) +ghc_strlen( HsPtr a ) { return (strlen((char *)a)); } HsInt -ghc_memcmp( HsAddr a1, HsAddr a2, HsInt len ) +ghc_memcmp( HsPtr a1, HsPtr a2, HsInt len ) { return (memcmp((char *)a1, a2, len)); } HsInt -ghc_memcmp_off( HsAddr a1, HsInt i, HsAddr a2, HsInt len ) +ghc_memcmp_off( HsPtr a1, HsInt i, HsPtr a2, HsInt len ) { return (memcmp((char *)a1 + i, a2, len)); } diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 6cd045a98b..e633f35b3a 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -59,7 +59,7 @@ module Binary #include "HsVersions.h" -- The *host* architecture version: -#include "MachDeps.h" +#include "../includes/MachDeps.h" import {-# SOURCE #-} Name (Name) import FastString diff --git a/compiler/utils/FastMutInt.lhs b/compiler/utils/FastMutInt.lhs index 1b2b05eb9f..6aa1c798cf 100644 --- a/compiler/utils/FastMutInt.lhs +++ b/compiler/utils/FastMutInt.lhs @@ -19,7 +19,7 @@ module FastMutInt( #ifdef __GLASGOW_HASKELL__ -#include "MachDeps.h" +#include "../includes/MachDeps.h" #ifndef SIZEOF_HSINT #define SIZEOF_HSINT INT_SIZE_IN_BYTES #endif |