diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2022-03-21 11:41:33 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-03-23 13:44:05 -0400 |
commit | e3f60577b5c513ae9c7bc6dc70c95c3e2762fa6c (patch) | |
tree | 415bcba1c7aa37cb2c9bef11061d45c42c9097ca | |
parent | 1a7cf0963e3511864013bbadfd1f01aaae16df80 (diff) | |
download | haskell-e3f60577b5c513ae9c7bc6dc70c95c3e2762fa6c.tar.gz |
Reverse dependency between StgToCmm and Runtime.Heap.Layout
-rw-r--r-- | compiler/GHC/IfaceToCore.hs | 1 | ||||
-rw-r--r-- | compiler/GHC/Runtime/Heap/Layout.hs | 36 | ||||
-rw-r--r-- | compiler/GHC/StgToCmm/Types.hs | 48 |
3 files changed, 42 insertions, 43 deletions
diff --git a/compiler/GHC/IfaceToCore.hs b/compiler/GHC/IfaceToCore.hs index a2f18c0797..33c9be542e 100644 --- a/compiler/GHC/IfaceToCore.hs +++ b/compiler/GHC/IfaceToCore.hs @@ -38,6 +38,7 @@ import GHC.Iface.Load import GHC.Iface.Env import GHC.StgToCmm.Types +import GHC.Runtime.Heap.Layout import GHC.Tc.Errors.Types import GHC.Tc.TyCl.Build diff --git a/compiler/GHC/Runtime/Heap/Layout.hs b/compiler/GHC/Runtime/Heap/Layout.hs index db114a6eae..0e43f1b85e 100644 --- a/compiler/GHC/Runtime/Heap/Layout.hs +++ b/compiler/GHC/Runtime/Heap/Layout.hs @@ -47,8 +47,6 @@ module GHC.Runtime.Heap.Layout ( import GHC.Prelude -import GHC.StgToCmm.Types - import GHC.Types.Basic( ConTagZ ) import GHC.Platform import GHC.Platform.Profile @@ -70,6 +68,9 @@ import Data.ByteString (ByteString) -- | Byte offset, or byte count type ByteOff = Int +-- | Word offset, or word count +type WordOff = Int + -- | Round up the given byte count to the next byte count that's a -- multiple of the machine's word size. roundUpToWords :: Platform -> ByteOff -> ByteOff @@ -198,6 +199,37 @@ type ConstrDescription = ByteString -- result of dataConIdentity type FunArity = Int type SelectorOffset = Int +-- | We represent liveness bitmaps as a Bitmap (whose internal representation +-- really is a bitmap). These are pinned onto case return vectors to indicate +-- the state of the stack for the garbage collector. +-- +-- In the compiled program, liveness bitmaps that fit inside a single word +-- (StgWord) are stored as a single word, while larger bitmaps are stored as a +-- pointer to an array of words. + +type Liveness = [Bool] -- One Bool per word; True <=> non-ptr or dead + -- False <=> ptr + +-------------------------------------------------------------------------------- +-- | An ArgDescr describes the argument pattern of a function + +data ArgDescr + = ArgSpec -- Fits one of the standard patterns + !Int -- RTS type identifier ARG_P, ARG_N, ... + + | ArgGen -- General case + Liveness -- Details about the arguments + + | ArgUnknown -- For imported binds. + -- Invariant: Never Unknown for binds of the module + -- we are compiling. + deriving (Eq) + +instance Outputable ArgDescr where + ppr (ArgSpec n) = text "ArgSpec" <+> ppr n + ppr (ArgGen ls) = text "ArgGen" <+> ppr ls + ppr ArgUnknown = text "ArgUnknown" + ----------------------------------------------------------------------------- -- Construction diff --git a/compiler/GHC/StgToCmm/Types.hs b/compiler/GHC/StgToCmm/Types.hs index 1a4d06ed9b..dd6b3355ba 100644 --- a/compiler/GHC/StgToCmm/Types.hs +++ b/compiler/GHC/StgToCmm/Types.hs @@ -4,22 +4,24 @@ module GHC.StgToCmm.Types ( CgInfos (..) , LambdaFormInfo (..) , ModuleLFInfos - , Liveness - , ArgDescr (..) , StandardFormInfo (..) - , WordOff , DoSCCProfiling , DoExtDynRefs ) where import GHC.Prelude +import GHC.Core.DataCon + +import GHC.Stg.InferTags.TagSig + +import GHC.Runtime.Heap.Layout + import GHC.Types.Basic import GHC.Types.ForeignStubs -import GHC.Core.DataCon import GHC.Types.Name.Env import GHC.Types.Name.Set -import GHC.Stg.InferTags.TagSig + import GHC.Utils.Outputable @@ -168,39 +170,6 @@ pprUpdateable True = text "updateable" pprUpdateable False = text "oneshot" -------------------------------------------------------------------------------- - --- | We represent liveness bitmaps as a Bitmap (whose internal representation --- really is a bitmap). These are pinned onto case return vectors to indicate --- the state of the stack for the garbage collector. --- --- In the compiled program, liveness bitmaps that fit inside a single word --- (StgWord) are stored as a single word, while larger bitmaps are stored as a --- pointer to an array of words. - -type Liveness = [Bool] -- One Bool per word; True <=> non-ptr or dead - -- False <=> ptr - --------------------------------------------------------------------------------- --- | An ArgDescr describes the argument pattern of a function - -data ArgDescr - = ArgSpec -- Fits one of the standard patterns - !Int -- RTS type identifier ARG_P, ARG_N, ... - - | ArgGen -- General case - Liveness -- Details about the arguments - - | ArgUnknown -- For imported binds. - -- Invariant: Never Unknown for binds of the module - -- we are compiling. - deriving (Eq) - -instance Outputable ArgDescr where - ppr (ArgSpec n) = text "ArgSpec" <+> ppr n - ppr (ArgGen ls) = text "ArgGen" <+> ppr ls - ppr ArgUnknown = text "ArgUnknown" - --------------------------------------------------------------------------------- -- | StandardFormInfo tells whether this thunk has one of a small number of -- standard forms @@ -226,9 +195,6 @@ data StandardFormInfo !RepArity -- Arity, n deriving (Eq) --- | Word offset, or word count -type WordOff = Int - instance Outputable StandardFormInfo where ppr NonStandardThunk = text "RegThunk" ppr (SelectorThunk w) = text "SelThunk:" <> ppr w |