Add perf test for #16190
authorSylvain Henry <sylvain@haskus.fr>
Mon, 11 Feb 2019 16:39:02 +0000 (17:39 +0100)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Thu, 14 Feb 2019 07:29:54 +0000 (02:29 -0500)
testsuite/tests/perf/compiler/T16190.hs [new file with mode: 0644]
testsuite/tests/perf/compiler/T16190_Embed.hs [new file with mode: 0644]
testsuite/tests/perf/compiler/all.T

diff --git a/testsuite/tests/perf/compiler/T16190.hs b/testsuite/tests/perf/compiler/T16190.hs
new file mode 100644 (file)
index 0000000..79479f0
--- /dev/null
@@ -0,0 +1,17 @@
+{-# LANGUAGE TemplateHaskell #-}
+
+module Main where
+
+import T16190_Embed
+import Foreign.Ptr
+import Foreign.Storable
+import Data.Word
+import GHC.Ptr
+
+ptr :: Ptr Word32
+ptr = Ptr $(embedBytes (replicate (3 * 1000 * 1000) 0x37))
+
+main :: IO ()
+main = do
+   w <- peek (ptr `plusPtr` 12) 
+   print (w == (0x37373737 :: Word32))
diff --git a/testsuite/tests/perf/compiler/T16190_Embed.hs b/testsuite/tests/perf/compiler/T16190_Embed.hs
new file mode 100644 (file)
index 0000000..f7e50d6
--- /dev/null
@@ -0,0 +1,7 @@
+module T16190_Embed where
+
+import Data.Word
+import Language.Haskell.TH
+
+embedBytes :: [Word8] -> Q Exp
+embedBytes bs = return (LitE (StringPrimL bs))
index 9103719..82847c2 100644 (file)
@@ -390,3 +390,9 @@ test ('T15164',
       ],
       compile,
       ['-v0 -O'])
+
+test('T16190',
+      [ collect_stats()
+      ],
+      multimod_compile,
+      ['T16190.hs', '-v0'])