summaryrefslogtreecommitdiff
path: root/compiler/utils/FastFunctions.hs
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-08-18 18:38:28 +0200
committerBen Gamari <ben@smart-cactus.org>2015-08-18 18:42:12 +0200
commit3849dac59209cc2608636ae120eac54237d882c5 (patch)
treedf6a9cb2fc80dcfde31785188641b4b193016d16 /compiler/utils/FastFunctions.hs
parente43350573b7a6f233bc7ef2a8badaeb15fb46f34 (diff)
downloadhaskell-wip/d1141.tar.gz
Refactor: delete most of the module FastTypeswip/d1141
This reverses some of the work done in #1405, and goes back to the assumption that the bootstrap compiler understands GHC-haskell. In particular: * use MagicHash instead of _ILIT and _CLIT * pattern matching on I# if possible, instead of using iUnbox unnecessarily * use Int#/Char#/Addr# instead of the following type synonyms: - type FastInt = Int# - type FastChar = Char# - type FastPtr a = Addr# * inline the following functions: - iBox = I# - cBox = C# - fastChr = chr# - fastOrd = ord# - eqFastChar = eqChar# - shiftLFastInt = uncheckedIShiftL# - shiftR_FastInt = uncheckedIShiftRL# - shiftRLFastInt = uncheckedIShiftRL# * delete the following unused functions: - minFastInt - maxFastInt - uncheckedIShiftRA# - castFastPtr - panicDocFastInt and pprPanicFastInt * rename panicFastInt back to panic# These functions remain, since they actually do something: * iUnbox * bitAndFastInt * bitOrFastInt Test Plan: validate Reviewers: austin, bgamari Subscribers: rwbarton Differential Revision: https://phabricator.haskell.org/D1141 GHC Trac Issues: #1405
Diffstat (limited to 'compiler/utils/FastFunctions.hs')
-rw-r--r--compiler/utils/FastFunctions.hs31
1 files changed, 2 insertions, 29 deletions
diff --git a/compiler/utils/FastFunctions.hs b/compiler/utils/FastFunctions.hs
index 140e42949a..c643e3c8fb 100644
--- a/compiler/utils/FastFunctions.hs
+++ b/compiler/utils/FastFunctions.hs
@@ -1,46 +1,19 @@
{-
-Z%
(c) The University of Glasgow, 2000-2006
-
-\section{Fast functions}
-}
{-# LANGUAGE CPP, MagicHash, UnboxedTuples #-}
module FastFunctions (
- unsafeChr, inlinePerformIO, unsafeDupableInterleaveIO,
- indexWord8OffFastPtr,
- indexWord8OffFastPtrAsFastChar, indexWord8OffFastPtrAsFastInt,
- global, Global
+ inlinePerformIO,
) where
#include "HsVersions.h"
-import FastTypes
-import Data.IORef
-import System.IO.Unsafe
-
import GHC.Exts
-import GHC.Word
-import GHC.Base (unsafeChr)
-
-import GHC.IO (IO(..), unsafeDupableInterleaveIO)
+import GHC.IO (IO(..))
-- Just like unsafePerformIO, but we inline it.
{-# INLINE inlinePerformIO #-}
inlinePerformIO :: IO a -> a
inlinePerformIO (IO m) = case m realWorld# of (# _, r #) -> r
-
-indexWord8OffFastPtr p i = W8# (indexWord8OffAddr# p i)
-indexWord8OffFastPtrAsFastChar p i = indexCharOffAddr# p i
-indexWord8OffFastPtrAsFastInt p i = word2Int# (indexWord8OffAddr# p i)
--- or ord# (indexCharOffAddr# p i)
-
---just so we can refer to the type clearly in a macro
-type Global a = IORef a
-global :: a -> Global a
-global a = unsafePerformIO (newIORef a)
-
-indexWord8OffFastPtr :: FastPtr Word8 -> FastInt -> Word8
-indexWord8OffFastPtrAsFastChar :: FastPtr Word8 -> FastInt -> FastChar
-indexWord8OffFastPtrAsFastInt :: FastPtr Word8 -> FastInt -> FastInt