summaryrefslogtreecommitdiff
path: root/testsuite/tests/profiling
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-12-19 10:59:05 -0500
committerBen Gamari <ben@smart-cactus.org>2021-03-10 15:55:09 -0500
commite687ba83b0506bc800ceb79e6ee8cb0f8ed31ed6 (patch)
tree924f4d2ad0545a8416442b184cf405ca22fe9492 /testsuite/tests/profiling
parentaa9dc323fb1b64a0769d5da4ba5defadcb28403c (diff)
downloadhaskell-e687ba83b0506bc800ceb79e6ee8cb0f8ed31ed6.tar.gz
Bump bytestring submodule to 0.11.1.0
Diffstat (limited to 'testsuite/tests/profiling')
-rw-r--r--testsuite/tests/profiling/should_run/T3001-2.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/testsuite/tests/profiling/should_run/T3001-2.hs b/testsuite/tests/profiling/should_run/T3001-2.hs
index c7340dfd19..3767073cc3 100644
--- a/testsuite/tests/profiling/should_run/T3001-2.hs
+++ b/testsuite/tests/profiling/should_run/T3001-2.hs
@@ -3,20 +3,19 @@
-- GHC 6.10.1 and run with +RTS -hb. Most of the code is from the
-- binary 0.4.4 package.
-{-# LANGUAGE CPP, FlexibleInstances, FlexibleContexts, MagicHash #-}
+{-# LANGUAGE CPP, FlexibleInstances, FlexibleContexts, MagicHash, UnboxedTuples #-}
module Main (main) where
import Data.Semigroup
-import Data.ByteString.Internal (inlinePerformIO)
-
import qualified Data.ByteString as S
import qualified Data.ByteString.Internal as S
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString.Lazy.Internal as L
import GHC.Exts
+import GHC.IO
import GHC.Word
import Control.Monad
@@ -28,6 +27,11 @@ import Data.Char (chr,ord)
import Control.Applicative
+inlinePerformIO :: IO a -> a
+inlinePerformIO (IO m) = case m realWorld# of
+ (# _, r #) -> r
+{-# INLINE inlinePerformIO #-}
+
main :: IO ()
main = do
encodeFile "test.bin" $ replicate 10000 'x'
@@ -158,7 +162,7 @@ shiftl_w32 (W32# w) (I# i) = W32# (wordToWord32# ((word32ToWord# w) `uncheckedSh
getPtr :: Storable a => Int -> Get a
getPtr n = do
(fp,o,_) <- readN n S.toForeignPtr
- return . S.inlinePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o)
+ return . inlinePerformIO $ withForeignPtr fp $ \p -> peek (castPtr $ p `plusPtr` o)
getBytes :: Int -> Get S.ByteString
getBytes n = do