summaryrefslogtreecommitdiff
path: root/compiler/GHC/Runtime
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-11 19:14:11 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-25 22:42:02 -0400
commit0de03cd78729dc58a846c64b645e71057ec5d24e (patch)
tree4d893f44db3fa94094376cf4fcad9a1a832ee261 /compiler/GHC/Runtime
parent262e42aa34c4d5705c8d011907c351497dd4e862 (diff)
downloadhaskell-0de03cd78729dc58a846c64b645e71057ec5d24e.tar.gz
DynFlags refactoring III
Use Platform instead of DynFlags when possible: * `tARGET_MIN_INT` et al. replaced with `platformMinInt` et al. * no more DynFlags in PreRules: added a new `RuleOpts` datatype * don't use `wORD_SIZE` in the compiler * make `wordAlignment` use `Platform` * make `dOUBLE_SIZE` a constant Metric Decrease: T13035 T1969
Diffstat (limited to 'compiler/GHC/Runtime')
-rw-r--r--compiler/GHC/Runtime/Heap/Inspect.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/GHC/Runtime/Heap/Inspect.hs b/compiler/GHC/Runtime/Heap/Inspect.hs
index 0daea2181b..37d9af0d8b 100644
--- a/compiler/GHC/Runtime/Heap/Inspect.hs
+++ b/compiler/GHC/Runtime/Heap/Inspect.hs
@@ -26,6 +26,7 @@ module GHC.Runtime.Heap.Inspect(
#include "HsVersions.h"
import GhcPrelude
+import GHC.Platform
import GHC.Runtime.Interpreter as GHCi
import GHCi.RemoteTypes
@@ -380,7 +381,7 @@ cPprTermBase y =
alloca $ \p -> poke p w >> peek (castPtr p)
return (Just (Ppr.double f))
-- let's assume that if we get two words, we're on a 32-bit
- -- machine. There's no good way to get a DynFlags to check the word
+ -- machine. There's no good way to get a Platform to check the word
-- size here.
ppr_double _ Term{subTerms=[Prim{valRaw=[w1,w2]}]} = do
let f = unsafeDupablePerformIO $
@@ -865,9 +866,10 @@ extractSubTerms recurse clos = liftM thdOf3 . go 0 0
-- within a single word. See also
-- GHC.StgToCmm.Layout.mkVirtHeapOffsetsWithPadding
dflags <- getDynFlags
- let word_size = wORD_SIZE dflags
+ let platform = targetPlatform dflags
+ word_size = platformWordSizeInBytes platform
big_endian = wORDS_BIGENDIAN dflags
- size_b = primRepSizeB dflags rep
+ size_b = primRepSizeB platform rep
-- Align the start offset (eg, 2-byte value should be 2-byte
-- aligned). But not more than to a word. The offset calculation
-- should be the same with the offset calculation in