commit ghc-store-core for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-store-core for openSUSE:Factory checked in at 2017-08-31 20:59:54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-store-core (Old) and /work/SRC/openSUSE:Factory/.ghc-store-core.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-store-core" Thu Aug 31 20:59:54 2017 rev:3 rq:513502 version:0.4.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-store-core/ghc-store-core.changes 2017-05-10 20:49:01.655461889 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-store-core.new/ghc-store-core.changes 2017-08-31 20:59:55.182280079 +0200 @@ -1,0 +2,5 @@ +Wed Jul 26 16:56:09 UTC 2017 - psimons@suse.com + +- Update to version 0.4.1. + +------------------------------------------------------------------- Old: ---- store-core-0.3.tar.gz New: ---- store-core-0.4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-store-core.spec ++++++ --- /var/tmp/diff_new_pack.MCmqLC/_old 2017-08-31 20:59:55.942173312 +0200 +++ /var/tmp/diff_new_pack.MCmqLC/_new 2017-08-31 20:59:55.946172750 +0200 @@ -18,7 +18,7 @@ %global pkg_name store-core Name: ghc-%{pkg_name} -Version: 0.3 +Version: 0.4.1 Release: 0 Summary: Fast and lightweight binary serialization License: MIT ++++++ store-core-0.3.tar.gz -> store-core-0.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/store-core-0.3/ChangeLog.md new/store-core-0.4.1/ChangeLog.md --- old/store-core-0.3/ChangeLog.md 2016-10-24 05:13:37.000000000 +0200 +++ new/store-core-0.4.1/ChangeLog.md 2017-05-06 04:54:38.000000000 +0200 @@ -1,5 +1,15 @@ # ChangeLog +## 0.4.1 + +* Less aggressive inlining, resulting in faster compilation / simplifier + not running out of ticks + +## 0.4 + +* Changes result of Peek function to be strict. + (See [#98](https://github.com/fpco/store/pull/98)) + ## 0.3 * Adds support for alignment sensitive architectures, by using temporary buffers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/store-core-0.3/src/Data/Store/Core.hs new/store-core-0.4.1/src/Data/Store/Core.hs --- old/store-core-0.3/src/Data/Store/Core.hs 2016-10-16 03:35:26.000000000 +0200 +++ new/store-core-0.4.1/src/Data/Store/Core.hs 2017-05-06 05:07:24.000000000 +0200 @@ -13,7 +13,7 @@ module Data.Store.Core ( -- * Core Types Poke(..), PokeException(..), pokeException - , Peek(..), PeekException(..), peekException, tooManyBytes + , Peek(..), PeekResult(..), PeekException(..), peekException, tooManyBytes , PokeState, pokeStatePtr , PeekState, peekStateEndPtr , Offset @@ -174,26 +174,29 @@ -- together to get more complicated deserializers. This machinery keeps -- track of the current 'Ptr' and end-of-buffer 'Ptr'. newtype Peek a = Peek - { runPeek :: PeekState -> Ptr Word8 -> IO (Ptr Word8, a) + { runPeek :: PeekState -> Ptr Word8 -> IO (PeekResult a) -- ^ Run the 'Peek' action, with a 'Ptr' to the end of the buffer -- where data is poked, and a 'Ptr' to the current position. The -- result is the 'Ptr', along with a return value. -- -- May throw a 'PeekException' if the memory contains invalid -- values. - } - deriving Functor + } deriving (Functor) + +-- | A result of a 'Peek' action containing the current 'Ptr' and a return value. +data PeekResult a = PeekResult {-# UNPACK #-} !(Ptr Word8) !a + deriving (Functor) instance Applicative Peek where - pure x = Peek (\_ ptr -> return (ptr, x)) + pure x = Peek (\_ ptr -> return $ PeekResult ptr x) {-# INLINE pure #-} Peek f <*> Peek g = Peek $ \end ptr1 -> do - (ptr2, f') <- f end ptr1 - (ptr3, g') <- g end ptr2 - return (ptr3, f' g') + PeekResult ptr2 f' <- f end ptr1 + PeekResult ptr3 g' <- g end ptr2 + return $ PeekResult ptr3 (f' g') {-# INLINE (<*>) #-} Peek f *> Peek g = Peek $ \end ptr1 -> do - (ptr2, _) <- f end ptr1 + PeekResult ptr2 _ <- f end ptr1 g end ptr2 {-# INLINE (*>) #-} @@ -203,7 +206,7 @@ (>>) = (*>) {-# INLINE (>>) #-} Peek x >>= f = Peek $ \end ptr1 -> do - (ptr2, x') <- x end ptr1 + PeekResult ptr2 x' <- x end ptr1 runPeek (f x') end ptr2 {-# INLINE (>>=) #-} fail = peekException . T.pack @@ -219,11 +222,11 @@ type PrimState Peek = RealWorld primitive action = Peek $ \_ ptr -> do x <- primitive (unsafeCoerce# action) - return (ptr, x) + return $ PeekResult ptr x {-# INLINE primitive #-} instance MonadIO Peek where - liftIO f = Peek $ \_ ptr -> (ptr, ) <$> f + liftIO f = Peek $ \_ ptr -> PeekResult ptr <$> f {-# INLINE liftIO #-} -- | Holds a 'peekStatePtr', which is passed in to each 'Peek' action. @@ -310,7 +313,6 @@ } (o, ()) <- runPoke f ps 0 checkOffset o l -{-# INLINE unsafeEncodeWith #-} #if ALIGNED_MEMORY alignBufferSize :: Int @@ -336,21 +338,18 @@ -- consume all input. decodeWith :: Peek a -> ByteString -> Either PeekException a decodeWith mypeek = unsafePerformIO . try . decodeIOWith mypeek -{-# INLINE decodeWith #-} -- | Decodes a value from a 'ByteString', potentially throwing -- exceptions, and taking a 'Peek' to run. It is an exception to not -- consume all input. decodeExWith :: Peek a -> ByteString -> a decodeExWith f = unsafePerformIO . decodeIOWith f -{-# INLINE decodeExWith #-} -- | Similar to 'decodeExWith', but it allows there to be more of the -- buffer remaining. The 'Offset' of the buffer contents immediately -- after the decoded value is returned. decodeExPortionWith :: Peek a -> ByteString -> (Offset, a) decodeExPortionWith f = unsafePerformIO . decodeIOPortionWith f -{-# INLINE decodeExPortionWith #-} -- | Decodes a value from a 'ByteString', potentially throwing -- exceptions, and taking a 'Peek' to run. It is an exception to not @@ -360,7 +359,6 @@ withForeignPtr x $ \ptr0 -> let ptr = ptr0 `plusPtr` s in decodeIOWithFromPtr mypeek ptr len -{-# INLINE decodeIOWith #-} -- | Similar to 'decodeExPortionWith', but runs in the 'IO' monad. decodeIOPortionWith :: Peek a -> ByteString -> IO (Offset, a) @@ -368,7 +366,6 @@ withForeignPtr x $ \ptr0 -> let ptr = ptr0 `plusPtr` s in decodeIOPortionWithFromPtr mypeek ptr len -{-# INLINE decodeIOPortionWith #-} -- | Like 'decodeIOWith', but using 'Ptr' and length instead of a -- 'ByteString'. @@ -378,14 +375,13 @@ if len /= offset then throwIO $ PeekException (len - offset) "Didn't consume all input." else return x -{-# INLINE decodeIOWithFromPtr #-} -- | Like 'decodeIOPortionWith', but using 'Ptr' and length instead of a 'ByteString'. decodeIOPortionWithFromPtr :: Peek a -> Ptr Word8 -> Int -> IO (Offset, a) decodeIOPortionWithFromPtr mypeek ptr len = let end = ptr `plusPtr` len remaining = end `minusPtr` ptr - in do (ptr2, x') <- + in do PeekResult ptr2 x' <- #if ALIGNED_MEMORY allocaBytesAligned alignBufferSize 8 $ \aptr -> do runPeek mypeek (PeekState end aptr) ptr @@ -396,7 +392,6 @@ if len > remaining -- Do not perform the check on the new pointer, since it could have overflowed then throwIO $ PeekException (end `minusPtr` ptr2) "Overshot end of buffer" else return (ptr2 `minusPtr` ptr, x') -{-# INLINE decodeIOPortionWithFromPtr #-} ------------------------------------------------------------------------ -- Utilities for defining 'Store' instances based on 'Storable' @@ -464,7 +459,7 @@ #else x <- Storable.peek (castPtr ptr) #endif - return (ptr', x) + return $ PeekResult ptr' x {-# INLINE peekStorableTy #-} ------------------------------------------------------------------------ @@ -483,7 +478,6 @@ len let !newOffset = targetOffset + len return (newOffset, ()) -{-# INLINE pokeFromForeignPtr #-} -- | Allocate a plain ForeignPtr (no finalizers), of the specified -- length and fill it with bytes from the input. @@ -499,8 +493,7 @@ fp <- BS.mallocByteString len withForeignPtr fp $ \targetPtr -> BS.memcpy targetPtr (castPtr sourcePtr) len - return (ptr2, castForeignPtr fp) -{-# INLINE peekToPlainForeignPtr #-} + return $ PeekResult ptr2 (castForeignPtr fp) -- | Copy a section of memory, based on a 'Ptr', to the output. Note -- that this operation is unsafe, because the offset and length @@ -514,7 +507,6 @@ len let !newOffset = targetOffset + len return (newOffset, ()) -{-# INLINE pokeFromPtr #-} -- TODO: have a safer variant with the check? @@ -528,7 +520,6 @@ copyByteArrayToAddr sourceArr sourceOffset target len let !newOffset = targetOffset + len return (newOffset, ()) -{-# INLINE pokeFromByteArray #-} -- | Allocate a ByteArray of the specified length and fill it with bytes -- from the input. @@ -544,8 +535,7 @@ marr <- newByteArray len copyAddrToByteArray sourcePtr marr 0 len x <- unsafeFreezeByteArray marr - return (ptr2, x) -{-# INLINE peekToByteArray #-} + return $ PeekResult ptr2 x -- | Wrapper around @copyByteArrayToAddr#@ primop. copyByteArrayToAddr :: ByteArray# -> Int -> Ptr a -> Int -> IO () diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/store-core-0.3/store-core.cabal new/store-core-0.4.1/store-core.cabal --- old/store-core-0.3/store-core.cabal 2016-10-24 05:51:09.000000000 +0200 +++ new/store-core-0.4.1/store-core.cabal 2017-05-06 04:57:04.000000000 +0200 @@ -1,9 +1,9 @@ --- This file has been generated from package.yaml by hpack version 0.14.0. +-- This file has been generated from package.yaml by hpack version 0.17.0. -- -- see: https://github.com/sol/hpack name: store-core -version: 0.3 +version: 0.4.1 synopsis: Fast and lightweight binary serialization category: Serialization, Data homepage: https://github.com/fpco/store#readme
participants (1)
-
root@hilbert.suse.de