inline-asm 0.4.0.1 → 0.4.0.2
raw patch · 4 files changed
+16/−6 lines, 4 files
Files
- ChangeLog.md +4/−0
- README.md +4/−3
- inline-asm.cabal +3/−3
- src/Language/Asm/Inline.hs +5/−0
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for inline-asm +## v0.4.0.2++* Fix compatibility with the recently released template-haskell-2.16.0.0.+ ## v0.4.0.1 * Fix expression parser not parsing some expressions it definitely should parse.
README.md view
@@ -112,7 +112,8 @@ We might introduce some syntax to pick unused registers in a future version, but for now care must be taken. `ByteString` parameters are supported, but, being composite objects, they are a bit special:-an input parameter+an input parameter of type `ByteString` actually takes two registers:+one for the address of the string, and one for its length. Sometimes it might be handy to reassociate an input parameter with another register. For this, the `{move argName newReg}` antiquoter can be used (for instance, `{move someInt rdi}`).@@ -156,7 +157,7 @@ ## Safety and notes -* First of all, all this is utterly unsafe.+* Firstly, all of this is utterly unsafe. * The compiler sees the generated functions as pure, so if a function calls, say, `RDRAND` and is itself called more than once to get several random numbers, care must be taken to ensure the compiler doesn't elide extra calls.@@ -166,7 +167,7 @@ so one can freely pick arbitrary naming for the labels and so on, but, on the other hand, one cannot access labels in other functions. This can be remedied somewhat easily — consider throwing up an issue if that's actually desired.-* Finally, all this is utterly unsafe.+* Finally, all of this is utterly unsafe. [travis]: <https://travis-ci.org/0xd34df00d/inline-asm> [travis-badge]: <https://travis-ci.org/0xd34df00d/inline-asm.svg?branch=master>
inline-asm.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.2.+-- This file has been generated from package.yaml by hpack version 0.33.0. -- -- see: https://github.com/sol/hpack ----- hash: 1c3cded6588b9b5609e74d24e1b430bda30bb591a276e05d7908a41a23636c86+-- hash: fd06f801cd1e8354d11a3ed0cb6623ada695ee43df28ddfa368a6a3f8dc76136 name: inline-asm-version: 0.4.0.1+version: 0.4.0.2 synopsis: Inline some Assembly in ur Haskell! description: Please see the README on GitHub at <https://github.com/0xd34df00d/inline-asm#readme> category: FFI
src/Language/Asm/Inline.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleInstances, FlexibleContexts, UndecidableInstances, FunctionalDependencies #-} {-# LANGUAGE DataKinds, PolyKinds, TypeFamilies #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-} module Language.Asm.Inline(defineAsmFun) where @@ -85,7 +86,11 @@ Nothing -> [e| rebox $(pure funAppE) |] Just n -> do retNames <- replicateM n $ newName "ret"+#if MIN_VERSION_template_haskell(2, 16, 0)+ boxing <- forM retNames $ \name -> Just <$> [e| rebox $(pure $ VarE name) |]+#else boxing <- forM retNames $ \name -> [e| rebox $(pure $ VarE name) |]+#endif [e| case $(pure funAppE) of $(pure $ UnboxedTupP $ VarP <$> retNames) -> $(pure $ TupE boxing) |]