diff --git a/tests/Benchmarks/ChameneosRedux/MVarList.hs b/tests/Benchmarks/ChameneosRedux/MVarList.hs index e738bf5e62c0..60c8bc61bcce 100644 --- a/tests/Benchmarks/ChameneosRedux/MVarList.hs +++ b/tests/Benchmarks/ChameneosRedux/MVarList.hs @@ -59,7 +59,7 @@ import GHC.IORef -- x:tl -> (Queue tl back, Just x) -- NOTE KC: Even a list seems to work just as well as a queue. -newtype Queue a = Queue [a] +data Queue a = Queue [a] _INL_(emptyQueue) emptyQueue :: Queue a diff --git a/tests/Benchmarks/ChameneosRedux/Makefile b/tests/Benchmarks/ChameneosRedux/Makefile index 3601228df1e2..267677a9df9b 100644 --- a/tests/Benchmarks/ChameneosRedux/Makefile +++ b/tests/Benchmarks/ChameneosRedux/Makefile @@ -5,7 +5,7 @@ include ../../config.mk TOP := ../../../ GHC_OPTS_EXTRA=-O2 -threaded -XBangPatterns -XCPP -XGeneralizedNewtypeDeriving -funbox-strict-fields -optc-O3 -PROFILE_FLAGS := -DPROFILE_ENABLED -prof -auto-all -fprof-auto +PROFILE_FLAGS := -DPROFILE_ENABLED -prof -fprof-auto -auto -auto-all #Uncomment the following line to enable profiled compilation #GHC_OPTS_EXTRA += $(PROFILE_FLAGS) diff --git a/tests/Benchmarks/Sieve/sieve-lwc.hs b/tests/Benchmarks/Sieve/sieve-lwc.hs index 293575239631..bf8ccae17d9d 100644 --- a/tests/Benchmarks/Sieve/sieve-lwc.hs +++ b/tests/Benchmarks/Sieve/sieve-lwc.hs @@ -18,9 +18,8 @@ generate mOut = mapM_ (putMVar mOut) [2..] -- Take a value from mIn, divide it by a prime, if the remainder is not 0, put the value in mOut. primeFilter :: MVar Int -> MVar Int -> Int -> IO () primeFilter mIn mOut prime = do - hole <- newIORef 0 forever $ do - i <- takeMVarWithHole mIn hole + i <- takeMVar mIn when (i `mod` prime /= 0) (putMVar mOut i) -- Take the first commandline argument and call it numArg. @@ -34,15 +33,14 @@ main = do mIn <- newEmptyMVar forkIO $ generate mIn out <- replicateM (read numArg) newEmptyMVar - hole <- newIORef 0 - foldM_ (linkFilter hole) mIn out + foldM_ linkFilter mIn out -- Take a value from mIn, and call it prime. Then show that prime. Make a new thread that -- runs primeFilter with mIn, mOut and the prime. When this function is used as a fold -- function, mOut becomes the mIn of the next iteration. -linkFilter :: IORef Int -> MVar Int -> MVar Int -> IO (MVar Int) -linkFilter hole mIn mOut = do - prime <- takeMVarWithHole mIn hole +linkFilter :: MVar Int -> MVar Int -> IO (MVar Int) +linkFilter mIn mOut = do + prime <- takeMVar mIn putStrLn $ show prime forkIO $ primeFilter mIn mOut prime return mOut