derive-storable-plugin 0.2.3.5 → 0.2.3.6
raw patch · 6 files changed
+26/−14 lines, 6 filesdep ~ghcdep ~ghciPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ghc, ghci
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- README.md +1/−1
- derive-storable-plugin.cabal +4/−4
- src/Foreign/Storable/Generic/Plugin.hs +5/−1
- src/Foreign/Storable/Generic/Plugin/Internal/Compile.hs +10/−6
- src/Foreign/Storable/Generic/Plugin/Internal/Predicates.hs +2/−2
ChangeLog.md view
@@ -1,5 +1,9 @@ # Revision history for generic-storable-plugin +## 0.2.3.6 -- 2022-10-30++* Adding support for GHC 9.4.2 [thanks to amasgen](https://github.com/mkloczko/derive-storable-plugin/pull/10).+ ## 0.2.3.5 -- 2022-04-03 * Adding support for GHC 9.2.1 [thanks to dpwiz](https://github.com/mkloczko/derive-storable-plugin/pull/6).
README.md view
@@ -1,6 +1,6 @@ # Introduction -[](https://travis-ci.org/mkloczko/derive-storable-plugin)+[](https://hackage.haskell.org/package/derive-storable-plugin) [](https://github.com/mkloczko/derive-storable-plugin/actions?query=workflow%3AHaskell-CI) The goal of `derive-storable-plugin` is to support the [derive-storable](http://hackage.haskell.org/package/derive-storable) package. It introduces optimisations to GStorable methods derived using GHC.Generics at core-to-core passes.
derive-storable-plugin.cabal view
@@ -2,7 +2,7 @@ -- further documentation, see http://haskell.org/cabal/users-guide/ name: derive-storable-plugin-version: 0.2.3.5+version: 0.2.3.6 synopsis: GHC core plugin supporting the derive-storable package. description: The package helps derive-storable package in forcing compile time evaluation of sizes, alignments and offsets.@@ -16,7 +16,7 @@ build-type: Simple extra-source-files: ChangeLog.md README.md cabal-version: >=1.10-tested-with: GHC==8.2.2, GHC==8.4.2, GHC==8.6.5, GHC==8.8.1, GHC==8.10.7, GHC==9.0.2, GHC==9.2.2+tested-with: GHC==8.2.2, GHC==8.4.2, GHC==8.6.5, GHC==8.8.1, GHC==8.10.7, GHC==9.0.2, GHC==9.2.2, GHC==9.4.2 Flag sumtypes Description: Use sumtypes within benchmark and tests.@@ -32,7 +32,7 @@ , Foreign.Storable.Generic.Plugin.Internal.Predicates , Foreign.Storable.Generic.Plugin.Internal.Types other-extensions: DeriveGeneric, DeriveAnyClass, PatternGuards- build-depends: base >=4.10 && <5, ghc >= 8.2 && < 9.3, ghci >= 8.2 && < 9.3, derive-storable >= 0.3 && < 0.4+ build-depends: base >=4.10 && <5, ghc >= 8.2 && < 9.5, ghci >= 8.2 && < 9.5, derive-storable >= 0.3 && < 0.4 hs-source-dirs: src default-language: Haskell2010 @@ -60,7 +60,7 @@ other-modules: TestCases build-depends: base >= 4.10 && < 5, derive-storable, derive-storable-plugin , hspec >= 2.4, QuickCheck >= 2.10- , ghc >= 8.2 && < 9.3, ghci >= 8.2 && < 9.3+ , ghc >= 8.2 && < 9.5, ghci >= 8.2 && < 9.5 default-language: Haskell2010 if flag(sumtypes)
src/Foreign/Storable/Generic/Plugin.hs view
@@ -113,7 +113,11 @@ install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo] install opts todos = do dyn_flags <- getDynFlags- let opt_level = optLevel dyn_flags +#if MIN_VERSION_GLASGOW_HASKELL(9,4,0,0)+ let opt_level = llvmOptLevel dyn_flags+#else+ let opt_level = optLevel dyn_flags+#endif flags = parseOpts opts m_phase0 = afterPhase0 todos m_spec = afterSpecialize todos
src/Foreign/Storable/Generic/Plugin/Internal/Compile.hs view
@@ -45,7 +45,7 @@ import GHC.Core (Bind(..),Expr(..), CoreExpr, CoreBind, CoreProgram, Alt(..), AltCon(..), isId, Unfolding(..)) import GHC.Types.Literal (Literal(..)) import GHC.Types.Id (isLocalId, isGlobalId,setIdInfo, Id)-import GHC.Types.Id.Info (IdInfo(..))+import GHC.Types.Id.Info (IdInfo(..), setUnfoldingInfo, unfoldingInfo) import GHC.Types.Var (Var(..)) import GHC.Types.Name (getOccName,mkOccName,getSrcSpan) import GHC.Types.Name.Occurrence (OccName(..), occNameString)@@ -77,7 +77,7 @@ import CoreSyn (Bind(..),Expr(..), CoreExpr, CoreBind, CoreProgram, Alt, AltCon(..), isId, Unfolding(..)) import Literal (Literal(..)) import Id (isLocalId, isGlobalId,setIdInfo, Id)-import IdInfo (IdInfo(..))+import IdInfo (IdInfo(..), setUnfoldingInfo) import Var (Var(..)) import Name (getOccName,mkOccName,getSrcSpan) import OccName (OccName(..), occNameString)@@ -181,7 +181,12 @@ -- | Compile an expression. compileExpr :: HscEnv -> CoreExpr -> SrcSpan -> IO a compileExpr hsc_env expr src_span = do- foreign_hval <- liftIO $ hscCompileCoreExpr hsc_env src_span expr+#if MIN_VERSION_GLASGOW_HASKELL(9,4,0,0)+ (foreign_hval, _, _) <-+#else+ foreign_hval <-+#endif+ liftIO $ hscCompileCoreExpr hsc_env src_span expr hval <- liftIO $ withForeignRef foreign_hval localRef let val = unsafeCoerce hval :: a -- finalizeForeignRef foreign_hval -- check whether that's the source of the error@@ -542,7 +547,6 @@ Just e -> return $ Right e Nothing -> return $ Left $ OtherError (text "This shouldn't happen." $$ text "`m_subs <|> Just e` cannot be `Nothing`.")- | otherwise = return $ Left $ OtherError $ (text "Unsupported expression:" $$ ppr expr) ----------------- -- compilation --@@ -579,8 +583,8 @@ , id_info <- idInfo id , unfolding <- unfoldingInfo id_info , _ <- uf_tmpl- = NonRec (setIdInfo id $ id_info {unfoldingInfo = unfolding{uf_tmpl = expr} } ) expr- | otherwise + = NonRec (setIdInfo id $ setUnfoldingInfo id_info unfolding{uf_tmpl = expr} ) expr+ | otherwise = b
src/Foreign/Storable/Generic/Plugin/Internal/Predicates.hs view
@@ -241,7 +241,7 @@ -- | Is a GStorable identifier isGStorableId :: Id -> Bool-isGStorableId id = any ($id) [ isSizeOfId, isAlignmentId, isPeekId+isGStorableId id = any ($ id) [ isSizeOfId, isAlignmentId, isPeekId , isPokeId, isGStorableInstId , isSpecSizeOfId, isSpecAlignmentId , isSpecPeekId, isSpecPokeId@@ -253,7 +253,7 @@ ] -- | Is the id an GStorable method. isGStorableMethodId :: Id -> Bool -isGStorableMethodId id = any ($id) [isSizeOfId, isAlignmentId+isGStorableMethodId id = any ($ id) [isSizeOfId, isAlignmentId , isPeekId, isPokeId , isSpecSizeOfId, isSpecAlignmentId , isSpecPeekId, isSpecPokeId