diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-03-12 17:06:09 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-04-01 01:21:27 -0400 |
commit | 0002db1bf436cbd32f97b659a52b1eee4e8b21db (patch) | |
tree | c42a2a91c5194a8af5c99b189ff1f8b6471ee809 /compiler/GHC/Runtime/Heap/Inspect.hs | |
parent | 7627eab5dd882eb6f1567e3ae95c6c770830a5eb (diff) | |
download | haskell-0002db1bf436cbd32f97b659a52b1eee4e8b21db.tar.gz |
Kill wORDS_BIGENDIAN and replace it with platformByteOrder (#17957)
Metric Decrease:
T13035
T1969
Diffstat (limited to 'compiler/GHC/Runtime/Heap/Inspect.hs')
-rw-r--r-- | compiler/GHC/Runtime/Heap/Inspect.hs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/compiler/GHC/Runtime/Heap/Inspect.hs b/compiler/GHC/Runtime/Heap/Inspect.hs index 5f34e9d2d2..b176c4bfc2 100644 --- a/compiler/GHC/Runtime/Heap/Inspect.hs +++ b/compiler/GHC/Runtime/Heap/Inspect.hs @@ -865,10 +865,9 @@ extractSubTerms recurse clos = liftM thdOf3 . go 0 0 -- This is a bit involved since we allow packing multiple fields -- within a single word. See also -- GHC.StgToCmm.Layout.mkVirtHeapOffsetsWithPadding - dflags <- getDynFlags - let platform = targetPlatform dflags - word_size = platformWordSizeInBytes platform - big_endian = wORDS_BIGENDIAN dflags + platform <- targetPlatform <$> getDynFlags + let word_size = platformWordSizeInBytes platform + endian = platformByteOrder platform 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 @@ -877,7 +876,7 @@ extractSubTerms recurse clos = liftM thdOf3 . go 0 0 !aligned_idx = roundUpTo arr_i (min word_size size_b) !new_arr_i = aligned_idx + size_b ws | size_b < word_size = - [index size_b aligned_idx word_size big_endian] + [index size_b aligned_idx word_size endian] | otherwise = let (q, r) = size_b `quotRem` word_size in ASSERT( r == 0 ) @@ -892,7 +891,7 @@ extractSubTerms recurse clos = liftM thdOf3 . go 0 0 (error "unboxedTupleTerm: no HValue for unboxed tuple") terms -- Extract a sub-word sized field from a word - index item_size_b index_b word_size big_endian = + index item_size_b index_b word_size endian = (word .&. (mask `shiftL` moveBytes)) `shiftR` moveBytes where mask :: Word @@ -903,9 +902,9 @@ extractSubTerms recurse clos = liftM thdOf3 . go 0 0 _ -> panic ("Weird byte-index: " ++ show index_b) (q,r) = index_b `quotRem` word_size word = array!!q - moveBytes = if big_endian - then word_size - (r + item_size_b) * 8 - else r * 8 + moveBytes = case endian of + BigEndian -> word_size - (r + item_size_b) * 8 + LittleEndian -> r * 8 -- | Fast, breadth-first Type reconstruction |