-
Notifications
You must be signed in to change notification settings - Fork 162
Add support for GHC 9.12 #2941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
martijnbastiaan
wants to merge
13
commits into
master
Choose a base branch
from
add-ghc912
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add support for GHC 9.12 #2941
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f80ac3b
Add GHC 9.12 support to `clash-prelude`
martijnbastiaan 0f48d6e
Add GHC 9.12 support to `clash-lib`
martijnbastiaan f7c428c
Add GHC 9.12 support to `clash-lib-hedgehog`
martijnbastiaan acd8076
Add source for GHC 9.12 executable
martijnbastiaan 2fe3478
Bump bounds of `clash-ghc`
martijnbastiaan f0f31b8
Apply Clash specific modifications to `src-bin-9.12`
martijnbastiaan 9171bd2
Compile `clash-ghc` warning free on GHC 9.12
martijnbastiaan c553407
Add GHC 9.12 support to `clash-cosim`
martijnbastiaan 230633d
Add GHC 9.12 support to `clash-testsuite`
martijnbastiaan 56dd077
Add GHC 9.12 to CI
martijnbastiaan 56c7d33
Use `data` for `Signed`/`Unsigned` on GHC >= 9.12
martijnbastiaan 6bfa864
Add GHC 9.12 to compatibility matrix
martijnbastiaan 6958d7e
Use `data` for `Signed`, `Unsigned`, `Index`, and `BiSignalOut`
martijnbastiaan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ADD: Added GHC 9.12 support |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{-# LANGUAGE RecordWildCards, LambdaCase #-} | ||
module Clash.GHCi.Leak | ||
( LeakIndicators | ||
, getLeakIndicators | ||
, checkLeakIndicators | ||
) where | ||
|
||
import Clash.GHCi.Util | ||
import Control.Monad | ||
import Data.Bits | ||
import Foreign.Ptr (ptrToIntPtr, intPtrToPtr) | ||
import GHC | ||
import GHC.Ptr (Ptr (..)) | ||
import GHC.Driver.Env | ||
import GHC.Driver.Ppr | ||
import GHC.Utils.Outputable | ||
import GHC.Unit.Module.ModDetails | ||
import GHC.Unit.Home.ModInfo | ||
import GHC.Platform (target32Bit) | ||
import GHC.Linker.Types | ||
import Prelude | ||
import System.Mem | ||
import System.Mem.Weak | ||
import GHC.Types.Unique.DFM | ||
import Control.Exception | ||
|
||
-- Checking for space leaks in GHCi. See #15111, and the | ||
-- -fghci-leak-check flag. | ||
|
||
data LeakIndicators = LeakIndicators [LeakModIndicators] | ||
|
||
data LeakModIndicators = LeakModIndicators | ||
{ leakMod :: Weak HomeModInfo | ||
, leakIface :: Weak ModIface | ||
, leakDetails :: Weak ModDetails | ||
, leakLinkable :: [Maybe (Weak Linkable)] | ||
} | ||
|
||
-- | Grab weak references to some of the data structures representing | ||
-- the currently loaded modules. | ||
getLeakIndicators :: HscEnv -> IO LeakIndicators | ||
getLeakIndicators hsc_env = | ||
fmap LeakIndicators $ | ||
forM (eltsUDFM (hsc_HPT hsc_env)) $ \hmi@HomeModInfo{..} -> do | ||
leakMod <- mkWeakPtr hmi Nothing | ||
leakIface <- mkWeakPtr hm_iface Nothing | ||
leakDetails <- mkWeakPtr hm_details Nothing | ||
leakLinkable <- mkWeakLinkables hm_linkable | ||
return $ LeakModIndicators{..} | ||
where | ||
mkWeakLinkables :: HomeModLinkable -> IO [Maybe (Weak Linkable)] | ||
mkWeakLinkables (HomeModLinkable mbc mo) = | ||
mapM (\ln -> traverse (flip mkWeakPtr Nothing <=< evaluate) ln) [mbc, mo] | ||
|
||
-- | Look at the LeakIndicators collected by an earlier call to | ||
-- `getLeakIndicators`, and print messasges if any of them are still | ||
-- alive. | ||
checkLeakIndicators :: DynFlags -> LeakIndicators -> IO () | ||
checkLeakIndicators dflags (LeakIndicators leakmods) = do | ||
performGC | ||
forM_ leakmods $ \LeakModIndicators{..} -> do | ||
deRefWeak leakMod >>= \case | ||
Nothing -> return () | ||
Just hmi -> | ||
report ("HomeModInfo for " ++ | ||
showSDoc dflags (ppr (mi_module (hm_iface hmi)))) (Just hmi) | ||
deRefWeak leakIface >>= \case | ||
Nothing -> return () | ||
Just miface -> report ("ModIface:" ++ moduleNameString (moduleName (mi_module miface))) (Just miface) | ||
deRefWeak leakDetails >>= report "ModDetails" | ||
forM_ leakLinkable $ \l -> forM_ l $ \l' -> deRefWeak l' >>= report "Linkable" | ||
where | ||
report :: String -> Maybe a -> IO () | ||
report _ Nothing = return () | ||
report msg (Just a) = do | ||
addr <- anyToPtr a | ||
putStrLn ("-fghci-leak-check: " ++ msg ++ " is still alive at " ++ | ||
show (maskTagBits addr)) | ||
|
||
tagBits | ||
| target32Bit (targetPlatform dflags) = 2 | ||
| otherwise = 3 | ||
|
||
maskTagBits :: Ptr a -> Ptr a | ||
maskTagBits p = intPtrToPtr (ptrToIntPtr p .&. complement (shiftL 1 tagBits - 1)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I'm concerned, I'd just put "1.8" there, not the minor. The minor version isn't all that important, and so far we've only indicated the major version. I feel it's kinda implied you pick the latest minor unless there's a strong reason not to.
I also feel a check mark for something we haven't actually tested (Windows and macOS) is a bit too optimistic.
I'm inclined to keep stuff we haven't tested crossed out. If you think crossed out is too negative, maybe we need to add a question mark emoji to indicate "might or might not work, why don't you try".