Commit a2a67cd5 authored by Simon Marlow's avatar Simon Marlow
Browse files

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.
parent 5d379cbe
......@@ -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
--
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
......@@ -50,7 +50,7 @@ module CgUtils (
) where
#include "HsVersions.h"
#include "../includes/MachRegs.h"
#include "../includes/stg/MachRegs.h"
import BlockId
import CgMonad
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
......@@ -44,7 +44,7 @@ module StgCmmUtils (
) where
#include "HsVersions.h"
#include "MachRegs.h"
#include "../includes/stg/MachRegs.h"
import StgCmmMonad
import StgCmmClosure
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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"
......
......@@ -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"
......
......@@ -21,7 +21,7 @@ where
{-
#include "nativeGen/NCG.h"
#include "HsVersions.h"
#include "../includes/MachRegs.h"
#include "../includes/stg/MachRegs.h"
import RegsBase
......
......@@ -22,7 +22,7 @@ where
#include "HsVersions.h"
#include "nativeGen/NCG.h"
#include "MachDeps.h"
#include "../includes/MachDeps.h"
-- NCG stuff:
import PPC.Instr
......
......@@ -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
......
......@@ -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
......
......@@ -115,7 +115,7 @@ import Data.Maybe
import Data.List
import Control.Monad
#include "../includes/MachRegs.h"
#include "../includes/stg/MachRegs.h"
-- -----------------------------------------------------------------------------
......
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