From afa4b8b3de8987da42be045007c6903192c52e81 Mon Sep 17 00:00:00 2001 From: Sergey Vinokurov Date: Sun, 8 Dec 2024 17:42:59 +0000 Subject: [PATCH] =?UTF-8?q?GHC=208.6=20doesn=E2=80=99t=20have=20UnliftedNe?= =?UTF-8?q?wtypes=20so=20fall=20back=20to=20expensive=20boxed=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Control/Concurrent/Counter/Unlifted.hs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Control/Concurrent/Counter/Unlifted.hs b/src/Control/Concurrent/Counter/Unlifted.hs index e167766..fa2e1b5 100644 --- a/src/Control/Concurrent/Counter/Unlifted.hs +++ b/src/Control/Concurrent/Counter/Unlifted.hs @@ -22,7 +22,10 @@ {-# LANGUAGE MagicHash #-} {-# LANGUAGE UnboxedTuples #-} {-# LANGUAGE UnliftedFFITypes #-} -{-# LANGUAGE UnliftedNewtypes #-} + +#if __GLASGOW_HASKELL__ >= 810 +{-# LANGUAGE UnliftedNewtypes #-} +#endif module Control.Concurrent.Counter.Unlifted ( Counter @@ -113,10 +116,18 @@ sameCounter :: Counter s -> Counter s -> Bool sameCounter (Counter x) (Counter y) = isTrue# (reallyUnsafePtrEquality# x y) -#else +#endif + +#if !(defined(USE_CMM) && SIZEOF_HSINT == 8) -- | Memory location that supports select few atomic operations. +#if __GLASGOW_HASKELL__ >= 810 newtype Counter s = Counter (MutableByteArray# s) +#endif + +#if !(__GLASGOW_HASKELL__ >= 810) +data Counter s = Counter (MutableByteArray# s) +#endif {-# INLINE new #-} -- | Create new counter with initial value.